vicki vignesh
vicki vignesh

Reputation: 11

Extent Report Framework -How to get the Values Stored in Extent report Log Function

We use Extent report in my project. I want to access the values stored during runtime. For example in the catch block of the test case, I have a line Log(Failure,"faiure comments").

In the finally block, I am trying to create a function where, if the testcase fails, I will need to use the value of the log function and store it for some purpose.

Is it possible? I am using java with selenium in POM framework.

Upvotes: 1

Views: 1670

Answers (1)

foursyth
foursyth

Reputation: 527

If you are using version 4, you can do:

extent.getStats()

To drill into each data point for the entire run session. To drill into a single data-point, for example, the current test's last log:

test.getModel().getLogContext().getLast().getStatus()

But I would rather recommend you to use a test framework such as TestNG or Junit and listen to the context provided by these instead. Using Extent to do the same would work, but I would think its more intuitive and productive using your test framework.

PS. It is Extent, not Extend.

Upvotes: 1

Related Questions