1

Setup:

  1. Master is on Windows VM "A"
  2. Slave is on Windows VM "B"
  3. Slave connects to master using java -jar agent.jar -jnlpUrl http://path/to/this/slave-agent.jnlp -secret thisisasecret -workDir "C:\my-work-dir"
  4. The Jenkins Job executes a batch command. The command runs Nunit console, which executes selenium tests

The Job that I'm executing is a selenium script, which opens a chrome instance on "B"

This is what I'm doing when it works:

  1. Log into "B" using windows RDP
  2. Open jenkins and trigger the selenium Job
  3. I can see the Job executing on "B" and completes with no issues in about 4 minutes

This is when it DOES NOT work:

  1. I DO NOT log into "B"
  2. Open jenkins and trigger the selenium Job
  3. Jenkins interface shows that the Job is executing but it runs indefinitely

Now if I log into "B" while the job is still running, as soon as I log in, I can see the chromedriver cmd appear and a chrome instance is brought up and the job is run and completes with no issues.

Does anybody know what could be causing this? Thanks!

alex
  • 11
  • 1
  • THis is likely a jenkins specific issue. Is the jenkins job set up to only run as the user? And not as a windows service? – DMart Mar 25 '20 at 16:20
  • @DMart It is running as a user and not as a service. It works when I run it as a service but my scripts break if I run it as a service(page elements not found) and since windows does not allow interacting with the desktop, can't see what's going on. – alex Mar 25 '20 at 16:46

1 Answers1

0

We had tests that passed only when I was logged on the machine. Turned out that the test needed interactive desktop. In order to keep the session, you can make a bat file that you can use when you logout of the machine in order to keep the session interactive.

tscon %sessionname% /dest:console

Reference:
https://www.automatetheplanet.com/visual-studio-test-agents-cleaning-scripts/

Community
  • 1
  • 1
K. B.
  • 3,342
  • 3
  • 19
  • 32