publish selenium reports from jenkins - selenium

I run selenium scripts through maven.Please let me know how to publish selenium reports under post build actions in jenkins.I tried several options
Publish selenium report
publish selenium html report
publish HTML report
publish test ng reports
I tried giving full path from C drive where the surefire reports exist
C:\proj1\target\surefire-reports*.html
it says file *.html doesn't exist
and for html report-it says no report exist
tried giving workspace relative path as well but it provides empty report
In test results folder in excel sheet,I get the report the status of each testcase.But its not published in jenkins.
Could anyone please send me the exact tried out steps to publish reports from jenkins.

Publushing report with the publishHTML reports works with the repository. You should not type the file path
For example, I have on my projects the following as the endpoint for reports.
WebContent/build/Selenium/resultsTests/
Where of course resultsTests is my directory where I publish my reports.
Here is a screenshot of my config

You need to create a folder inside your job/workspace folder.
Example my job folder is C:\Program Files (x86)\Jenkins\jobs\Yahoo\workspace.
I created a folder named results
C:\Program Files (x86)\Jenkins\jobs\Yahoo\workspace\results.
I set Test Report HTMLs as results/.
You can check on the link right below the folder field:
Basedir of the fileset is the workspace root. <--- "The workspace root" is a link to your workspace so you can see your new folder there.

Follow below steps:
install html publisher plugin in your jenkins and restart post done
from your framework copy the path of the folder where reports are getting saved.
Example my path is : D:\workspace\rule\CurrentTestResult
In your Jenkins job, navigate to Post -build actions
In section "HTML directory to archive" give above path
Example : "D:\workspace\rule\CurrentTestResult"
And in index page[s], mention your file name, Or simply add "*.html"
In report title give any desired name
Apply and check

Related

Testcafe - How to set relative instead of absolute screenshot path in reports

I'm using spec and xunit reports. My .testcaferc.json is:
{
"screenshotPath": "artifacts/screenshots",
"takeScreenshotsOnFails": true,
"screenshotPathPattern": "${DATE}_${TIME}/${USERAGENT}/test-${TEST_INDEX}.png"
}
When the test failed in the spec and xunit reports shows the link to the screenshot, but that link has an absolute path. That is ok when I run tests locally. When running in Jenkins CI/CD the publish xunit report can't find the screenshot using absolute path due to using a relative path from "workspace" folder. Is there any way to config Testcafe to put the relative path into testRunInto.screenshotPath. I need a relative path to screenshots for any report providers.
Upd: I'm using a Jenkins Agent server to run test. The absolute path to workspace in this case: /home/jenkins/workspace/e2e. Screenshoots located in relative path: artifacts/screenshots or absolute path /home/jenkins/workspace/e2e/artifacts/screenshots. In xunit report (or any other) we got an absolute path for the screenshots. When all test finished Jenkins Agent push the whole workspace to the Master Jenkins server and absolute path to workspace became: /home/jenkins/job/test/ws/e2e and path to the screenshots: /home/jenkins/job/test/ws/e2e/artifacts/screenshots. Then Jenkins post-build action publish "Junit test result report". But inside that report we have the absolute path to the screenshot came from Jenkins Agent Server. As a result Master Jenkins unable to find the screenshot when shows the test result report.
Previously I used to use Selenium and Maven or Gradle to run the test and there was a relative path to the screenshots.
At present, TestCafe does not have an option to use relative paths in reports. I've created a suggestion in the TestCafe repository for your case - https://github.com/DevExpress/testcafe/issues/3497. If this feature is important for you, then you can try to implement it yourself.
It is not difficult. You need to do following: add a new option (see an example here) and change the path resolving mechanism depending this option (see an example here).

Is there a way to inspect build dir xml-data from bamboo ui

Is there a URL path that bamboo UI exposes which allows you see browser the contents of the build dir ?
All I can see is the url to logs but nothing for the build dir.
Not directly.
You can configure the directory as a job artifact, then it will show up in the UI in the artifacts tab. In this case the URL would be http://myserver/bamboo/browse/MYBUILD/latest/artifact
Alternatively, you can run ls from within your build and see the contents in the build log. If not already so, you can add a script task to your job for the purpose.

Show HTML artifacts in bamboo without downloading

I've successfully created a small demo HTML report of test results from a build. Simply put, I'm doing numerical computations, and would like to give more detailed information on test results than a binary pass/fail. The HTML report consists of multiple HTML files with relative links between them.
However, linking to one file from the other sometimes leads to the file being opened in the browser, and sometimes a "download file" dialog opens. Any ideas what the rules are, so I can look at the whole report in-browser without resorting to downloading a zip file of the whole report, unzipping, etc etc?
Just a quick note here, if anyone should need it - as this was where I ended up in my search.
After upgrading our Bamboo to 6.8.1 build 60805 our code coverage artifacts started downloading, instead of being displayed inline.
This can be fixed by setting the Security and permission setting Allow artifacts to be embedded in Bamboo pages.
Be aware of the note about Cross-Site-Scripting vulnerabilities if enabled.
On our project we use this simple solution
1.In Stage configure final task script to copy reports to some folder:
echo "Copy artifact report"
rm -rf ../artifacts
mkdir ../artifacts
cp -r functionalTests/build/html/behat/* ../artifacts/
2.On Artifacts tab edit artifact definition and set Copy pattern to artifacts/**
Then when you navigate to build artifact then folder with reports will be opened in browser
To have an embedded html page in bamboo showing the coverage results, this page has partially helped me to make bamboo cooperate with python coverage:
Troubleshooting
The Clover tab shows the directory listing instead of the HTML report
Please check which artifact handler you use. The Amazon S3 Artifact
Handler serves files on a one-by-one basis, instead of exposing all
files as a static website. To change this, open Configure plan and on
the Miscellaneous tab select the Use custom artifact handler settings
check-box. Then select Server-Local Artifact Handler for shared and
non-shared artifacts and finally re-run the build.
In my setup though "Server-Local Artifact Handler" failed completely, but choosing "Bamboo remote handler" did the job.

How to have Bamboo artifacts collect a whole folders?

I have one simple plan with one simple job.
Tasks:
Source code checkout
MSBuild
Run tests
Generate test report
In four steps, my utility generates a test report with screenshots. The report contain absolute links to images. (for example: onclick="window.open('./Screenshots/66ef3a03-8b82-4b40-b49d-b0155e273738.png');return false;").
If I open the report on my local machine, the report works fine, but on Bamboo I receive the error "Page Not Found", because Bamboo has not collected "Screenshots" folder.
How can I set up the Artifact Definition to collect folder with files?
P.S. I tried to set the \*.* copy pattern, but Bamboo collected only files (without folders and subfolders)
You just have to give the folder Location, like "build/", for instance, and then, in the Copy Pattern you can put **/*.* That should copy all the files you want.
Please note that:
The location is relative to the build directory. Do not use the absolute path to refer to the location.
Asterisks are not supported for Location. For this field, provide the folder name where the file would be located.
Plus, you can define as many Artifact Definitions as you want.
The best way of doing this is to zip all you artifact together. I created a bash script to do this
cd "toArtifactFolder"
zip -r Artifact .
Then in bamboo project settings you have to edit the Artifact and changed the location to where ever the artifact zip file is
Then in the Copy Pattern just enter the zip file eg Artifact.zip
Bamboo uses the "Ant file copy pattern".
Matching recursively against all files: **/*
This does include almost everything
Unfortunately this does not include dot-files, at least in my test on a linux build agent. I could not find a workaround apart from a second artifact (pattern **/.*) or the creation of an archive.
Matching against all files in any subfolder: */*
This does not include foo/bar/test.xyz
This does include both foo/test.xyz and bar/test.xyz
You can do more advanced matching; e.g. you can use build/**/*.jar to copy all jars from a build directory.
For further info see the docs

How to generate load testing reports using jmeter?

I have performed a load test using JMETER.
But now not able to generate reports for the test.
To generate report I have followed these steps:
Create a new variable JAVA_HOME in the environment variable and set the path for the JDK.
Create another variable ANT_HOME and set the path for the Apache-ant.
Create another variable PATH and set the path for apache-ant up to BIN folder.
Place the ant-jmeter-1.0.9.jar file in side ‘Extras’ folder. Which is located in the path jakarta-jmeter-2.3.2->extras
Navigate to the ‘build.xml’ folder of the jmeter which is located in the path jakarta-jmeter-2.3.2->extras->build.xml.
Set the classpathref = “D:\loadtest\jakarta-jmeter-2.4\extras\ant-jmeter-1.0.9.jar “
Set jmeterhome=”D:\loadtest\jakarta-jmeter-2.4″
Set style=”D:\loadtest\jakarta-jmeter-2.4\jmeter-results-detail-report${style_version}.xsl” and save it.
Now copy jmx file and the build.xml file put it in a folder (Loadtest) where ever you want to generate the report.
Open command prompt and navigate to the folder where jmx and build file is located.
To run a test and create the output report:
Type the command “ant -Dtest=script”(for eg. I have my test.jms file and the command is ant -Dtest=test)
By following above steps Reports are not generated but I got following error:
BUILD FAILED
D:\Loadtest\result\build.xml:85: Reference D:/Loadtest/jakarta-jmeter-2.4/
extras/ant-jmeter.jar not found.
Can you help me find the solution?
Check jMeter version. The error says you're using 2.4, but your Jmeter home points to 2.3.2.
Did you include ant-jmeter-1.1.1.jar in your Ant classpath ? Adding the jar to $ANT_HOME/lib will make this happen automatically.
See:
http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php
ant-jmeter-1.1.1.jar is in jmeter/extras folder.
Furthermore I suggest you upgrade to last JMeter 2.7 version as it contains enhancements of the report.
Regards
Philippe M.
http://www.ubik-ingenierie.com/-Solutions-