Admin rights to start a project with fbcmd in command line?

(Kai) #1


I’m new to Finalbuilder and CI and I’m starting real slow to get comfortable. I wanna start a project via command line. The project includes a TestComplete/TestExecute test. I can execute the test via command line without any admin rights. But when i try to execute the test via FB8 like this:

`fbcmd.exe C:\Users\xxx\xxx\FinalBuilder_CI_Test.fbz8`

i get an ERROR that says:

Failed to execute program. Error: The requested operation requires elevated rights.

Why did FB8 need admin rights now? Did i miss somthing? Same error in CI.

If you need any other informations please let me know!

best regards

(Vincent Parrett) #2

It’s not FinalBuilder that requires elevation (it’s manifest is set to asInvoker) - my guess is the error being reported is being reported by TestComplete not FinalBuilder. Since you didn’t show the full log it’s hard to tell for sure.

I had a look at the documentation for testcomplete and found some useful information here :

Basically, you need to run fbcmd from an elevated command prompt.

As for Continua, you will need to stop and disable your agent service, launch an elevated command prompt, and then run

Continua.Agent.Service.exe --console

This will allow the agent and testcomplete to interact with the desktop session ui.

(Kai) #3

Hi Vincent,

thank you for your reply. That is the full log. I dont see more Information either. I could show you a screenshot of the error but this will dont help anyways. Its just the command line command to call TestComplete/TestExecute with the error from above.

So you say its not FinalBuilder that requires elevated rights and than you say i need to start fbcmd with elevated rights.

I tryed to use your command line command. It asks me to press Q for quit (this closed the service) or R for reload (nothing happened). When I close the command line, the service is also closed.

I go a step back to FinalBuilder GUI directly. So here’s exactly the same error. I’m not using the agent when I’m directly in FinalBuilder (am I right?) to start a TestComplete project. If both run with administrator rights, it works fine.

I take a closer look at the TestComplet documentation and check the Group Policy setting today.

Sorry if I misunderstood something from your explanation.

(Kai) #4

log.txt (1.9 KB)

I found the log from ci hope it helps

(Vincent Parrett) #5

TestComplete requires elevation, so if another process starts it (like FinalBuilder or the command prompt) then that other process must be started as elevated too. This is just how windows process permissions work, by default process inherit the permissions/security attributes/elevation level from their parent process.

So this applies to fbcmd and to the Continua Agent.

TestComplete cannot be run from a service, as it needs to interact with the windows user interface. So to get around this, you need to run the Continua Agent from the command line, and that command window must be launched as administrator (ie, elevated) so that the Continua Agent and then TestComplete can be elevated (without a UI prompt).

There is no programatic way to elevate a process that also allows you to caputure std out. Shell Execute can elevate, but cannot capture std out, and the elevation would still put up a UAC prompt for elevation, which is obviously not what you want in an automated environment.

(Kai) #6

Hi Vincent,

i worked my way throught TestExecute, Continua Ci, and FinalBuilder. For now it works with just one Problem.

I have a FinalBuilder project that calls a batch with a command line. That works like it should and get me a errorlevel 0 back. But if i take the FB8 project and took it in CI and start the project that calls the batch it creates a errorlevel 2. But it is the same project i changeged nothing.

Enclosed errorlog from ci an FB8.log.txt (2.5 KB)

(Vincent Parrett) #7

The Run DOS Cmd action reports the exit code of cmd.exe - so cmd is reporting 1. It’s difficult to tell what is going on without seeing the batch file.

(Kai) #8

First of all: I’ve solved the problem we had. Unfortunately not to our satisfaction. It’s so we want to run GUI based tests and introduce them into the build and deploy pipeline. I don’t know why I didn’t think of this earlier, because the CI Agent doesn’t start an interactive interface, it is not possible to integrate our tests. Because the interface or the user view is not present at all.
How do you intend to integrate TestComplete/TestExecute into FinalBuilder? Is it even possible to run GUI based tests via CI Agent?
Maybe you’re wondering, but I’m a working student, so I’m still learning all the programming and working with our and other tools. It was my fault to be honest with you. That I didn’t find it faster.

________ no longer of interest!________
start /wait “TestExecute” “C:\Program Files (x86)\SmartBear\TestExecute 14\bin\TestExecute.exe” “C:\Development\testcomplete\Testsuite\Testsuite.pjs” /run /project:X /test:“Test_X” /e /SilentMode
EXIT %errorlevel%

that’s the batch file, it’s nothing special. (You can also see the batch file in the png. There is a Output from C:/Windows/system32/cmd.exe.) I can’t find my mistake. The same batch creating two errorlevels. In CI you can see there is an error in the test and after the test exit with errorlevel 2 CI exit with errorlevel 1.

Is there any way that TestComplete gets an update in FB? What we miss is the /test: “feature” for the command line. If you take a look into my command line there is /test:“Test_X” that calls a specific KeywordTest in TestComplete.

(Dave Sparks) #9

Hi Kai,

Do you get any error messages if you remove the /SilentMode parameter?

I suspect the problem here is that you are still running the Continua CI agent as a service. TestExecute requires an interactive session to run UI tests. Windows services run without any user logged in and therefore do not have access to an interactive session. To get an interactive session you need to run the agent in console mode.

As Vincent stated above:

I see that you tried this:

This is what we would expect to see when running the Continua CI agent in console mode. You need to keep the command line open and stay logged into the agent computer. Note, this is only required if you are running builds which require an interactive session.

We would update TestComplete actions, but currently SmartBear will not provide us with a free license to work with.

(Kai) #10

Hi Sparky,

I don’t know why, but it works now. Maybe the time between starting the console and starting the build job was too short.

I have another question for you. Is there a way to make it work without seeing the command line? Because right now it works, but if someone closes the command line, it can be active or accidental. All tests don’t work anymore. That’s not what we want.

Because all our tests ar GUI based. So all our Tests require a interactive session.

Do you have a documentation that gives us more information about the whole process?

best regards and many thanks

(Dave Sparks) #11

Hi Kai,

Sorry, but the command-line window needs to be running - otherwise the agent is not running. You can minimize it. You can also set up shortcut to always start it minimized.

Or you can run it under a tool such as ExecAs which can be set to run in in an interactive session and hide the window.

e.g. ExecAs.exe -i -h "c:\Program Files\VSoft Technologies\ContinuaCI Agent\Continua.Agent.Service.exe" --console

Note however, with the agent window hidden, the only way to shut it down is to kill the process in the task manager. This may have unpredictable results if build tasks are running.

The main point is that you need to stay logged in to an interactive session in Windows for UI testing tools such as TestExecute to work. Generally, we would recommend running the agent on a dedicated computer or virtual machine so that no-one accidentally closes it.

We don’t currently have any documentation about running the agent in console mode. I’ll add a task write a page on this, but there’s not really much we can add to what has been said in this post.