I have a Windows 10 Pro VM, that I want to run a Localhost Katalon Agent on.
I have it running successfully, but I would like for it to start when the computer starts.
Right now, I have it running by putting a Shortcut in the Startup folder. But this only gets triggered if someone logs into the machine.
How do I get the Agent to start when windows startup, even if no one logs in?
Come to find out. the Katalon Agent comes with NSSM. I was able to use that to create a Service using these instructions: https://stackoverflow.com/a/26626771/4739712
Related
I've a Windows Server 2012 R2 based Hyper-V Host, which contains a Windows Server 2012 R2 VM as a VPN using RRAS and another VM running Debian plus the Jenkins (latest version) master server. Using this VPN, a private hosted Windows Server 2012 R2 VM act as Jenkins slave using those VPN connection. For better distinction, call this one node1.
This is bascially working as expected, but there is a problem: Sometimes, when I start a buildjob on node1, it hangs. Only the first 2 steps (Started through user XYZ and Build on slave node1 in workspace C:\jenkins are shown in the log, then nothing happens. On the master, the node1 is shown as online and is connected to the VPN.
Currently I start Jenkins using a windows task. Using this method, the above happens only sometimes. But as I configured the server, I tried to solve this in a cleaner way by registering Jenkins as Windows Service. As Windows Service, I had the same behavior: In the web panel Node1 is shown as online, but when I start a job on it I only come to Build on slave node1 and then it stops.
Normally the next step should be fetching the latest source code from my git repo. I already had the problem but now found out that it has something to do how Jenkins is started. But for me it seems very strange because running the slave as a Windows Service hasn't worked at least one time, and by running it as a Task it works most of the time.
I only found out that the problem also occurs when I start a job directly after node1 boots. When I then cancel the hanging Job and start it again, it seems to work for a while.
There are few options that I can think of them. According to Jenkins Wiki
If the slave is supposed to start desktop applications you have to
allow the service to interact with the desktop
(Action->Properties->Logon->Allow service to interact with desktop).
Another option can be that Windows services don't have the ability to interact with the windows desktop, meaning that some UI tests might no work as you expect. Do any of the steps may need interacting with the desktop (Windows GUI)?
Just for the sports how about to setup a temporary clean windows server to act as node2 (Jenkins slave) and to check if the problem is been reproduced?
I am using a RDC Connection from my mac to connect to an application (on windows box) in client network. Is that possible to write a script which does the following:
Open ur RDC. (i am using CoRD for this where my VM credentials are saved in .rdp files.
Login to VM with valid credentials from your .rdp file.
Open your app on that VM (for ex: IE explorer)
Following code in my shell script will connect me to my VM.(First two steps are working)
open rdp://[username[:password]#]hostname
How should I automate third step?
Is there any other way than shell script?
If you install Jenkins on your Mac, then install the Jenkins slave agent on the Windows machine, you can remotely run any command you like on the Windows box via the Jenkins web UI, and get back the results as well. In that scenario there's no need to use RDC at all.
For some more background, see: https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
This might be a simplistic answer, but AutoHotKey is something that will automate your 3rd step. Its free and pretty easy to script. You can have this in your start up routine for your VM, so when you log in, you can have this kick off your job.
I have used it before for testing some Java Swing components on Windows and its been pretty handy (Windows was running on a Virtualbox VM on my Mac).
Im working with VS2010 and TFS and the Coded UI tests (CUIT).
I created some CUIT and added them to several Test Cases in Microsoft Test Manager 2010.
These tests are executed in our build-deploy-test steps.
This looks as follows (simplified):
Build application
Deploy
2a. Set snapshot of the Virtual Machine to which the application will be deployed to the snapshot in which the application is not installed
2b. Install application
Run tests
Step 3 contains Coded UI tests, but they cannot be executed (will fail), since there is no active remote desktop connection, which they need to be executed.
Now I would like to add a build step 2c. That automatically connects to the Remote Desktop so that the Coded UI Tests kan be executed.
How should I create this step in the Process Template?
I attempted this myself by running a PowerShell script to connect to a machine via Remote Desktop (see here to see how to use the Remote Desktop command-line utility).
This didn't really work for me personally because I was running this script from the build machine - which I could only connect to via Remote Desktop - and so when I close Remote Desktop it would close the session on the build machine and thus I would not be able to obtain a remote desktop connection with my test environment (plus it wasn't ideal to have to launch Remote Desktop from the build machine).
Therefore, the solution I went with instead was to enable auto-logon on the test environment (there are various ways to do this, I can't remember how I did it, but it's easily Googled).
So in my PowerShell script, which launched from our build machine, I used a command to remotely restart the test environment. With auto-logon enabled, the test environment would start back up with an active session, then I could carry on with Visual Studio Coded UI testing. This worked for me without any issues.
The command I used was something like this:
Shutdown.exe /r \\mytestenvironment
Here is some documentation for it.. If you intend on using this command to remotely restart a computer, don't forget to give your machine permissions on the test environment, otherwise this command won't work.
I then launched a command to sleep for a few minutes, to give time for the remote test environment to start back up again (with an active session), then I launched the tests.
Personally, I used a PowerShell script but you could also use a DOS/Batch script if you are more familiar with that.
Also, are you trying to run the automated tests as part of a build process template?
Let me know if you need any further help.
I'm trying to run UI-tests (written using white). When I run them using NUnitConsole everything works fine. When I try to run them using TeamCity I get the following exception Test(s) failed. White.Core.UIItems.UIActionException : Couldn't find window with title Form1 in process 4132, after waiting for 5000 ms. What might be wrong? What could I do to make the test pass?
Not only does the build agent need to be set to interact with the desktop, but the desktop must be displayed in order for UI automation to work - desktop cannot be locked and screen saver must not be running. Is your agent on a headless machine? If you are using RDP to connect to the agent to check on things, when you close RDP, it locks the desktop. In this case, the automation will fail. Instead of using RDP, use a VNC viewer to log on to the box, rather than RDP, as VNC will not lock the desktop when you close it.
Another issue to consider is network access. If you are running TC agent as a service with access to desktop, then it will be running under service account which will not have access to network shares, etc... If this is a probelm, then you will not be able to run TC agent as a service, and will instead need to logon with a domain user and kick off the agent.bat file to start the agent.
Spent a lot of time solving this issue.
Main steps:
You need separate computer with teamcity build agend installed on it. Computer should have monitor and mouse.
The agent SHOULD NOT be launched and run as a Windows service (disable it if needed).
You should launch TeamCity build agent from .bat file (as administrator). To do this go to TeamCityBuildAgentfolder\bin and launch agent.bat file with start argument
Disable computer's screen sleep/lock after certain period of time. Your tests will require desktop for UI manipulations.
If you done everything right you should be able to see your build agent active in TeamCity's "Agents" menu.
You can also automate TeamCity agent launch (at selected user's logon):
Automate user's logon. More instructions here
Create task in Task Scheduler which will launch build agent at user's logon with administrative rights (with highest privileges)
Make sure that the user who will logon automatically has all neccessary permissions (run the scripts, perform file operations etc.)
IMPORTANT!
Running UI tests in such way is a potential security hole so make sure that the non-authorized people have no acccess to computer that runs this tests.
Remember that for running your UI test the computer SHOULD NOT be locked or be in sleep mode.
You probably have to make the Teamcity build agent interact with desktop.
Run -> services.msc -> Select TeamCity Build agent and right click -> Properties -> Log On tab -> Check "Allow service to interact with desktop"
Edit:
If that doesn't work, stop the agent service, go to Build Agent folder ( c:\teamcity\buildagent\bin ? ) and issue agent.bat start and then trigger the tests.
There is recommendation to run the UI tests on virtual machines.
Seems as most reliable solution.
I'm trying to run Watin from within a TeamCity build, using nUnit.
All tests run fine locally. I know you cannot run the full Watin tests (i.e. POST) from TeamCity if it is running as a Windows Service. You must start the build agent from a .bat file.
But, I don't want to have to login to the server for it to start.
I've tried getting a Scheduled Task (in Windows Server 2008) to fire the agent.bat file on StartUp (not Login), but with no luck.
Has anyone else got Watin/TeamCity running from a Scheduled Task?
Thanks,
Pete
Check out the solution to doing this using CC.NET.
Watin Tests fail on CC.Net
Brett and I worked on this for awhile. The problem is that Windows Services running as a user cannot interact with the desktop, but because WatiN runs a real instance of the browser it requires a desktop to interact with. The solution in the link provided can show you how to do this.