UI tests fail when run from TeamCity

Ask general questions here.
simmisj
Posts: 19
Joined: Tue Feb 27, 2018 10:12 am

UI tests fail when run from TeamCity

Post by simmisj » Mon Apr 30, 2018 9:47 am

Hi.
I have some test cases that do not use any UI and then a few that do use UI. When I run the tests from the machine, either through ranorex studio or simply double clicking the .exe that is generated, then everything runs fine. Then when I use TeamCity to build the code from BitBucket, deploy it to the test machine, and eventually run the .exe file then the UI tests fail with a message saying that the UI element was not found.

Is there some limitation when using TeamCity to run UI tests?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: UI tests fail when run from TeamCity

Post by odklizec » Mon Apr 30, 2018 10:25 am

Hi,

Are you sure the test exe is started with enough privileges (administrator)?
Are you sure the TeamCity agent is started as standard windows user and not as service? In case you see black screenshots in report in report, exe is not started as standard windows user.
Have you tried to start (manually) the exe file deployed by TeamCity?
Also, make sure the Ranorex settings are the same on both local and team city VM! Different settings are most common cause of different results ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

simmisj
Posts: 19
Joined: Tue Feb 27, 2018 10:12 am

Re: UI tests fail when run from TeamCity

Post by simmisj » Mon Apr 30, 2018 11:15 am

I have successfully manually started the .exe file and that works fine.
The screenshots are just blank so maybe the issue is with the agent being started as a service. I will change that and see if that fixes it.

simmisj
Posts: 19
Joined: Tue Feb 27, 2018 10:12 am

Re: UI tests fail when run from TeamCity

Post by simmisj » Mon Apr 30, 2018 11:50 am

I have changed the service to use an elevated user account but it still just shows blank screenshots and fails with this error: "Failed to find item 'KeyingClientAutoTestsRepository.AuthenticationForm.Username'.
No element found for path '/form[@controlname='AuthenticationForm']/container[@controlname='_groupLogin']//text[@accessiblename='Username:']' within 1m. "

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: UI tests fail when run from TeamCity

Post by odklizec » Mon Apr 30, 2018 12:04 pm

Hi,

Blank screenshot means, that the test has no access to UI. In other words, the TeamCity agent is most probably still running as a service. Are you sure you followed the steps for Team City Build agent?...
https://www.ranorex.com/blog/integratin ... ess/#agent
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

simmisj
Posts: 19
Joined: Tue Feb 27, 2018 10:12 am

Re: UI tests fail when run from TeamCity

Post by simmisj » Mon Apr 30, 2018 2:03 pm

Yeah. I do exactly like it says on that webpage.
I run it in administrator mode and start it myself using "agent start" but still it has the screenshots blank.

Also. When I am logged in myself and run the tests from TeamCity then it works pretty well. I simply keep the session open and do nothing.
But if I log out of the auto test server and run the tests from TeamCity then it fails with an error indicating "Failed to find item 'KeyingClientAutoTestsRepository.KeyingForm.Tabs.Text'.
No element found for path 'tabpagelist[@controlname='tabs']/tabpage[@controlname='keyingPageTab']/container[@controlname='mainPanel']/element[@controlname='ControlStack']/?/?/element[@controlname='ControlStack']//text[@accessiblerole='Text']' within 1m. "

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: UI tests fail when run from TeamCity

Post by odklizec » Mon Apr 30, 2018 2:08 pm

Ah yes, you must keep the session open! Ranorex cannot work with closed session. Closing or even minimizing remote desktop kills the session. Check for example this post, with some suggestions how to keep the session open... https://www.ranorex.com/forum/ranorex-s ... tml#p40652
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

simmisj
Posts: 19
Joined: Tue Feb 27, 2018 10:12 am

Re: UI tests fail when run from TeamCity

Post by simmisj » Tue May 01, 2018 10:17 am

Absolutely right.
I managed to use tscon.exe to achive what I wanted.
Thanks.