简体   繁体   中英

gitlab-runner for testing windows application with GUI

We want to automatize our integration tests for a Windows-MFC-application (Visual C++) with gitlab-ci/cd. We have set up a gitlab-runner (version 14.2.0) on Windows 10 with Powershell.

In the ci/cd script, we start our application with the following Powershell command. (line breaks included for readability)

  - 'foreach ($test in $TestDirectories) 
    { 
      Write-Host "Running test $test."; 
      $proc = Start-Process "./Release/MyApp.exe" -argumentList "-TESTMODE $test" -PassThru; 
      Wait-Process -Id $proc.Id; 
      if ($proc.ExitCode -ne 0) 
      { 
         $ESC = [char]27; 
         $ExitCode = $proc.ExitCode; 
         Write-Host "$ESC[31mTest $test failed with code $ExitCode $ESC[0m"; 
         exit 1;
      }
    }'

The app is running, but its behavior is very strange. Sometimes it is crashing, sometimes the tests get stuck. I have attached the Visual Studio debugger to the process, but I was not able to find the real problem with many effort. Always some new, changing errors.

I suspect a problem, that the app is started from the gitlab-runner service without a real graphical user interface. I cannot see its windows anywhere, but the application is listed in the task manager. Is it somehow possible to start the application in a "normal" manner? Can I see its window somehow?

I have tried to register the gitlab-runner with a user account

gitlab-runner.exe install -user MyUser -password xxx

and also with the system account (standard)

gitlab-runner.exe install

Also, setting the flag "Allow interact with desktop" in the service manager did not work.

But, if I start the upper commands from normal Powershell console, everything goes well.

Do you have some suggestions, how to handle windows application with GUI in gitlab-ci-cd-scripts?

My config.toml file:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "PEN-PC2101"
  url = "https://gitlab.com"
  token = "********"
  executor = "shell"
  shell = "powershell"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

A bit late...

A Windows service can no longer open a GUI, the reason is that the services are potentially running a user that is not you. They can even run even if you are not logged on.

You will have to have a software running in your session, communicating (over sockets/pipes/...) with the service and launch your executables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM