2

I am having below configuration,

  1. Maven project
  2. Execute test case through testng.xml
  3. External code to write report

Here I have write code to generate reports. It depends on complete all test cases and even after @AfterSuite .

So is there any way to run that code after completing all test cases or generate test-output folder before complete all the code?

Example :

@AfterSuite
public static void tearDown()
{
    try
    {
        driver.quit();
        driver = null;

        //report code, I want this code run after completing aftersuite
        // or generate test-output folder before completing aftersuite
    }
    catch (Exception e)
    {
        //code for error
    }
}
5
  • Why not just add a report generation step in Maven?
    – ernie
    Dec 26, 2017 at 17:25
  • Which reporting tool r u using with Selenium?
    – Bharat Mane
    Dec 26, 2017 at 17:59
  • Could you please add the code which you HV written for reporting purpose..
    – Bharat Mane
    Dec 26, 2017 at 18:00
  • @ernie Can you please tell the steps in maven ? One small example is enough.
    – Sagar007
    Dec 27, 2017 at 3:05
  • @BharatMane Yes. I am generating report from this link. automationtesting.in/…
    – Sagar007
    Dec 27, 2017 at 3:07

1 Answer 1

1

Annotations transformers is your answer. You can intercept and change any annotation behaviour. http://testng.org/doc/documentation-main.html#annotationtransformers

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.