Missing resource: in SOATest Jenkins configuration - jenkins

I am setting up Jenkins for parasoft SOATest and setting the shell commands for execution of .tst. But when I try to build job through jenkins it throws following error:
ERROR: Missing Resources: The following symbols/resources were specified but were not found in the workspace. Ensure thy are valid and are related to the workspace.
location/xxx.tst
Although I have specified correct path for the resource it throws this error.
Can someone please guide me on the same.
Also please let me know if there are any documents/links to refer for the same.

Check in Parasoft's SOAtest documentation option -import ( the import process based on eclipse project definition so be sure that you have also .project file)
You should first import tst into workspace as first step in Jenkins' job, the second step should execution of particular test with SOAtest -config option.
You can find examples and explanation of all options in SOAtest's user manual.
and check also following url http://build.parasoft.com

I encountered and resolved the same problem. Make sure the .tst has proper permission. It needs to be executable.
chmod 777 xxx.tst

Related

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

FirebaseCrash error TARGET_BUILD_DIR: Value missing

I'm trying to follow the steps listed here to upload dSYMs to Firebase.
I'm using Jenkins as a build server. This is my script:
GOOGLE_APP_ID=1:my:app:id
Pods/FirebaseCrash/upload-sym "/Path/To/Service_Account/file.json"
I'm getting this error:
Pods/FirebaseCrash/upload-sym:113: error: TARGET_BUILD_DIR: Value missing
How do I specify the target build directory?
As per Eric Shieh's comment, the reason why the script was not working in Jenkins' build script was that certain environment variables that Xcode supplies are missing when running through Jenkins.
So, I added a run script phase as the documentation suggests and then marked the "Run script only when installing" option.
This option will only run the script when archiving occurs.

Jenkins - failed: No test report files were found. Configuration error?

I'm beginner for "Jenkins" and following this tutorial.
At the Sixth step I got below error.
xcodebuild: error: Scheme JenkinsTest is not currently configured for the test action.
Build step 'Xcode' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE
In the Test report XMLs I did set "test-reports/.*xml"
I tried to find my solution and also many questions are founded on SO like same issue I have too but did not get solution.
I have some confusion, Is .xml file automatically generated by "Jenkins" or First we manually need to add .xml file ?
In short guide me on right direction based on above error.
You can also enable the 'allowEmptyResults' option so that the junit plugin won't throw an exception when it doesn't find test results.
This way it doesn't matter if the 'test-results' directory exists.
junit allowEmptyResults: true, testResults: '**/test-results/*.xml'
First make sure junit.xml is getting generated after the test run.
Jenkins job at times cannot see past the current workspace. so it is always a good idea to copy the reports back to the current workspace before using it.
cd <path to report>
cp *.xml $WORKSPACE
Now the jenkins should pick-up the report.
Note: The config may show error first(since it cannot find the xml file in workspace) but after a build this should go away and also the result should get recorded
I'm using nosetest (python) to generate an xUnit compatible file and I was getting:
ERROR: No test report files were found. Configuration error?
I was using junit plugin as:
junit "test-results-unit.xml"
junit seems to add WORKSPACE directory by default so using the full PATH to the file wouldn't work either. I created symlink from the resulting file to the WORKSPACE directory to make it work:
sh 'ln -s tests/test-results-unit.xml $WORKSPACE'
junit "test-results-unit.xml"
Other answers suggest copying the files to the workspace directory, but for me simply changing the path to start with '**' seemed to solve the issue
junit '**/test-reports/*.xml'
The Jenkins junit plugin page says that you need to "specify the path to JUnit XML files in the Ant glob syntax". I've not dug into the full details of what this means, but starting the path with '**' was enough to get it working for me.
Thanks #Acid, it really helped me.
First, copy the module/build/test-results to workspace directory
cp -r app/build/test-results $WORKSPACE/test-results
And then I used this wildcard path
**/test-results/**/*.xml
I had the same problem and my test report file name got changed due to an upgrade in scala version,
Hence I have to change from,
junit '/myworkspace/target/myreport.xml'
to
junit '/myworkspace/target/TEST-myreport.xml'
How about:
junit allowEmptyResults: true, testResults: "${WORKSPACE}/test-results/*.xml"
or just:
junit "${WORKSPACE}/test-results/*.xml"
You have to find the path where your test reports are saved in your .jenkins workspace:
/Users/<USERNAME/>/.jenkins/workspace/<PROJECT/>/target/surefire-reports/*.xml
to find the folder type in your terminal:
.jenkins
then
open .

Jenkins "Console Output" log location in filesystem

I want to access and grep Jenkins Console Output as a post build step in the same job that creates this output. Redirecting logs with >> log.txt is not a solution since this is not supported by my build steps.
Build:
echo "This is log"
Post build step:
grep "is" path/to/console_output
Where is the specific log file created in filesystem?
#Bruno Lavit has a great answer, but if you want you can just access the log and download it as txt file to your workspace from the job's URL:
${BUILD_URL}/consoleText
Then it's only a matter of downloading this page to your ${Workspace}
You can use "Invoke ANT" and use the GET target
On Linux you can use wget to download it to your workspace
etc.
Good luck!
Edit:
The actual log file on the file system is not on the slave, but kept in the Master machine. You can find it under: $JENKINS_HOME/jobs/$JOB_NAME/builds/lastSuccessfulBuild/log
If you're looking for another build just replace lastSuccessfulBuild with the build you're looking for.
Jenkins stores the console log on master. If you want programmatic access to the log, and you are running on master, you can access the log that Jenkins already has, without copying it to the artifacts or having to GET the http job URL.
From http://javadoc.jenkins.io/archive/jenkins-1.651/hudson/model/Run.html#getLogFile(), this returns the File object for the console output (in the jenkins file system, this is the "log" file in the build output directory).
In my case, we use a chained (child) job to do parsing and analysis on a parent job's build.
When using a groovy script run in Jenkins, you get an object named "build" for the run. We use this to get the http://javadoc.jenkins.io/archive/jenkins-1.651/hudson/model/Build.html for the upstream job, then call this job's .getLogFile().
Added bonus; since it's just a File object, we call .getParent() to get the folder where Jenkins stores build collateral (like test xmls, environment variables, and other things that may not be explicitly exposed through the artifacts) which we can also parse.
Double added bonus; we also use matrix jobs. This sometimes makes inferring the file path on the system a pain. .getLogFile().getParent() takes away all the pain.
You can install this Jenkins Console log plugin to write the log in your workspace as a post build step.
You have to build the plugin yourself and install the plugin manually.
Next, you can add a post build step like that:
With an additional post build step (shell script), you will be able to grep your log.
I hope it helped :)
Log location:
${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log
Get log as a text and save to workspace:
cat ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log >> log.txt
For very large output logs it could be difficult to open (network delay, scrolling). This is the solution I'm using to check big log files:
https://${URL}/jenkins/job/${jobName}/${buildNumber}/
in the left column you see: View as plain text. Do a right mouse click on it and choose save links as. Now you can save your big log as .txt file. Open it with notepad++ and you can go through your logs easily without network delays during scrolling.
I found the console output of my job in the browser at the following location:
http://[Jenkins URL]/job/[Job Name]/default/[Build Number]/console
This is designed for use when you have a shell script build step. Use only the first two lines to get the file name.
You can get the console log file (using bash magic) for the current build from a shell script this way and check it for some error string, failing the job if found:
logFilename=${JENKINS_HOME}/${JOB_URL:${#JENKINS_URL}}
logFilename=${logFilename//job\//jobs\/}builds/${BUILD_NUMBER}/log
grep "**Failure**" ${logFilename} ; exitCode=$?
[[ $exitCode -ne 1 ]] && exit 1
You have to build the file name by taking the JOB_URL, stripping off the leading host name part, adding in the path to JENKINS_HOME, replacing "/job/" to "/jobs/" to handle all nested folders, adding the current build number and the file name.
The grep returns 0 if the string is found and 2 if there is a file error. So a 1 means it found the error indication string. That makes the build fail.
Easy solution would be:
curl http://jenkinsUrl/job/<Build_Name>/<Build_Number>/consoleText -OutFile <FilePathToLocalDisk>
or for the last successful build...
curl http://jenkinsUrl/job/<Build_Name>/lastSuccessfulBuild/consoleText -OutFile <FilePathToLocalDisk>

tf.exe Unable to detrmine the workspace

I am trying to call TF get command via Team Build script. I am getting the following error
Unable to determine the workspace.
Folks over the internet tell that this error is because Team Build cannot find the workspace because it is being called from a directory which is not part of the workspace.
The solution presented is to specify the working directory. I do so. The mappings are ok in Build Definition path as well as in the workspace. But now i get the following error:
Could not find cmd.exe in the current
directory . The directory name is
invalid.
Kindly help.
Thanks
Solved the problem. I added one more binding in my build Definition Workspace Section and referenced files to get/checkin/checkout with the help of variable $(MSBuildSourceDirectory). Meanwhile I ensured that $(SourceDir) is used to specify mapping in the workspace section of my Build Definiton dialog.
(source: geekswithblogs.net)
At the same time i encountered 260-character path limit, so i modified the output directory in build path as described here
(source: geekswithblogs.net)

Resources