Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
765 views
in Technique[技术] by (71.8m points)

testing - How to run GUI tests on a jenkins windows slave without remote desktop connection?

I have a jenkins agent set up on window 7 and a jenkins server on Linux. I am running GUI testing on the windows agent. It runs fine if I have a remote desktop connection connected to it, but fails otherwise. I found this link, Jenkins on Windows and GUI Tests without RDC

But the solution provided there is pretty vague.. It seems like the only solution is to somehow make Jenkins server to have a remote desktop connection open at all times. But I can't find such an option to do so. Could anyone please clearly teach me how to solve this issue?

Much appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your slave machines have to be at a desktop before the test can run properly. We had the same problem.

Solution was to have the test machine start up and auto-logon to the desktop. To ensure that the test would ONLY start after the desktop was available, we added a scheduled task, set to run at user login, that would launch the Jenkins slave via Java Web Start. That way, Jenkins would only see the slave once the desktop was running. After that, everything worked fine.

This is the winning answer to the question you linked to and it is very clear on what to do. The whole setup is outside of Jenkins. Jason Swager discribed on how he automated a user logging into a windows desktop machine and then starting the Jenkins slave in the user session.

And now Step by step:

1. make sure you have a GUI evailable

Solution was to have the test machine start up and auto-logon to the desktop

Configure a standard Windows desktop to login a specific user automatically when windows start. This way nobody needs to physically log into the desktop. (see How to turn on automatic logon in Windows 7)

2. start Jenkins slave

You need to start the Jenkins slave within this user setting. Otherwise, the Jenkins slave won't have access to the Windows UI components (or in other words can not interact with the desktop).

To ensure that the test would ONLY start after the desktop was available, we added a scheduled task, set to run at user login, that would launch the Jenkins slave via Java Web Start.

So you have to create a scheduled task and configure it to start your Jenkins client using Java Web Start.

3. use it

That way, Jenkins would only see the slave once the desktop was running. After that, everything worked fine.

When the slave is online, you can use it to run your UI tests.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...