Forum Discussion

jaward916's avatar
Occasional Contributor
2 years ago

Jenkins Integration - Command Line Argument



I am running TC 15 latest version, Jenkins Latest version and the plugin.
I have my TC machine set up as a Jenkins Slave node and can see my QA step starting to execute, but it is failing with:

[TestComplete] Test runner exit code: 3. 

[TestComplete] [WARNING] Error: Unable to create a project item of the 'Tested Applications' type, because the specified file does not exist. The item to be created is a child of the following project item: CSG_ExtendedSolutions\MenuUsageTracker Missing file: C:\TestComplete\tc-extendedsolutions\MenuUsageTracker\TestedApps\TestedApps.tcTAs.~$tcUnsaved$.

I think what is happening is I currently pass in an "environment name" parameter which is read as a variable which forms part of the tested application's path, however, the plugin is adding an additional command/parameter at the end of the string, and my test code reads the last parameter sent to the command line, can you see the issue here...


I can see from the Jenkins log that the command run includes this extra param (JenkinsTCPluginVersion) which means my environment name variable is now that string, rather than 'MyQAEnvironment' - I don't really want to change the test code, as this would break my manually run PowerShell scripts (and I do similar for 5 products in total). I would like to use the TestComplete Jenkins plugin so test results are published in my pipeline.


So the question is, can we suppress or move this additional parameter, so I can ensure that my Jenkinsfile included 'commandLineArguments' are in fact passed as the very last item in the command?

Some images to help explain, hopefully:

This shows the Jenkinsfile pipeline commands for QA Stage with my commandLineArguments





This shows the error and full command that was input (not the additional plugin version param)




This shows the code I use to set up the TestedApp "dynamically" based on the last param being the environment name, which I think was code someone on these forums helped with a while ago!






Open to ideas on how to get around this?

2 Replies

  • I don't understand the problem, but since you are assigning the variable inside a function, why don't you just add an "if" to check if that last parameter contains the string JenkinsTCPlugin, and if it does then you pick the previous parameter? That way it would not conflict with your PowerShell scripts. 

    Another option is to add a Project Variable in TestComplete to reference your environment.

    That way you can pass the environment via the CLI parameter /pv:myEnvironment=QA or /pv:myEnvironment=AT, or whatever.

    Then in your script you just reference that variable doing Project.Variables.myEnvironment, and it will pick either the value you set up as default on the tool, or the value passed as parameter through the CLI and it won't matter in which "position" it is

  • jaward916's avatar
    Occasional Contributor

    Thank you for this, your approaches should work for me, I'm not sure how I've missed the /pv: params this is likely the solution I need, as I'm assigning to project variables anyway! I agree the position thing is a little restrictive but has worked for nearly 2 years until I tried to be clever and sort all our pipelines out!!