2

In TeamCity, I'm setting up "command line" runner type. My aim is to run the commandline script in the window & let it run. Then go to next build step without closing the command line window which is opened in the previous step. In my last build step, I want to close the command line window which is still open during the initial build step.

Above scenario is based on my build steps while configuring 'BrowserStack" tests project. I want to execute BrowserStackLocal.cmd in my 'Command Line' runner type step & let it run. Then go to next build step in which i have all my tests. Finally in the last build step, I want to close the command line window after completing the tests.

Currently the build step doesn't know what to do after executing 'start BrowserStackLocal.exe -force' as it will be waiting for a reply code.

Any ideas on how to move to the next build step?

4 Answers4

2

As pointed out by Alina you need to setup a 'Command Line' build step for launching BrowserStackLocal in background before running the tests. The config can be like:

Runner Type = Command Line
Run = Custom Script
Using 'advanced options' set Working directory where BrowserStackLocal is present if it differs from the checkout directory.

Custom Script samples:

  • For Linux/Mac

        #!/bin/bash
    
        ./BrowserStackLocal <BrowserStack Key> -force &
    
  • For Windows

        start /B BrowserStackLocal.exe <BrowserStack Key> -force 
    

You can put a wait to allow the BrowserStackLocal process to start before moving to the next build step in your Team City project. Also, you can set up a post build action to kill the running BrowserStackLocal processes.

9ikhan
  • 1,177
  • 3
  • 11
  • 22
  • You are correct 9ikhan. We have implemented the same way. Challenge here is, TeamCity build step don't know what to do after executing 'start BrowserStackLocal.exe -force' as it will be waiting for reply code. It will never be able to jump into TESTS to execute while BrowserStackLocal is running. – V R V R Krishnan May 19 '15 at 14:46
  • Can you try this : `start /B BrowserStackLocal.exe -force > output.txt` ? I have verified this on a windows machine and it does run the process in background and is non-blocking. Refer: http://superuser.com/a/591084 – 9ikhan May 19 '15 at 15:16
  • @VRVRKrishnan - If this solution worked, then accept the answer or let me know if you need any more info. – 9ikhan Jun 02 '15 at 17:35
1

Had the same issue recently, starting the binary as a daemon will continue to the next build step.

Open connection:

browserstacklocal.exe --key %system.BrowserStackKey% --local-identifier %system.BrowserStackLocalIdentifier% --force --daemon start

Close connection:

browserstacklocal.exe --local-identifier %system.BrowserStackLocalIdentifier% --daemon stop
0

you just have to press ALT and TAB

0

If 'BrowserStack' has an appropriate start-stop commands then you can use them (for example like Tomcat). If not then you can start 'BrowserStack' in background, then run tests and then kill it using the following command option: -force - kill other running instances of BrowserStack Local

Community
  • 1
  • 1
Alina Mishina
  • 3,320
  • 2
  • 22
  • 31
  • Hi Alina, Thanks for the reply. Here the issue is mainly around TeamCity (CI) configuration. Need to know how to jump to another build step in TeamCity after initiating 'CommandLine' runner type build step. – V R V R Krishnan May 18 '15 at 14:58
  • It is not possible to run parallel build steps in TeamCity, see the related [feature request](https://youtrack.jetbrains.com/issue/TW-13849). I suggest you to start BrowserStack in background in the first command line build step. Once it started the second build step starts to execute - run tests and in the third build step kill BrowserStack process. – Alina Mishina May 18 '15 at 15:34
  • In TeamCity, Second build step will not start until the first step is completed/ failed (No way to start the second build step without exiting first step). Once we run the BrowserStack as part of TeamCity build step 1, It will keep on running forever. Temporary solution is: Run BrowserStack manually at the background and remove corresponding step from TeamCity build steps. – V R V R Krishnan May 18 '15 at 15:53