Situation in short:
- Virtual Machine with Visual Studio 2013 installed. PowerShell script runs on the VM to execute Get Latest, Build and Execute Coded UI Tests. Windows Scheduled Task to execute PowerShell nightly.
- auto-logon is enabled (or I'm doing something wrong?)
- yes, I've read post Is it possible to run Coded UI tests without having to connect via remote desktop?
- I've seen posts about TCM. Does this help and how can I use it in my situation?
I made some tests in Microsoft Test Manager and I also executed and recorded them. I've loaded these tests in a test project (and changed the script providing categories and custom checks). I then categorized these (as Development or Acceptance). I executed out using a PowerShell script on a VM (with Visual Studio 2013 installed) with following actions:
- Get Latest
- Build
- Run latest build with a selected set aka category using mstest.exe
So far everything is going perfectly. All the tests pass. However, when I create a Scheduled Task on my VM run the PowerShell script everything fails because of a missing session. Do I have the VM (I have no knowledge of Virtual Machines) then unlock or something?
Side-Note: I also tried to fix this with a Test Agent and Controller, but once I had installed these, all other users of TFS lost their rights, so I prefer not to do this again.
I would be very grateful if you know something that can solve this. I spent hours on Google finding a solution for this issue, but no solution helped me.
Do I need to provide more information?
The problem you're seeming to have is that the testagent is not setup correctly. You need an active desktop session for Coded UI to be able to run (it needs it to perform all the actions such as clicks).
Microsoft has some nice info about setting up your test agent here.
But to tackle your exact problem of the test failing because of a missing session I'd suggest the following: