I am trying to generate HTML reports(Protractor Test) through Jenkins but it says
"ERROR: Specified HTML directory 'x/y/z/Reports' does not exist". but when i run on the slave reports were generated.
What do i need to do on the Jenkins Configuration, please help on this.
*Path is correct but it could not generate "Reports" folder on the slave.
I am using- "protractor-html-screenshot-reporter"
You need specify the path like "\x\y\z\Reports\", and make sure those folders is existing on your slave-machine
This is the solution:
Click on Workspace Button and navigate until the HTML report folder appears.
Copy the full path (Even though it looks like it's before the project):
Paste the full path as is in the Publish HTML report plugin:
Remember! Location path / configuration on Bash script field (even running: cd /././. etc.) Does not affect the rest of the configuration settings on the Jenkins page.
This is why a full path is needed.
Related
I am running a Jenkins job which generates png files, and html files.
Image files are stored in a specific directory, and html files in another directory.
Html files contain img tags which src attributes to the image files locations.
When I run the project on my Ubuntu machine, I can see the images in the html files. It looks like <img src='../screenshots/screenshotname.png'/>
However, when I run the same project on Jenkins, and then open the html file while browsing the Jenkins workspace, the img doesn't show. There's a "broken image" icon. If I change the src attribute using the inspector and put the absolute path of the image, the image doesn't show either.
But if I download the whole workspace and open the html file, the image shows well.
Do you have an idea of why this behavior occurs? Is it because of a Jenkins configuration?
Thank you very much.
I believe you are using some plugin like publish html to publish html report.
The reason is jenkins does not support any css by default. So you have to break the rule.
Manage Jenkins--Manage Nodes--Click settings(gear icon)--
click Script console on left and type in the following command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
Click run and once you run you will see Result below, it will empty space. Now go back to pipeline and build it. Now you will be able to view the reports as you want.
When I run my tests in my local machine, report file is always created/overwritten in: C:\Temp\myLocalFolder\target\site\serenity\index.html
But when I run my tests using Jenkins(localhost:8080), report file is Not being generated in: C:\Users\me\.jenkins\workspace\myJenkinsFolder\target\site\serenity
In Jenkins, I've already added the Thucydides plugin, added it in Post-Build Actions, and set Report Path to target/site/serenity. I tried copying the index.html from my local folder to the jenkins folder, and after running I can view the same report. However I want it to be overwritten by the latest run on Jenkins. Any ideas?
Apprarently I just had to set Report Path in Jenkins to the same directory as my local folder (C:\Temp\myLocalFolder\target\site\serenity\index.html). I'm not sure if that's the correct approach. It won't work if I run from my online github repository. I will try that one next.
I am new to jenkins and i want to add my test report with the email attachment.
I am using
Email-ext
plugin to send email. Email is sent successfully but the attached file is not sent.
My test report generates in eclipse porject workspace inside and path is
E:\eclipse_environment\workspace\smautomation_jenkin\assets\chromeTestReport\
how i can attache my test file with email using this plug-in?
I am using mac and my solution works for mac.But i think the concept will be same for all os.
Actually, jenkin attach file from its workspace automatically. For this no expression is not required. For example, in my mac, jenkins workspace is
/users/dev/.jenkins/workspace
and i keep a file here named
report.txt.
And in "attachment" of email-ext plugin, just write
report.txt
no need to write any other thing. jenkins will go to its workspace and check "report.txt" exist or not. if exist, it send it as attachement.
Now question about the jenkins workspace.
Actually jenkins has its own workspace. You may need another workspace. To check jenkins workspace, go like this:
jenkins > manage jenkins > configure system.
Now at top u will see
Home directory
and theres an
Advanced
option. Click on it and u will see
Workspace Root Directory: and its value is
${ITEM_ROOTDIR}/workspace
ITEM_ROOTDIR is where .jenkins exist. For me this is
/users/dev/.jenkins
Actually u can see this at the first line:
Home directory -- ur ITEM_ROOTDIR is shown in this line.
now go to ${ITEM_ROOTDIR}/ and u will see a folder name workspace.
Now if u keep any file in this workspace, jenkin will send this file as attachement. Obviously u have to mention it in email-ext plugin "attachment" section.
Now if u want to change ur workspace, change ur
Workspace Root Directory:
like this
${ITEM_ROOTDIR}/jobs/test/workspace
it depends on you.Change according to ur wish.
the most important thing is, if u change ur workspce from
jenkins > manage jenkins > configure system > Advanced option under Home directory
this will be ur default workspace.
If u want to make a specific workspace for only
one project
than u have to follow another procedure.
Just create a maven job (project). Than enter into the project,
//click on configure, now click on "Advanced" option under "Build"
//For free style project, this is in "Advanced project option"
There, u will see
Use custom workspace
check this option, and give ur needed workspace. For me i give like this:
/users/dev/workspace/test1/
and this is
the workspace only for this project.
Now u can send file from here as an attachement.
one most important thing is u must restart jenkins server
to set the new workspace to ur job.
Actually u can copy files into jenkins workspace from another directory using cp command in
Execute shell option.
Now just give the file name in attachement of email-ext plugin and jenkins will send this file as attachment with ur email.
cheers.........
This method worked for me, to include html file in jenkins workspace to a mail body.
jenkins -> configuration -> Editable Email Notification
Content Type : HTML(text/html)
Default Content: ${FILE,path="build/reports/tests/test/index.html"}
Don't start file path with "/"
I am running Robot Framework tests through Jenkins, and the tests use a custom Python library to take screenshots, save them into a specific folder (that is not the log folder), and embed them into the log. In the Jenkins job, I have a post-build action set to publish the Robot results, and I can get Jenkins to copy image files that are generated within the log folder, but I can't figure out how to copy image files that are generated outside the log folder.
The project's %WORKSPACE% is d:\git\product\registration
The directory of Robot output is \log\patient_search (the log directory is generated inside the registration directory)
The directory where the other images are generated is d:\git\product\registration\verify\images
If I put *.png into the "Other files to copy" box, Jenkins will copy any images within the log\patient_search directory and they embed correctly into the log. What I have in that box now is *.png,%WORKSPACE%\verify\images\**, and I have tried using backslashes instead, using a relative path (..\..\verify\images\**\*.png), and various combinations of asterisks and slashes. Those images always show as broken links in the log.
Are these paths wrong, or can this just not be done for files outside of the log folder?
I believe Robot Framework plugin "Other files to copy" works only inside "Directory of Robot output". A workaround would be to create a build step where you execute a shell and copy files to Robot output directory.
I have set up a jenkins build and everything is working fine except the very last step.
The whole build creates a directory called: build
This directory contains a web-inf and all the files in it I would like to publish via SCP to a different location, so that all the content of the build/web-inf folder will become the content of the target folder.
The settings for jenkins scp plugin are (it is a post-build step):
source: build/web-inf/**
destination: public_html/
that results in:
public_html/build/web-inf/...
but should be:
public_html/...
(the keep hierarchy box is ticked)
how can I make that happen??
EDIT
I could solve the problem without any additional script. The solution is so simple that my question turned out to be stupid.
All I did was telling ant to copy all the webfiles to ./public_html instead of ./build/web-inf/ what made the jenkins scp copy all files from public_html to public_html exactly as it was intended to.
If your goal is just to SCP files generated during the build, and the plugin doesn't seem to be working (I couldn't see anything wrong in your configuration) you can use an "Execute shell" build step and type the scp command something like (try it in a shell first in your job's build directory to get the syntax right):
scp -r build/web-inf/* user#host:/destination-directory