allure-framework / allure-java

Allure integrations for Java test frameworks
Apache License 2.0
357 stars 226 forks source link

Test body is missed in report if run test via "java org.testng.TestNG suite.xml" #301

Closed shynkevichalex closed 2 years ago

shynkevichalex commented 5 years ago

Pom.xml configured via documentation https://docs.qameta.io/allure/#_maven_3. When I run test via "mvn test" all works fine.

But I would build jar of test project then extract it on slaves and run tests via command "java org.testng.TestNG suite.xml"

Current result

Test report generates but test body is missed. image

Is there any solution to display test body when test run in this way?

LisaHoney commented 5 years ago

I have the same question,Have you found the solution?

ucdevinda123 commented 5 years ago

Currently I am facing the same issue. I have asked the same question on stack-overflow. https://stackoverflow.com/questions/57566093/allure-test-ng-report-testbody-is-missing @baev do you know any fix for this desperately looking for it. :-)

ucdevinda123 commented 5 years ago

@LisaHoney @shynkevichalex did you find any solutions for this :-)

KroganUrdnot commented 5 years ago

Guys, please update if any solution or workaround found

ucdevinda123 commented 5 years ago

@KroArtem Yeah same here desperately waiting for a workaround or solution.

ucdevinda123 commented 5 years ago

@baev Any update on this issue?

ss-04 commented 5 years ago

@baev - Any update on this issue?

adamchenwei commented 5 years ago

Observe same issue when in jest-allure. any fixes???

ucdevinda123 commented 5 years ago

@baev can you reply please?

baev commented 5 years ago

You need to add AspectJWeaver javaagent to your command:

java -javaagent:aspectjweaver.jar -jar tests.jar org.testng.TestNG suite.xml

ss-04 commented 5 years ago

AspectJWeaver agent is added as below

javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar "

Should we mention suite.xml as well?

Attaching pom.xml for reference Allure2POM.txt

Screen Shot 2019-09-18 at 10 53 12 AM
ss-04 commented 5 years ago

@baev - Any updates on the issue?

ss-04 commented 5 years ago

@baev - Any updates on the issue?

pokeahontas commented 5 years ago

@baev I have almost the same issue and reported it here https://github.com/allure-framework/allure-java/issues/398 . Please help us fix this

gsai0205 commented 4 years ago

@baev Any update on this issue? Do we have any workaround?

shalevoren commented 4 years ago

@baev Any update on this issue? i have same problem

mohitrathi92 commented 4 years ago

any updates?

biletsky commented 3 years ago

any updates?

anna-shchurok commented 3 years ago

Was having the same issue, after hours and days of debugging found the solution that works for me.

Added aop.xml into resources/META-INF folder (if these is no such folder - create one)

The content of such xml should be:

<aspectj>
    <weaver> <!--<weaver options="-verbose -showWeaveInfo">-->
        <include within="io.qameta.allure..*"/>
        <include within="org.testng..*"/>
        <include within="com.changethispath.testautomation..*"/>
    </weaver>
</aspectj>

After that Test body with steps and screenshots are visible again.

biletsky commented 3 years ago

@galkina-anna <include within="com.changethispath.testautomation..*"/> Which path is it?

anna-shchurok commented 3 years ago

@galkina-anna <include within="com.changethispath.testautomation..*"/> Which path is it?

path to tests package

VladShapeshifter commented 3 years ago

Try to use earlier version of aspectjweaver, e.g. 1.9.0

Sergiy1987 commented 3 years ago

@galkina-anna this aol.xml file should be added for test resources or for the main part of a project?

And a path for tests should be like src/test/resources/features?

Now I can't resolve this problem with your fix. Can you explain how do you solve this problem for your project? Thank you.

Allure Report

mohammedghouse36 commented 3 years ago

Could someone please given valid solution. I too facing this issue.

anna-shchurok commented 2 years ago

@Sergiy1987 sorry for slight delay in reply.

file should be added for test resources or for the main part of a project?

it should be in both places. Same file, same folder

And a path for tests should be like src/test/resources/features?

for me it was path to parent folder which contains page objects or test classes. As far as I understand just the path where allure need to search mentioning of itself

Can you explain how do you solve this problem for your project?

Basically the root cause of it this issue was third-party jar that also was using allure, so some collisions appeared. When I added those 2 files with direct mentioning where allure should search - it worked out for me.

jacksonwen001 commented 2 years ago

Is anybody have another workaround? I met the same issue.

jacksonwen001 commented 2 years ago

It would be fine if you use the gradle to generate allure report.

Tal-Raanan commented 2 years ago

Hi all, I'm using IntelliJ (TestNG + Maven). ### I found an easy solution for this issue: apparently running xml suites directly via the IntelliJ would not work fine, as described in this topic. My solution is:

  1. Download a compatible Maven version from [https://maven.apache.org/download.cgi]
  2. Extract the files (remember the path)
  3. Edit System Environment Variables: Add 2 System variables: 'M2_HOME' and 'MAVEN_HOME' - provide the relevant Maven installation library path - NOT including the bin file (e.g. C:\Automation\Maven\apache-maven-3.8.5-bin\apache-maven-3.8.5)
    Add 2 Paths: %M2_HOME%\bin and %MAVEN_HOME%\bin
  4. Restart windows
  5. Open cmd and verify the implementation by inserting 'mvn' and observing data (errors are fine at this moment, system should recognize the command 'mvn')
  6. Open IntelliJ's terminal and insert the next command: 'mvn test -Pweb' (P=profile - as configured in pom.xml, web=profile name - change it due to your configuration).
  7. After execution browse to allure report and observe results - Test body (and a screenshot, if implemented) should be appeared

Attached is an example for pom.xml profile: `

web org.apache.maven.plugins maven-surefire-plugin 2.22.1 TestNGWeb.xml -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</profiles>`
Fulcrum81 commented 2 years ago

I've been having this issue with allure-testng v.2.17.0 and TestNG v.7.5.0

The only thing that helped me was downgrading TestNG to 7.4.0 after which the test bodies started showing as they should.

So try playing around with allure-testng and testng versions to find the compatible combination

david-m-globant commented 2 years ago

i solved this issue using code of this question

`

true
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.11.2</version>
            <configuration>
                <reportDirectory>${basedir}\target\allure-report</reportDirectory>
            </configuration>
        </plugin>
    </plugins>
</reporting>`