Forum Discussion

anatoliy_kushna's avatar
12 years ago

TestComplete + Jenkins

Colleaguess,

I have seen these two articles:




Running TestComplete Tests with Multi-Configuration Jenkins Projects and 


Cross-Browser Web Testing – a TestComplete and Jenkins Framework



and they both did not solve my issue.




 


I have Jenkins installed on Windows 7, x64, I have TestExecute installed on the same host and loaded TC project.


Also I have .bat file that I use to run my tests.


 


When I was creating a job on jenkins I did it in two ways and both did not work.


First one was when I set a path in Execute Windows Batch Commands window . A path to run that .bat file that I click to run my tests.


The second way I used the following in Execute Windows Batch Commands window


 


date /t


time /t


SET TESTEXECUTOR="C:\SmartBear\TestExecute 9\Bin\TestExecute.exe"


IF EXIST "C:\SmartBear\TestExecute 9\Bin\TestExecute.exe" SET


TESTEXECUTOR="C:\SmartBear\TestExecute 9\Bin\TestExecute.exe"


 


%TESTEXECUTOR% "C:\AplanaFinal\HomeCredit_autotests\Source\MyTestProject2\MyTestProject2.mds" /run project:MyTestProject2 /test:"Script|preparingDataForTests|preparingDataForTests" /exit /SilentMode /el:C:\tmp\new-preparingDataForTests1.mht /ns


 


In both cases I see that testexecute appears as a process in TaskManager but it did not appear in system tray and I did not see the testexecute player.



So in both cases my tests were not going. The tested application was not run and tested WEBs were not opened


 


May be you know where I was wrong.


 


I would appreciate for any suggestions.



Thank you.




11 Replies

  • We had a similar problem running via vmware. We resolved our problems doing this by running:



    call "C:\Program Files (x86)\VMware\VMware VIX\vmrun" -T esx -h https://esxmachine/sdk -u %ENV_USER% -p %ENV_PASSWORD% -gu %ENV_GUEST_USER% -gp %ENV_GUEST_PASSWORD% runProgramInGuest "[Datastore] VMNAME/VMNAME.vmx" -activeWindow -interactive "<insert path to TC or bat file calling TC here>"



    The key being the -interactive, without it we got the same symptoms as above. No registry hack needed. Of course the nicer solution would be making these client machines have jenkins installed but we're not there yet.



    Next step: reporting the results of the tests nicely within Jenkins and automatically logging JIRA tickets when failures occur (plugin for jenkins will do that though)
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi,


     



    > [...] I see that testexecute appears as a process in TaskManager [...]



    Haven't you noted the account that TestExecute was started under? I'm ready to bet that Jenkins is running either as a service or under the user account that is not currently logged-on interactively into the system. Thus TestExecute starts, but the system does not provide the user account with the desktop to draw the user interface at and thus tests fail because no UI object can be found. I believe that http://support.smartbear.com/viewarticle/27110/ or http://support.smartbear.com/viewarticle/28270/ should provide you with a good enough explanation of the problem and possible approaches.


  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,


     


    Alexei's right. As far as I know, TestComplete/TestExecute started from Jenkins will run in a non-interactive user session, and will not be able to perform UI actions.


     


    Some continuos integration systems provide special non-service utilities to avoid this problem. For example, MS Team Foundation Server can run a Build Agent as a service, or as an interactive app that is just waiting for a command (like a service does). This is called an Interactive Build Agent. You can find more information here.


     


    I am not sure if Jenkins has this ability, but this is something you may want to check.


     

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    If you cannot change the user the service is running as for whatever reason, you can still set the service as interactive. Since Windows Vista the property you needed to set prior to make the service interactive is not exposed anymore. You can still set your service as interactive, but you have to hack your way through. There is a registry key for your service there:



    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\<YOUR SERVICE NAME>\Type



    'Type' is a bitfield. You need to read the value of the key, do an 'OR &H100', and stick it back in registry.
  • I haven't had any trouble running TestExecute from Jenkins and didn't have to hack the registry. 



    Set the machine as a Jenkins node using Java WebStart and it will run as the logged in user. 



    My Jenkins server is a separate machine, maybe that makes the difference?



    Is there a TestExecute log?
  • This is a bit more complicated, but I have used PsExec.exe (a SysInternals utility) to launch TestComplete/TestExecute on a remote machine from Jenkins. PsExec can run in the Jenkins background process with no problem and it has a parameter (-i) that allows interaction with the desktop on the remote machine. You just pass the TC/TE command line string to PsExec and it will return the exit code from TestComplete so you can determine pass/failure. The issue is getting the log back to Jenkins, so I use a shared folder and copy the log back as an artifact.



    The first time you run PsExec you have to accept the EULA, so note the parameter in the popup window which is "/accepteula" I think to block it. You don't want that window coming up when Jenkins kicks it off. Otherwise PsExec won't work and you will not get any indication as to why.



    http://technet.microsoft.com/en-us/sysinternals/bb897553
  • Hugo Lalumiere,

    Could you explain your solution in detail?

    If the value of the key == 10, what should I put there to set service as interactive?
  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    You need to do a bitwise addition, in other words an OR operation.



    If the value is 0x10, then 0x10 OR 0x100 = 0x110 (or 272 decimal).



    If it is 10 decimal to begin with, then 0xA OR 0x100 = 0x10A (or 266 decimal).
    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Hello,

       

      Based on your feedback, we have implemented the special TestComplete plug-in for Jenkins.

      This means, unlike previously, you don’t have to execute automated tests through a command-line interface.  Launching TestComplete and executing the needed test project can be done directly from Jenkins builds. Also, once tests are executed, the results get automatically updated to Jenkins.

       

      Online Documentation:

      Integration With Jenkins

       

      The plug-in goes along with TestComplete 10.6.