Forum Discussion

jjackson150's avatar
jjackson150
Occasional Contributor
2 years ago

Unable to Schedule Unattended Tests with Jenkins

Our organization purchased a dedicated Windows 10 desktop to scheduled our TestComplete tests. I've developed a Jenkins pipeline using the TestComplete plugin. The pipeline and plugin executes our TC tests perfectly, but once we disconnect from the RDP (remote desktop) session, the tests fail, as the tests can longer interact with the GUI. I've investigated several solutions, but nothing has worked. The solution that aligns best with what we need, is this: https://community.smartbear.com/t5/TestComplete-Questions/The-operation-cannot-be-performed-because-the-user-session-is/m-p/206172#M4158
 
I attempted the solution in this community post and it almost worked! The Jenkins agent Windows service was successfully created and the agent is able to open a batch file, but it's unable to launch TestComplete (despite the log).
[TestComplete] Launching the test runner.
Everything in the logs look good, but when TC is supposed to launch, it never does. The test will sit in this state indefinitely. 
 
I've also created a wrapper script (e.g. batch file) that opens TestComplete and same result. Everything in the logs look good, but when TC is supposed to launch, it never does. The test will sit in this state indefinitely. 

5 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If you were to run that batch file manually, does it run?

     

    What's the exact command in your batch file?

     

    Are you running TestComplete, TestExecute or SessionCreator?

     

    Have you read through Running Tests via Remote Desktop?

     

     

    • jjackson150's avatar
      jjackson150
      Occasional Contributor

      rraghvani Yes, it runs as expected if I run the batch file manually. I would rather not use the batch file route, because I'll lose the benefits of the TestComplete plugin.

       

      Here's the simple batch file:

      @echo off

      REM Change to the TestComplete installation directory
      cd C:\Program Files (x86)\SmartBear\TestComplete 15\x64\Bin\

      REM Launch TestComplete
      TestComplete.exe /run /project:"C:\Jenkins\workspace\QA_Server_Regression_Pipeline\Framework\Suite.pjs"

       

      This is being ran with TestComplete and yes, I've read through that documentation. It does not seem to provide solutions on how to run tests while the RDP session is disconnected. They provide a solution where a batch file disconnects the session before running the tests, but not a solution that would allow me to keep a RDP session disconnected for multiple separate test runs (e.g. nightly test runs)

       

      Thanks for your help,

      - Josh

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        The Jenkins agent Windows service [...]

        > how to run tests while the RDP session is disconnected.

        GUI applications technically might run on disconnected RDP session, but cannot render their GUI. This is not a limitation of TestComplete but essential behavior of Windows OS.

        What you must do:

        a) Setup your test box to auto logon when turned on;

        b) Setup Jenkins agent to run not as Windows service, but as regular application and set it to be started when your test account logs on (during step a) );

        c) Never disconnect RDP session but instead switch it to system console as described in the documentation that you mentioned. (Note: command file provided in the documentation MUST be executed using elevated permissions (Run As Administrator) in order to work as expected.)

         

  • jjackson150's avatar
    jjackson150
    Occasional Contributor

    AlexKaras rraghvani  Thanks for the suggestions. Possible solutions A and B, could be a good option we adopt down the line. For the time being, if we connect to the remote desktop, we'll just need to make sure we disconnect from the RDP session using one of the disconnect options from the TestComplete documentation. (https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/keeping-computer-unlocked.html). 

     

    I was incorrect in saying "They provide a solution where a batch file disconnects the session before running the tests, but not a solution that would allow me to keep a RDP session disconnected for multiple separate test runs".