GUI Unit Testing in AppVeyor?

trevor.linton's Avatar

trevor.linton

11 Nov, 2014 11:23 PM

Hi,

I'm using Appveyor (which is amazing work BTW), and my application successfully builds, it then launches a set of unit tests that simulate keyboard, mouse move, etc at the OS level while the window is open (for testing). Since the unit tests are capable of getting access to individual controls its able to know exactly the X/Y coordinates and everything works fine across win7/8.1.

However when I run them on AppVeyor, everything succeeds until it reaches a point where it needs to mimic input (keyboard/mouse events), I say mimic, but that's sort of not true, its really moving the cursor and causing events to bubble from the OS down to the App.

Anyrate, the unit tests timeout, I then decided to see if I could take a screen shot, assuming there might be some sort of diagnostic window or perhaps a "startup" application in the way. When I did this I received an error:

Error: System.ComponentModel.Win32Exception The handle is invalid
1070 at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
1071 at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize)
1072 at target.(anonymous function) [as CopyFromScreen] (Bridge.js:142:35)
1073 at Object.takeSnapshotOfActiveScreen (C:\projects\tint2\test\tools\utilities.js:432:17)
1074 at null._onTimeout (C:\projects\tint2\test\tools\utilities.js:532:18)
1075 at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

After a little digging it turns out that these errors are due to the users session being "locked". I've tried the advice i've seen online of "net user %USERNAME% /ACTIVE:YES" however it didn't unlock the window, neither did rundll32.exe user32.dll,UnlockWorkstation. Other options didn't seem realistic or very... uhm... "unethical".

SO TO MY QUESTION:
I'm curious if AppVeyor supports GUI unit testing or if the VM's can be configured to auto-logon when started.

Thanks,
Trevor

  1. Support Staff 1 Posted by Feodor Fitsner on 11 Nov, 2014 11:31 PM

    Feodor Fitsner's Avatar

    Hi Trevor,

    Thanks for trying out AppVeyor!

    I think this is because AppVeyor Build Agent runs as a non-interactive service without an access to user desktop session. I guess you were running your tests on default build worker image.

    However, we have Unstable worker image with logged in user, desktop and interactive build agent. You can choose the image on Environment tab of project settings or if you use appveyor.yml:

    os: unstable
    

    Give it a try and let me know about the results.

  2. 2 Posted by trevor.linton on 12 Nov, 2014 12:25 AM

    trevor.linton's Avatar
  3. 3 Posted by trevor.linton on 12 Nov, 2014 12:43 AM

    trevor.linton's Avatar

    Nevermind! The timeout seems to be still an issue but the screenshot returned an error unrelated to the platform, most likely a WPF to WinForms class mixup.

    I'll attach any information if there's further problems. Thanks for the help!

  4. Support Staff 4 Posted by Feodor Fitsner on 12 Nov, 2014 12:58 AM

    Feodor Fitsner's Avatar

    Sure, let me know about results.

    -Feodor

  5. 5 Posted by trevor.linton on 12 Nov, 2014 02:08 AM

    trevor.linton's Avatar

    Hi Feodor,

    I have it successfully working now, the issue with the unit tests timing out was due to an application running on the desktop (that just says) "AppVeyor is Running" (see attached screenshot).

    The unit tests I wrote assumed an empty desktop and as I previously thought when the app loads the mouse clicks initially hit onto the wrong area.

  6. Support Staff 6 Posted by Feodor Fitsner on 12 Nov, 2014 02:31 AM

    Feodor Fitsner's Avatar

    Looks nice! :)

    It seems we should made the window hidden by default.

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:50 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM