anshooarora / extentreports-java

Community version of Extent API for Java has moved to https://github.com/extent-framework/
http://extentreports.com
Other
528 stars 318 forks source link

How to run parallel tests using TestNG Listener with Extent Report? #882

Closed ArmandsBruns closed 7 years ago

ArmandsBruns commented 7 years ago

I'm using Selenium Java and 2.41.2 of extent Report with TestNG Framework

Is there a good description link about it or examples?

I created two classes: ExtentManager and ExtentTestManager.

anshooarora commented 7 years ago

Please see http://extentreports.com/docs/versions/2/java/ for documentation and examples.

Also, I would recommend using version 3.0 as you are starting off as its what's being regularly maintained. Version 3 docs: http://extentreports.com/docs/versions/3/java/

VasaviUppada commented 7 years ago

Hi, I need help on the same... When I'm running my scripts in a sequence I can able to run successfully & Im getting results too. When I'm running the same tests/methods/classes in parallel, all my Extent reports are getting messed up (one test logs are mixed into another test logs) and failing.

For my tests, Im using Selenium with TestNG, Maven & Im running my tests in Saucelabs.

Please help me on this

harsh976 commented 7 years ago

@vasaviUppada Are yout you any listner of testng? If yes then please share the code. And also are you doing paralle tests or methods or classes

VasaviUppada commented 7 years ago

Hi Anush,

I tried in multiple ways to run in parallel (methods, tests, classes) when ever I ran in parallel, all reports are messing up & if I remove parallel, it is working fine. Can you please provide me your personal mail id ... so that I can share my code with you. It will be more clearer for you to understand

On Wed, Sep 6, 2017 at 9:43 PM, harsh976 notifications@github.com wrote:

@VasaviUppada https://github.com/vasaviuppada Are yout you any listner of testng? If yes then please share the code. And also are you doing paralle tests or methods or classes

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/anshooarora/extentreports-java/issues/882#issuecomment-327683559, or mute the thread https://github.com/notifications/unsubscribe-auth/Ac2HZki42jKoUVq__iYBBwZQZGiaCxKKks5sf3R0gaJpZM4Nib60 .

harsh976 commented 7 years ago

harsh976@gmail.com

VasaviUppada commented 7 years ago

Thanks for sharing email.... Can we create separate thread for extentTest to run each test? Will it resolve my current issue ?

anshooarora commented 7 years ago

Please open a new ticket. Thank you.

manishbhalshankar commented 7 years ago

We are also running scripts sequentially as well as parallel and our report looks to be proper. Following the the way in which we generate the report:

  1. We have a TestNGListener setup which implements ITestListener, IReporter, ISuiteListener
  2. In Overridden method 'generateReport' we create an object of our Report class which initializes the ExtentReport and ExtentXReport and also has ExtentReports and ExtentTest fields.
  3. We than build the test nodes by passing the context passed, failed and skipped tests from suit-result-testcontext.

Hope I understood your issue properly and that these steps help you resolve the issue.