Ask a Question

Jenkins exit code result

longchasen
Contributor

Jenkins exit code result

im using TC plugin thur pipeline running in interactive mode, my setup is i run a series of project. I need to get the result of each project run by getting the exit code on each project that run do make additional steps depend on the requirement. I used the /exportSummary to try to parse the result but for some reason this is not working. 

5 REPLIES 5
hkim5
Staff

So I;m sure as you are aware, the exit code presented on the console output of jenkins is regarding the status of the test runner

image.png

and the /ExportSummary argument is typically used to generate the style of report you want at a specified directory (whether it be mht, xml, html...) 

Typically a generated xml result would look like this:

image.png

-

the status of each test can simply be viewed in the testcomplete test results tab of each build

image.png

----

could you elaborate further on what you mean by "make additional steps depend on teh requirement"?

Is it something like, if some project fails, you dont want another project to run? I'm not quite sure what the end goal is here.

Best,
Justin Kim

Justin,

 

A requirement is how it should handle when an error or unstable show up runing a project, heres  a pseudo code  sample:

sample 1:

 stage('Prequisite project')

 TestComplete  @project1

 if (unstable) 

   create jira 

stage ('Run project2')

{

 TestComplete  @project2

 if (error)

     stop

}

//...so on running other project thru TC

 

The idea is i need to get the result of each individual project run not as a single build, succeeding action will base on the result of each run. Also i tried to supply the /export summary but its not working, heres how it look like:

testcompletetest actionOnErrors: 'MAKE_FAILED',
actionOnWarnings: 'MAKE_UNSTABLE',
commandLineArguments: '/exportSummary:"C:\\Jenkins\\Result\\Result.xml',
generateMHT: true,
launchType: 'lcProject',
project: 'Project1',
suite: '../../Suit.pjs',
useTCService: true,
userName: 'admin', userPassword: '1234'

 

this is not creating a result on the specified path

 

Did i miss something here or is there a better way to handle it? 

 

 

 

 

 

As far as getting the exit codes from testcomplete to specify the course of actions over subsequent project runs is concerned, I am having a hard time thinking of  a direct solution. There of course are workarounds (like creating a shell script to parse the xml data, but that seems like alot of work)

As to your log generation question, that command like argument should have a capital E

/ExportSummary:"C:\results\results.xml"

Or since it looks like you are using the groovy syntax jenkins pipeline script:

image.png

Best,
Justin Kim
sonya_m
SmartBear Alumni (Retired)

Thank you hkim5!

 

@longchasen please let us know if the advice helpedSmiley Happy


Sonya Mihaljova
Community and Education Specialist

wetter
Occasional Visitor

Sorry, but I'm little confusing.

Can I get the exit code valur from the teste complete command line?

Something like:

exitCode = testcompletetest actionOnErrors: 'MAKE_FAILED', actionOnWarnings: 'MAKE_UNSTABLE', executorType: 'TE', generateMHT: true, launchType: 'lcRoutine', project: 'TestAutomation', routine: "main", suite: 'C:\\JenkinsFolder\\AutomationFiles\\TestAutomation\\Project\\TestAutomation.pjs', unit: UnitNames[index], useTCService: true, userName: 'xxxxxx', userPassword: 'xxxxxx', timeout: '1500', useTimeout: true;

It's not working for me.
cancel
Showing results for 
Search instead for 
Did you mean: