allure-results does not exists in Jenkins
Asked Answered
B

3

1

Allure results are generated (xmls) and can be viewed by running allure serve outside the allure-results directory but when configured in Jenkins using the allure results directory with relative path from Jenkins workspace, the allure results are not found. Presumably there is something wrong with the path

[allure_test] $ /Users/me/.jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.7.0/bin/allure generate -c -o /Users/me/.jenkins/workspace/allure_test/allure-report allure-results does not exists Report successfully generated to /Users/me/.jenkins/workspace/allure_test/allure-report Allure report was successfully generated.

Relative Path defined for allure report is
../../repos/partner-portal/target/allure-results

The report is generated but with no results

Banwell answered 5/11, 2018 at 10:52 Comment(0)
R
0

Here is the solution:
1. Inside your work space (For me it is D:\m\Automation Project\Tests), Create a folder named "target" containing two subfolders "allure-results" and "allure-reports".

  1. In Post Build Actions of Jenkins Project provide these entries.

Results: target/allure-results
Report Path: target/allure-reports

Post Build Actions Now run your tests and allure reports will be generated without any issues.

Referent answered 7/6, 2019 at 13:17 Comment(0)
R
0

I struggled for over 24 hours and could not sleep whole night just because of this issue. There were no clear instructions related to this and how it works. Finally, I figured it out.

May be its little too late for this answer but could you please create the "allure-results" folder in your workspace (like /Users/me/.jenkins/workspace/allure_test/allure-results)?

After I configure Allure report in jenkins, and using behave command, I finally see following output and saw the working report in my jenkins build plan:

.
.
.
.
D:\PythonProject\PythonBehave>behave -f allure_behave.formatter:AllureFormatter -o C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-results D:\PythonProject\PythonBehave\features 

Failing scenarios:
  features/example.feature:17  user can search text in google -- @2.2 Incorrect
  features/github_login.feature:13  User attempt to login with wrong username and password -- @1.1 InCorrect
  features/github_login.feature:14  User attempt to login with wrong username and password -- @1.2 InCorrect
  features/github_login.feature:18  User attempt to login with correct username and password

0 features passed, 2 failed, 0 skipped
3 scenarios passed, 4 failed, 0 skipped
12 steps passed, 4 failed, 8 skipped, 0 undefined
Took 3m24.651s

D:\PythonProject\PythonBehave>exit 1 
Build step 'Custom Python Builder' marked build as failure
[PythonAllure] $ C:\Users\Alex\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\Allure_2.13.1\bin\allure.bat generate C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-results -c -o C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-report
Report successfully generated to C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.
Finished: FAILURE

And before I used to get this output when there was no allure-results folder in my workspace:

[PythonAllure] $ C:\Users\Alex\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\Allure_2.13.1\bin\allure.bat generate -c -o C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-report
Remarque answered 3/1, 2020 at 10:39 Comment(0)
M
0

we are not using any post-build steps on UI but using jenkins pipeline groovy script as below:

def allureReportsGenerationTask() {
try {
allure([includeProperties: false, jdk: '', properties: [], reportBuildPolicy: 'ALWAYS', results: [[path: 'target/allure-results']]])
} catch(Exception error) {
println("Caught Exception: ${error}")
}
}

The project structure was like that only

 ProjectRepo
       - src
       - target
         -alure-results 
       - pom.xml 
       - testng.xml

In this case, we are getting the allure-results getting generated but it was not getting picked in the Jenkins pipeline allure plugin. ON UI below command was running always

/opt/jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/bin/allure generate -c -o /opt/jenkins/workspace/ProjectRepoPipeline/allure-report

you can see Jenkins was not able to find allure-results for generating parameters in the above Jenkins pipeline command

We added the below parameter in pom.xml maven-surefire-plugin

   <systemPropertyVariables>
    <allure.results.directory>../target/allure-results</allure.results.directory>
     </systemPropertyVariables>

Now project structure becomes

-ProjectRepo - src - pom.xml - testng.xml

  • target -allure-results

Now on running the same via pipeline script, we were able to run the below command

/opt/jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/bin/allure generate /opt/jenkins/workspace/ProjectRepoPipeline/target/allure-results -c -o /opt/jenkins/workspace/ProjectRepoPipeline/allure-report

ProjectRepoPipeline - This is the Jenkins pipeline name that is running CI/CD

Marketplace answered 15/2, 2022 at 9:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.