extent-framework / extentreports-cucumber4-adapter

Cucumber4 Adapter for Extent Framework
http://extentreports.com/docs/versions/4/java/cucumber2.html
Apache License 2.0
39 stars 22 forks source link

How can I add SystemInfo to reports? #51

Open vzenzo opened 4 years ago

vzenzo commented 4 years ago

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)

anshooarora commented 4 years ago

@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 commented 4 years ago

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

ExtentService.getInstance().setSystemInfo(k, v);
vzenzo commented 4 years ago

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?

zuzeac commented 4 years ago

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); }

vzenzo commented 4 years ago

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!

anshooarora commented 4 years ago

@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?

vzenzo commented 4 years ago

@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 commented 4 years ago

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

anshooarora commented 4 years ago

@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

vzenzo commented 4 years ago

@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 commented 4 years ago

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

grasshopper7 commented 4 years ago

@anshooarora @vzenzo I had modified the code to take in system info details from the extent-config.xml. `Windows</systeminfo.os>

10` This ideally should be from the extent.properties. If you think this solution seems suitable I can create a pull request.
vzenzo commented 4 years ago

@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!

zuzeac commented 4 years ago

@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.

grasshopper7 commented 4 years ago

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

VishalKTechnocredits commented 4 years ago

@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

zuzeac commented 4 years ago

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

grasshopper7 commented 4 years ago

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

anshooarora commented 4 years ago

@grasshopper7 Thanks, I will check.