Xray-App / xray-testng-extensions

Enhanced TestNG integration with Xray Test Management for Jira
MIT License
9 stars 5 forks source link

Unable to see the Xray attributes in `tesng-results.xml` file. #9

Closed pothurajtharun closed 7 months ago

pothurajtharun commented 8 months ago

Test Configuration:

I followed the README document for maven project and added all the necessary details as mentioned.

  1. Added the following dependency in the pom.xml file.
        <dependency>
          <groupId>app.getxray</groupId>
          <artifactId>xray-testng-extensions</artifactId>
          <version>0.2.0-beta</version>
          <scope>test</scope>
        </dependency>
  2. I added the listener to the class level as follows.
    @Listeners({ app.getxray.xray.testng.listeners.XrayListener.class })
    public class BaseSuiteTest {
  3. I configured the maven sure fire as follows.
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin}</version>
        <configuration>
          <testFailureIgnore>true</testFailureIgnore>
          <suiteXmlFiles>
            <suiteXmlFile>src/main/resources/xyz/configs/mobile/testng_ios_regression.xml</suiteXmlFile>
          </suiteXmlFiles>
          <properties>
            <property>
              <name>reporter</name>
              <value>org.testng.reporters.XMLReporter:generateTestResultAttributes=true,generateGroupsAttribute=true</value>
            </property>
          </properties>
        </configuration>
    </plugin>
  4. I used @XrayTest(key = "XRY-6") to report the results to existing test cases in Jira Cloud.

With the above configurations i ran the tests in my framework but testng-results.xml file does not contain any Xray attributes.

I followed this tutorial as well https://github.com/Xray-App/tutorial-java-testng-selenium but still no luck. Attaching the XML file in a compressed format for the reference.

testng-results.xml.zip

Please let me know if I'm missing anything here or the project README is not updated since it was updated last year though.

Thanks!

bitcoder commented 8 months ago

Hi @pothurajtharun ,

1) weren't you able to generate the testng xml of the https://github.com/Xray-App/tutorial-java-testng-selenium ? In that case, what do you get on the xml file? Have you tried running the tutorial using docker?

docker build . -t tutorial_java_testng_selenium
docker run --rm -v $(pwd)/reports:/source/target -t tutorial_java_testng_selenium

2) your configuration looks fine, at first sight. I tried the tutorial using the same testng 7.8 version.. can you try setting up the listener using a config file src/test/resources/META-INF/services/org.testng.ITestNGListener having the content:

app.getxray.xray.testng.listeners.XrayListener
bitcoder commented 7 months ago

@pothurajtharun have you seen my previous feedback? were you able to solve it?

pothurajtharun commented 7 months ago

Hi @bitcoder ,

Sorry for late reply. Quite long i didn't check my personal email.

Yeah i solved it. The problem for not generating the custom attributes is that i run test suites as a java program with java -jar automation-with-jar-dependencies.jar command.

Then I changed my framework to run the test suites through mvn clean test command and the custom attributes are generating successfully.

Thanks