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

I'm seeing the test case execution twice though i ran only once. #140

Closed NVSateesh closed 9 years ago

NVSateesh commented 9 years ago

I'm seeing the test case execution twice though i ran only once.Using 2.10 Extent jar. i ran the case only once but report showing twice. --Attached two screenshots in 1st screen shot test-1(Verify pull to refresh test case) it is started 2015-10-31 01:22:18 and ended at 2015-10-31 01:22:18 -- in 2nd screenshot the test-2 (Verify pull to refresh test case) it is started 2015-10-31 01:22:18 and ended at 2015-10-31 01:22:18 [unable to add .java file so pasting the code at the end.]

--> How to use the EXTENT MERGE and what is the difference between EXTENT and EXTENT MERGE. --> How to use the DB of Extent to show the No.Of Runs in EXTENT MERGE Menu(Sample Screens provided for the same in the site.) --> Can we get the same reports if i configured in Jenkins.[using maven project]

screen shot 2015-10-31 at 1 34 34 am screen shot 2015-10-31 at 1 34 44 am

package JenkinsPackage;

import java.io.IOException;

import org.testng.ITestResult; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test;

import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.LogStatus;

public class Case extends Driver { //
// @Test(priority=3) // public void cleanlaunch() throws Exception{ //
// ExtentReports reporter = Driver.getInstance(); // logger = reporter.startTest("Verify clean launch test case"); //
// SmokeTest_c334143_CleanLaunch p =new SmokeTest_c334143_CleanLaunch(); // p.verify_adcals_onclean_launch(); // }

@Test(priority=2)
public void pulltorefresh() throws Exception{

    ExtentReports reporter = Driver.getInstance();
    logger = reporter.startTest("Verify pull to refresh test case");

    c334150_Verify_onpulltorefresh p3 =new c334150_Verify_onpulltorefresh();
    p3.Verify_PulltoRefresh();

}

// @Test(priority=1) // public void FirstRun() throws Exception{ //
// ExtentReports reporter = Driver.getInstance(); // logger = reporter.startTest("Handling the alerts on app if any"); //
// firstRun p1 =new firstRun(); // p1.first_Run(); //
// } @BeforeTest public void beforeTest() throws Exception { Capabilities cap = new Capabilities(); cap.dcap();

    DeleteFile DF = new DeleteFile();
    File_Exist FE = new File_Exist();

    if (FE.fileexist()) {
        DF.deleteFile();

    } else {
        System.out.println("File not exist");
    }

}

@AfterMethod
public void test(ITestResult result) {

    if (ITestResult.SUCCESS == result.getStatus()) {

        logger.log(LogStatus.PASS,"This test case is successfully done");

    }

    if (ITestResult.FAILURE == result.getStatus()) {

        logger.log(LogStatus.FAIL,"Test Failed after the above step");

    }

    if (ITestResult.SKIP == result.getStatus()) {

        logger.log(LogStatus.SKIP,"This test case is skipped");

    }

    reporter.endTest(logger);
    reporter.flush();

}

@AfterSuite
public void movefiles() throws IOException {

    // logger.log(LogStatus.INFO,"Moving Image and CSS Files");

    reporter.endTest(logger);
    reporter.flush();
    //reporter.close();

}

}

anshooarora commented 9 years ago

You are calling endTest in both afterMethod and afterSuite.

anshooarora commented 9 years ago

Please open one ticket for one issue/question only.

NVSateesh commented 9 years ago

Yeah thanks, i found it and removed after struggling of 1hr searching for that mistake.

thanks, sateesh n.v

On Tue, Nov 3, 2015 at 4:04 AM, Anshoo Arora notifications@github.com wrote:

You are calling endTest in both afterMethod and afterSuite.

— Reply to this email directly or view it on GitHub https://github.com/anshooarora/extentreports/issues/140#issuecomment-153179303 .

Thanks, Sateesh N Venkata. Ph No:8341990417

anshooarora commented 9 years ago

Thanks for the update. Closing issue as issue resolved.