Xray for Jira Jenkins NUnit test results import task - jenkins

Hi my Import job with Jenkins is failing with below error . I'm trying to import .xml from Slave machine. I can able to see .xml file in slave location but still getting the error for file not found . when we run the test from Master then it can able to search the xml . so can anyone help with this ?
ERROR: File path is a directory or the file doesn't exist
ERROR: Step ‘Xray: Results Import Task’ aborted due to exception:
java.io.IOException: java.io.IOException: File path is a directory or the
file doesn't exist
at
Looks like it is not able to findthe xml file. when i try to import same file using Curl command it is working . can any one help to solve it ?
I'm converting my Nunit xml to nunit2 for my HTML reporting . I tried to import nunit 2 converted xml manually and works fine but from Jenkins keep on getting error .

If you are able to add plugins to your Jenkins server, there is a plugin specifically to do this, but you won't find it on the Jenkins plugin manager, follow the steps here to install and configure;
Xray for JIRA Jenkins Plugin
In short;
Download this xray-for-jira-connector.hpi
Go to the Update Center of Jenkins ("Manage Jenkins" > "Manage Plugins")
Select the advanced tab
On the Upload Plugin section, click upload and select the file xray-for-jira-connector.hpi file.
Next you need to add your JIRA server configuration to Jenkins (Manage Jenkins > Configure System > Xray for JIRA configuration).
Once you have done the above, you should now be able to add a build step that can export Cucumber feature files from any Cucumber tests you have set up within Xray, and, a post-build action for importing test results files including an NUnit XML file.
All of the info here is described in more detail in the first link i provided, as well as additional information on how to setup the build step and post build action. Hope this helps.

Related

Build step 'Execute shell' marked build as failure The project should have the name

I am new to working with Jenkins and faced the following problem: I need to add a Java project to SVN-repository, then this project is automatically loaded into the jenkins account to which I was given access.
Jenkins is hosted on the remote server and I can't change any configuration there but only run builds and so on.
After I add a project to the repository, it appears in Jenkins with "failed" status.
The console output is as follows:
Project structure in SVN-repository:
In Jenkins has structure:
Tell me, please, what could be the problem and how can I fix it.
The problem is:
+ /var/lib/jenkins/scripts/jtl/checkProjectName.sh Practice1
The project should have the name Practice1
Currently you're checking out in workspace directory. Try to checkout your repository from workspace/Practice1 directory.

Jenkins TestNG plugin does not fetch results from the test-results.xml file

In my project workspace, the test-results.xml file exists inside the target\surefire-reports\testng-results.xml directory. But Jenkins fails to read the XML file and gives below error on console.
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **\target\surefire-reports\testng-results.xml
Did not find any matching files.
To ensure the file isn't too old, I had checked that the test-results.xml (and other files) belong to the latest test run. The Jenkins server is running on Ubuntu 14.04 LTS.
I'm running my tests in this manner: My project root directory has a run_tests.sh script which looks like this:
#!/bin/bash
if [ "$1" = "" ]; then
echo "Please provide a valid suite XML file name."
else
mvn clean
mvn compile
mvn clean test -Dsurefire.suiteXmlFiles="$1"
fi
I just pass the suite XML file name as a parameter to this script in Jenkins (execute shell).
Please help.
I found the solution for this.
Go to Configure of your Job
in General Tab, you may find
Advanced Button, Click on this
Check the check box of "Use custom
workspace", under this you see the Directory text box, here you copy
your Selenium Workspace Folder, for example mine is
"E:\eclipse\eclipse-workspace\WebDriveTest\"
Scroll down the page
under the Post-build Actions, Publish TestNG Results, TestNG XML
report pattern : give like this
"**/target/surefire-reports/testng-results.xml" (check this path in
the same workspace).
I hope this will help you!.
You should be using / instead of \ (since you mentioned that your Jenkins is running on a UNIX box)
Krishnan, in the testng-users Google Group, pointed out that it could be an issue with my Jenkins project workspace, and it was the same.
I changed the default workspace in my Jenkins project.
So I've added the path "$HOME/myWorkspace/myProject/" in my Jenkins project workspace, and "**/target/surefire-reports/testng-results.xml" in my TestNG setting in the same Jenkins project, and it works!
Thank you Krishan for your help.
Please see my answer in another post here, it should be very clear.
In short, it is caused by the current directory was changed to the default Jenkins workspace, you need set your custom workspace in the Job's Config.
I agree with Krishnan Mahadevan usage of '\' instead of '/' while providing the path for TestNG Report also solved my problem.
Extremely important thing to note here:
When providing path for Root POM in the build section '\' is used
C:\Users\harsh\eclipse-workspace\ProjTwo3\pom.xml
When providing path for TestNG XML report pattern in Publish TestNG Result section
'/' is used
C:/Users/harsh/eclipse-workspace/ProjTwo3/target/surefire-reports/testng-results.xml
Console Output:
channel stopped
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern:
C:/Users/harsh/eclipse-workspace/ProjTwo3/target/surefire-reports/testng-results.xml
Saving reports...
Processing 'C:\Users\harsh.jenkins\jobs\MyApplication\builds\12\testng\testng-results.xml'
11.688312% of tests failed, which exceeded threshold of 0%. Marking build as UNSTABLE

sending cucumber reports via jenkins Editable mail option

please can you assist me.
I am new to jenkins, working on a POC for my organization. I have successfully integrated cucumber execution through jenkins and able to execute the scripts and generated cucumber reports using cucumber plugin successfully
Issue:
I need to send the cucumber reports(reports are getting generated under(C:\Users\username.jenkins\jobs\cucumbertest\builds) send anyone of those reports as an attachment to my manager through Editable email option in jenkins.
please can someone assist me
The following approach worked for me:
Cucumber project's pom.xml have to include maven-cucumber-reporting plugin.Because we want to create report under Target folder.How to configure your pom.xml: https://github.com/damianszczepanik/
Jenkins Manage Plugin and install Email-ext plugin & Post build task.
Report files js, html, etc. in folder but I think if we want to send them properly via mail, their extension must be zip. So, we create a batch file and put it into C:\Users\yourUser\.jenkins\workspace\yourProject.
I use 7-Zip ;
4.1 Open txt file in notepad,
4.2 Put the following script into the file
#echo off
setlocal
for /d %%x in (C:\Users\yourUser\.jenkins\workspace\yourProject\target\cucumber-html-reports*.*) do "C:\Program Files\7-Zip\7z.exe" a -tzip "%%x.zip" "%%x\"
endlocal
exit
4.3 save as .bat file. For Example I have new.bat
In Jenkins choose Post Build Task then I write C:\Users\yourUser.jenkins\workspace\yourProject\new.bat in area script
Then Editable Email Notification part Attachments part must be
**\**\cucumber-html-reports.zip

How to get Jenkins to not include SVN file list in console output

I am using Jenkins to run PHPunit and prep pre-prod server from SVN for a PHP project. My PHP project has over 5400 files included. When I want to review the console output of the jenkins job, I have to scroll through the whole file list each time. Is there a way I can get the jenkins svn check out to not list every file, just give me a file count in the console output?

Hudson/Jenkins PMD Configuration

I am new to Jenkins and just started configuring it. This is what i have done till now:
Installed and configured Jenkins to display the home page. Added PMD plugin.
Set the HUDSON_HOME to a specific directory > C:\Work\Jenkins
Configured a test build to run a simple do-nothing ant script. It runs successfully
Written an independent pmdbuild.xml to run checks on a set of files in C:\myview (I am using clearcase). This xml also copies the output pmd_results.xml to the workspace directory in $HUDSON_HOME/[job-name]/workspace
Now I added the pmdbuild.xml as a step in my primary build. So my build has 2 steps:
a. Run a simple script, do-nothing.
b. Run pmdbuild.xml which generate pmd_results.xml and place it in $HUDSON_HOME/[job-name]/workspace (HARD-CODED as Jenkins PMD plugin expects the file there)
Jenkins picks up the pmd_results.xml automatically with the plugin and displays warnings and everything.
Now the problem:
If I click on a filename in the PMD results, it gives a filenotfound exception as it is looking for the source file in $HUDSON_HOME/[job-name]/workspace.
My java code files are placed in C:\myview (a clearcase snapshot view)
My question is, do I need all my code files to be present inside $HUDSON_HOME/[job-name]/workspace ?? Meaning can't I tell Jenkins to look for the PMD input files in C:\myview or any other directory instead of $HUDSON_HOME/[job-name]/workspace ??
Sorry for the extremely long description.
Jenkins expects that all the code is in the workspace. Usually Jenkins is used to check out a copy of the code into the workspace, and then runs all build steps on the Sources in the Workspace.
Might seem restraining at first, but it saves you a lot of trouble if you need to move Jenkins to another server, or create a slave instance.
So I would suggest you let Jenkins check out your code (there should be a clearcase plugin) into the workspace, and run the analysis on the checked out code.
If there are compelling reasons why your code has to stay where it is (C:\myview in your case) you can still set the workspace of your build to that directory (find this in the job configuration page, you need to click on the 'extended' button to see the option).

Resources