reportportal / agent-java-testNG

TestNG listener
Apache License 2.0
54 stars 20 forks source link

Report portal use with gradle showing the results as in progress #32

Closed automationhacks closed 5 years ago

automationhacks commented 5 years ago

I am trying to evaluate report portal for use in a simple java project using TestNG and Gradle as build tool. Since i did not find any specific instructions for the same in this repo, I tried playing around with different settings.

Here is my build.gradle file:

When i use this settings below then, I do not see any results being pushed out to report portal.

apply plugin: 'java'
apply plugin: 'maven'

group = 'com.automation-hacks'
version = '1.0-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
     maven { url "http://dl.bintray.com/epam/reportportal" }
     maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
    compile group: 'com.epam.reportportal', name: 'agent-java-testng', version:'3.0.1'
//    compile group: 'com.epam.reportportal', name: 'logger-java-log4j', version:'3.0.1'
    testCompile group: 'org.testng', name: 'testng', version: '6.14.3'
}

test {
    systemProperty 'usedefaultlisteners', false
    systemProperty 'listener', 'com.epam.reportportal.testng.ReportPortalTestNGListener'
    include '**/*Test.class'
}

task smokeTests(type: Test) {
    useTestNG() {
        suites 'src/test/resources/suite.xml'
        includeGroups 'smoke'
    }
}

Thus i tried another approach of annotating my test class with @Listeners({ReportPortalTestNGListener.class}) and i saw an entry being pushed out, however i do not see the pass/fail results and it continuously displays it as in progress.

I am attaching a zip file (rptest.zip) with my entire sample project. If you can provide pointers on A) How to configure the maven-surefire plugin with the listener in gradle? B) If above does not work, How to get the annotation in Test File working, it would be great

I think Report portal is solving a very common use case for automation engineers and i really want to start using this in my current company.

image image

filland commented 5 years ago

@gaurav-singh Hello. Sorry for answering you so late.

Using @ Listeners({ReportPortalTestNGListener.class}) on test class

I managed to fix your problem by changing the version of testng agent to 4.2.1 (it is the latest version): compile 'com.epam.reportportal:agent-java-testng:4.2.1'

Using .xml runner

But it works well with .xml runner as well (do not forget to comment @ Listeners({ReportPortalTestNGListener.class}) annotation). That is how the .xml runner should look like:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >