0

I am trying to run a Cucumber Selenium project which is written in Java and use Test NG to run the Suite.

Now, in the @AfterSuite Method, im trying to popup the Extent Html and pdf report both automatically, when the Test Suite ends. Problem is that

@AfterSuite(alwaysRun = true)
    public static void endSuite() {
        String timeStamp = new SimpleDateFormat("MM-dd-yyyy HH.mm.ss").format(new Date());
        String filePath = "reports\\Report_" + timeStamp + "\\HTMLReport\\SmokeTestResult.html";
        try {
            Desktop.getDesktop().open(new File(filePath));

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

java.lang.IllegalArgumentException: The file: reports\Report_09-04-2021 22.02.42\HTMLReport\SmokeTestResults.html doesn't exist.

Now, i want the current report to run after every test execution, even if all scenario's are failed. I want the timestamp to be in 12 hour format, and for the User system's local time zone? How can i achieve this?

enter image description here

Extent.properties file enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.