tarzanbappa
tarzanbappa

Reputation: 4958

Include Build number in Jenkins test result file

I have a test project in Jenkins. And each time I build my project it says.

The results file "My File Path" already exists. Please specify a different results file or verify the existing file is no longer needed and delete it.

So I've decided to include the build number in the name of my result file. And I'm using my result file to generate some graphical output also.

How can I include my Build Number in both locations

This is the windows batch command execution

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\mstest.exe"
 /testcontainer:"%WORKSPACE%\TestAutomation\bin\debug\TestAutomation.dll" 
/resultsfile:"%WORKSPACE%\results.xml"

And I'm using my result file as follows. enter image description here

How can I change both these locations to add current build number in my result file as followingformat

result_BuildNumber.xml

Upvotes: 1

Views: 551

Answers (1)

mahinlma
mahinlma

Reputation: 1248

Try this,

      result_%BUILD_NUMBER%.xml - for batch
      result_$BUILD_NUMBER.xml - for shell

BUILD_NUMBER is environment variable.

Upvotes: 1

Related Questions