empty extentX report

949 Views Asked by At

extentX looks like the perfect solution, a collection of test results.

However, I have followed all the instructions and got everything up and running but it seems the test information does not seem to be getting to the extent page.

It's empty. I can see from the dashboard tests have run but the project is Default and clicking into them shows no information, but I can see it's getting some data as it shows how many tests have been run and how much info has been passed.

Is there something obvious I am doing wrong?

I can see the standard extent report works perfectly, but it does seem to be passed up to the extentX server.

I am running everything locally for the moment as its a proof of concept.

I am using version 3.0.1 of extentreports

any help getting this working will be appreciated, also if anyone knows any alternatives for displaying multiple test reports on a single hub that would be great


Using the following page - https://github.com/anshooarora/extentreports-java/issues/652#issuecomment-254078018

I managed to get a little bit further but now I am getting the following error

java.lang.ExceptionInInitializerError at the following line

ExtentTest parent = ExtentTestManager.createTest(testName);

Here is my TestNG Base

public class TestBase {

private String uri;
protected Logger APPLICATION_LOGS = LoggerFactory.getLogger(getClass());
private static ExtentReports extent;
private ThreadLocal<ExtentTest> parentTest;
private ThreadLocal<ExtentTest> test;
public static ExtentTest childTest;

protected String getUri() {
    return uri;
}

@BeforeSuite
@Parameters({"env"})
public void initialiseReport(String env) {

    ExtentXReporter extentxReporter = new ExtentXReporter("localhost:27017");
    ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(("user.dir") + "/target/ExtentReports.html");


    extentxReporter.config().setServerUrl("localhost:1337");
    extent = new ExtentReports();
    extent.attachReporter(htmlReporter, extentxReporter);
}

@BeforeClass
@Parameters({"protocol", "env", "server", "port", "endPoint", "testName"})
public void initialiseURI(String protocol, String env, String server, String port, String endPoint, String testName) {
    uri = protocol + env + "." + server + ".mcom:" + port + "/" + endPoint;
    APPLICATION_LOGS.debug("Will use the following URI: " + uri);

    baseURI = uri;
    given().when().post().then().statusCode(200);

    ExtentTest parent = ExtentTestManager.createTest(testName);
    parentTest.set(parent);

}

@BeforeMethod
public final void beforeMethod(Method method) {

    childTest = parentTest.get().createNode(method.getName());
    test.set(childTest);

}

@AfterMethod
public void afterMethod(ITestResult result) {
    switch (result.getStatus()) {
        case ITestResult.FAILURE:
            childTest.fail(result.getThrowable());
            break;
        case ITestResult.SKIP:
            childTest.skip(result.getThrowable());
            break;
        case ITestResult.SUCCESS:
            childTest.pass("Passed");
            break;
        default:
            break;
    }
}

@AfterSuite
public void completeReport() {

    ExtentManager.getExtent().flush();
}

}


Managed to get it working using this git project

https://github.com/saikrishna321/extent_reports

But my extentX page is still empty, its showing how many tests have run but no report is being attached.

1

There are 1 best solutions below

0
On BEST ANSWER

Turns out i was using the wrong extentX distrubution.

When downloading the zip from the wbesite - https://drive.google.com/open?id=0ByJmgAhaLx0GcmVYNkhBSThUcG8

It worked