extentreports-cucumber4-adapter icon indicating copy to clipboard operation
extentreports-cucumber4-adapter copied to clipboard

How can I add SystemInfo to reports?

Open vzenzo opened this issue 5 years ago • 19 comments

When using extent reports I would just add extent.setSystemInfo("InfoField", "InfoString")

Can I do this in html-config.xml or sparl-config.xml? I really need this as adapter simplified my code but the report is full of issues now (reporting hook tags such as @AfterStep, wrong colors in diagrams like skipped test is blue but check is yellow)

vzenzo avatar Apr 11 '20 13:04 vzenzo

@vzenzo

The @AfterStep issue is currently in progress, use version 1.0.12-SNAPSHOT.

I will mark the color issue in the API. Ref: https://github.com/extent-framework/extentreports-java/issues/144

anshooarora avatar Apr 13 '20 19:04 anshooarora

Regarding system info, this is currently not possible through configuration files. However, you can use:

ExtentService.getInstance().setSystemInfo(k, v);

anshooarora avatar Apr 13 '20 19:04 anshooarora

Regarding system info, this is currently not possible through configuration files. However, you can use:

ExtentService.getInstance().setSystemInfo(k, v);

is there any special place to put this? in some class or annotation?

vzenzo avatar Apr 14 '20 09:04 vzenzo

I've add this into the Runner class with @AfterClass and work as expected

@AfterClass public void setReportInfo() { ExtentService.getInstance()..setSystemInfo("App", APP_VERSION); ExtentService.getInstance().setSystemInfo("Device", BaseSetup.deviceName + " with " + BaseSetup.platformVersion); }

zuzeac avatar Apr 14 '20 11:04 zuzeac

I've add this into the Runner class with @afterclass and work as expected

@AfterClass public void setReportInfo() { ExtentService.getInstance()..setSystemInfo("App", APP_VERSION); ExtentService.getInstance().setSystemInfo("Device", BaseSetup.deviceName + " with " + BaseSetup.platformVersion); }

Thank you very much!

vzenzo avatar Apr 14 '20 16:04 vzenzo

@vzenzo The SKIPPED color has been corrected in all charts.

You have opened a new issue: https://github.com/extent-framework/extentreports-cucumber5-adapter/issues/1. Is this the same issue for cucumber4-adapter?

anshooarora avatar Apr 14 '20 18:04 anshooarora

@vzenzo The SKIPPED color has been corrected in all charts.

You have opened a new issue: extent-framework/extentreports-cucumber5-adapter#1. Is this the same issue for cucumber4-adapter?

The skip steps are with orange color but on circle they are blue

cucumber4 adapter does not show hooks anymore, since 1.0.11

Edit: I have tried now with 1.0.12 and it shows some hooks

image

vzenzo avatar Apr 20 '20 15:04 vzenzo

Back to this issue, when I put @AfterClass it does nothing, I have also tried with @AfterTest and @AftersSuite, none of them add SystemInfo, only way it works is if I put it into @After tear down method but then it repeats same info each scenario

image

vzenzo avatar Apr 20 '20 17:04 vzenzo

@vzenzo

I do not see any blue circles in the screenshot.

You can use this workaround to ensure the code inside this block executes only once: https://github.com/cucumber/cucumber-jvm/issues/515#issue-13874287

anshooarora avatar Apr 20 '20 22:04 anshooarora

@vzenzo

I do not see any blue circles in the screenshot.

Sorry didn't place screenshot for that

image

You can use this workaround to ensure the code inside this block executes only once: cucumber/cucumber-jvm#515 (comment)

What is the workaround here? There is so many things here I don't know where to start

vzenzo avatar Apr 21 '20 07:04 vzenzo

I've fixed the SystemInfo issue by putting it into @AfterClass in a test runner

vzenzo avatar Apr 21 '20 10:04 vzenzo

@anshooarora @vzenzo I had modified the code to take in system info details from the extent-config.xml. <systeminfo.os>Windows</systeminfo.os> <systeminfo.version>10</systeminfo.version> This ideally should be from the extent.properties. If you think this solution seems suitable I can create a pull request.

grasshopper7 avatar Apr 21 '20 12:04 grasshopper7

@anshooarora @vzenzo I had modified the code to take in system info details from the extent-config.xml. <systeminfo.os>Windows</systeminfo.os> <systeminfo.version>10</systeminfo.version> This ideally should be from the extent.properties. If you think this solution seems suitable I can create a pull request.

this would be great!

vzenzo avatar Apr 27 '20 15:04 vzenzo

@grasshopper7 but it will also remain the possibility to add it from ExtentService instance? Because I'm adding dynamic data in system info and by adding it from config file only I don't see how can it be done.

zuzeac avatar Apr 27 '20 15:04 zuzeac

@zuzeac It should not interfere with adding of system info from code. Though I will test it out to make sure.

grasshopper7 avatar Apr 27 '20 19:04 grasshopper7

@vzenzo @anshooarora How did you resolve this issue. I am facing the same issue. System info are appearing if I put them into @After hook and its repeating after every scenario. but it is not showing in report when I am putting them into @AfterClass

VishalKTechnocredits avatar May 03 '20 10:05 VishalKTechnocredits

@VishalKTechnocredits make sure @afterclass is in the runner class.

zuzeac avatar May 03 '20 12:05 zuzeac

I created a PR which allows the system info to be picked up from extent.properties and also when passed in the maven command. https://github.com/extent-framework/extentreports-cucumber4-adapter/pull/57

grasshopper7 avatar May 12 '20 10:05 grasshopper7

@grasshopper7 Thanks, I will check.

anshooarora avatar May 13 '20 05:05 anshooarora