TeamCity configuration for BrowserStack tests - teamcity

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?

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.

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

you just have to press ALT and TAB

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

Related

GitLab Runner not starting process

I have configured a GitLab Runner to run on one of my computers (the computer is Windows and uses Powershell to run yml script commands).
For my repo I have configured the yml file to copy the contents of the build into another directory, then have the runner run: Start-Process -FilePath "$PROJECTNAME.exe" -ArgumentList "$PROG_ARG_1" after changing into that directory.
However, the pipeline succeeds but the process that has been started (using "Start-Process" above) cannot be found on the computer anywhere (has not actually been started).
Am I doing something wrong?
EDIT: it is running just as a "Background Process" (needed to open control panel to verify it)

How to properly stop running dotnet core web application?

In Visual Studio 2017 and 2019 on Windows, I run dotnet watch run in the Package Manager Console. It launched kestrel for a dotnet core app, automatically disabled text edit in the console, and displayed a red button to stop command execution, but the button doesn't do anything. Also, the message is being displayed to use Ctrl+C but it doesn't work either.
Now listening on: http://localhost:20436 Application started. Press Ctrl+C to shut down.
Now there is an error when I try to launch the web app in Visual Studio because it is already running.
I couldn't find a command like dotnet stop only Ctrl+C which doesn't work in this case. I used Process Hacker to kill the dotnet.exe process but that doesn't seem right. What would be the best way to kill the running process?
Since this stop option doesn't work it is clearly a bug. If I need to run dotnet watch run I generally just open command line on my current folder outside VS and run it from there. Since dotnet watch run has nothing to do with visual studio (no debugging) it makes sense. Alternatively, you can use the green button to run within visual studio with debugger. However, this would mean you can't edit the code while testing.
run your project:
dotnet run > Examplelog.log &
$ dotnet run > Examplelog.log &
[1] 162
end your project:
kill 162
$ kill 162
[1]+ Exit 127 dotnet run > Examplelog.log
So with kill[id] you can end your process.
you not need a second console and can use your console for other inputs (take note that all outputs will be stored inside the Examplelog.log-File you have to check)^^lg
when the service is already running just again apply build command "dotnet build" and then again run command apply like "dotnet run"
services will be up again then you just have to press Ctrl+c in the terminal to shutdown running services.
There is a red button next to the clear button in that section next to the project name. I just found it LOL I will show you a picture follow the yellow circle. I was trying ctrl+c too LOL

Jenkins : Selenium GUI tests not visible in browser when I click build w/o using command prompt

I simply want to navigate to Jenkins, click build, and see the test execution in the browser. I don't want to use the command java -jar jenkins.war in the command prompt to get the browser to appear when I run my automated test. Any possible solutions?
They have a solution here
Solution 1: Enable "Allow service to interact with Desktop"
Tried it, it didn't work on my machine running in Windows 10
Solution 2: Through CMD using jenkins.war

Is there any way to open the CMD through teamcity so it will open and displayed on the desktop?

I have a batch job that i want to deploy from Teamcity to several servers,
to access several servers i use Winexe tool.
the batch is running but i can't see the session because it's started from teamcity,
but i can see that its running when looking at the process list.
My issue is that sometimes this job is having some errors,
which are being displayed on the cmd window when i run it manualy
but since i'm running it through TeamCity i can't see the CMD window so i can't see the error.
My question is:
Is there any way to open the CMD through teamcity so it will open and displayed on the desktop when i access the server as the same user?
note: bare in mind that i need to deploy it to several servers so i can't install several
agents via ZIP File.
So I found kind of a work-around to solve this problem,
I created a schedule task in windows that will run my batch.
when creating this task you need to set those settings:
1.) Run as: the user name that TeamCity is logging in.
2.) check the Run only if logged on check box.
3.) in the security tab give the user you use full permitions.
In order to run the schedule task you need to run this batch script:
Schtasks.exe /Run /TN name_of_schedule_task

How to run selenium server in the background using windows batch script in Jenkins?

I am running protractor tests on a server machine through Jenkins. I need to start the selenium web driver before running the tests. i.e. "webdriver-manager start" and run the tests while the server is running and shut it down once tests are run. How do I do this using batch script?
I am using start, cmd commands in the batch file to achieve it but once the selenium server starts, I am unable to go back to the prompt unless I stop it.
How to I make it run in the background by staying in the same command prompt window rather than opening up the new command prompt window selenium server starts?
you should run webdriver-manager start as shell script.
Make sure
1 - Node.js installed on jenkins
2 - provide correct path to webdriver-manager

Resources