Why can't Bamboo launch SmartBear TestExecute while the same command works when run directly?

Jared_Davison March 1, 2016

In the build execution log you might see the following error...

 

2016-03-02 15:59:48,059 INFO [19-BAM::Agent 7::Agent:pool-34-thread-1] [TaskResultBuilder] TEST-PTR-JOB1-49: Failing task since return code of [C:\Program Files (x86)\SmartBear\TestExecute 11\Bin\TestExecute.exe k:\build\TEST-PTR-JOB1\TestComplete\TestProject1\TestProject1.pjs /r /e /SilentMode /DoNotShowLog /ExportLog:k:\build\TEST-PTR-JOB1\TestComplete\TestProject1\Results\LogFile5.tcLogx /ErrorLog:k:\build\TEST-PTR-JOB1\TestComplete\TestProject1\Results\LogFile5.errorLog] was -1 while expected 0

 

The error may be misleading as TestExecute indicates that the return code -1 relates to a licensing issue.

https://support.smartbear.com/viewarticle/67539/

However if you have a look in the <bamboo-home>\logs\atlassian-bamboo.log  file or if running bamboo as console mode you will see some extra detail which would be helpful to see in the build log via the web ui. (If you don't see this you can waste hours wondering what is going on!)


2016-03-02 15:59:48,074 INFO [19-BAM::Agent 7::Agent:pool-34-thread-1] [TaskResultBuilder] Process exception:
com.atlassian.utils.process.ProcessNotStartedException: C:\Program Files (x86)\SmartBear\TestExecute 11\Bin\TestExecute.exe could not be started
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:339)
at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:113)
at com.atlassian.bamboo.process.ProcessServiceImpl.executeExternalProcess(ProcessServiceImpl.java:214)
at com.atlassian.bamboo.plugins.shell.task.AbstractShellBuildTask.execute(AbstractShellBuildTask.java:61)
at com.atlassian.bamboo.plugins.shell.task.AbstractShellBuildTask.execute(AbstractShellBuildTask.java:48)
at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$124(TaskExecutorImpl.java:273)
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:202)
at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:273)
at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:108)
at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:74)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:215)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:139)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:130)
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:215)
at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:129)
at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:137)
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Cannot run program "C:\Program Files (x86)\SmartBear\TestExecute 11\Bin\TestExecute.exe" (in directory "k:\build\TEST-PTR-JOB1\TestComplete\TestProject1"): CreateProcess error=740, The requested operation requires elevation
at java.lang.ProcessBuilder.start(Unknown Source)
at com.atlassian.utils.process.ExternalProcessImpl.createDefaultProcess(ExternalProcessImpl.java:374)
at com.atlassian.utils.process.ExternalProcessImpl.createProcess(ExternalProcessImpl.java:382)
at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:336)
... 20 more
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elevation
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 24 more

 

Notice the line that says:

Caused by: java.io.IOException: Cannot run program "C:\Program Files (x86)\SmartBear\TestExecute 11\Bin\TestExecute.exe" (in directory "k:\build\TEST-PTR-JOB1\TestComplete\TestProject1"): CreateProcess error=740, The requested operation requires elevation
at java.lang.ProcessBuilder.start(Unknown Source)

 

The following SmartBear documentation indicates that TestExecute may need to be elevated.

https://support.smartbear.com/viewarticle/67538/

However, TestExecute cannot be elevated by a process why isn't privileged to elevate it without a UAC prompt.

Solution:

Set Tomcat8 to run as an administrator so that TestExecute can inherit that privilege without a UAC prompt.

By right clicking "C:\Program Files\Bamboo\bin\tomcat8.exe" -> Properties->Compatibility->Change settings for all users -> and Turn on "Run this program as administrator".


It is important to set for all users if you are running Bamboo as a service.

2 answers

0 votes
VikasB March 7, 2016

Hi @Jared Davidson and @Kalle Sirkesalo,

TestComplete Task for Bamboo will have the task runners for TestComplete as well as Testexecute. Recently we have added Runner task for TestComplete.

We are testing few more settings to execute Unit tests, keyword tests with few combinations. We will add TestExecute task and JIRA integration of results in next release sooner.

https://marketplace.atlassian.com/plugins/com.mdb.plugins.testcompletetask/server/overview

0 votes
Kalle Sirkesalo March 4, 2016

You could also use windows command runas which let's you run commands as different users. Sadly this doesn't support UAC elevations so we need to do some magic and use a visual basic script or powershell. (I have attached both of these in bottom) Also powershell version attached.

This would let you run the command and keep tomcat in service user that has no right to an actual admin rights. 

I would do it this way to control the user rights of the other users in the bamboo instance.

It's bad practice to use admin rights to run build agents.

Runas documentation:

http://ss64.com/nt/runas.html 

http://ss64.com/vb/syntax-elevate.html

http://stackoverflow.com/questions/7690994/powershell-running-a-command-as-administrator

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events