microsoft / WinAppDriver

Windows Application Driver
MIT License
3.67k stars 1.4k forks source link

Need inputs about WinAppDriver #1455

Open praveenvinnakota opened 3 years ago

praveenvinnakota commented 3 years ago

Hi,

I am trying to automate WPF desktop application with WinAppDriver using java language binding. Able to recognize the controls, but while executing the script, some times the script is failing with out any reason, even though the element is present in application, it says element could not be found. But when I run the script again, it runs very smooth.

Just wanted to know the feedback of WinAppDriver users during this initial stages of automation: _1. Is the performance good when huge number of scripts are executed?

  1. Will Microsoft give support for WinAppDriver in future? bit worried if it is similar to CodedUI/White Framework etc which are not supported now._

Please share your valuable ideas and thoughts on this topic.

Thanks in advance, Praveen.

trashbat commented 3 years ago

We run a large number of WinAppDriver tests on a Jenkins node, it's running them pretty much constantly. We restart winappdriver.exe at the beginning of every job, the shortest test is about 2 minutes and the longest job takes about 5 hours. So far (~18 months of this) the tests have been pretty consistent when running them on the server. I archive detailed logs and screenshots of failing jobs, and it's almost always the application under test that's at fault. The only consistent error that springs to mind is that it regularly fails to find the application window on launch, so I have to fall back to a desktop session which adds some time to each run.

When developing and running the tests on my work computer though, I find that I have to make sure that I've closed every desktop window possible apart from my IDE. Some application windows (e.g. Spotify, Windows Event Viewer) have a seriously detrimental effect on performance, so for example WinAppDriver will spend about a minute trying to find the context menu from a desktop session and then give up, when the same operation takes ~1s after closing Spotify or Event Viewer or whatever.

pzgrenadier commented 3 years ago

@trashbat , Do you mind me asking do you managed to get code coverage from the tests? If so, would you mind sharing how it is achieved? We've been having trouble that the only code coverage we can get is on the testing code instead of production code when using WinAppDriver.

trashbat commented 3 years ago

@pzgrenadier I don't know how I'd go about getting code coverage data from the production code either, sorry.

Tree55Topz commented 3 years ago

@praveenvinnakota your first comment about sometimes the tests failing because it cant find an element is a common thing when building an automated testing solution. If it fails sometimes, passes other times, this normally implies that you need to improve the stability of your automation code, does not have anything to do with WinAppDriver. For instance, I wrote a WaitForObject method that catches errors like these and retries to find elements when an exception is caught. On to the other questions

  1. This does not impact WinAppDriver. There might be faster automation tools out there, but WinAppDriver in my experience comes close.
  2. This confuses me as WinAppDriver is a Microsoft tool. Unless you mean actual customer support which in that case I have no idea. This forum is a great place to solve issues though.
Wolfe1 commented 3 years ago

@trashbat A bit of a sidebar but what code or process did you use to make sure that your jenkins node had an open RDP connection during the test execution? It seems that running it in jenkins without an open RDP session gets us a lot of errors.

trashbat commented 3 years ago

@Wolfe1 Sorry, I missed your question.

Our Jenkins test node is a physical machine in the office, with screensaver and power saving mode etc. disabled. The monitor is switched off. We use VNC to connect to it and check what it's running, RDP caused us all kinds of problems. Typically I connect to it in a view-only session unless I need to intervene.