1

Anyone have any experience using Pywinauto with Azure Pipelines?

We're currently, using Azure DevOps/Pipeline, Pytest, and Pywinauto with the goal of to test the application UI by running the tests that was created with python/pywinauto in our Azure Pipeline.

The python/pywinauto tests run perfectly fine when the tests are ran locally with a 100% pass.

When the pipeline runs, the step that tests the application with our created python/pywinauto tests will fail with a "TimeoutError."

=========================== short test summary info ===========================
ERROR test_AppFrame.py::test_imageCapture - pywinauto.timings.TimeoutError
ERROR test_AppFrame.py::test_captureMultipleImages - pywinauto.timings.Tim...
ERROR test_AppFrame.py::test_imageCaptureFalseFail - pywinauto.timings.Tim...
ERROR test_AppFrame.py::test_imageBookmarks - pywinauto.timings.TimeoutError
ERROR test_AppFrame.py::test_imagesFromMultipleExams - pywinauto.timings.T...
ERROR test_AppFreeze.py::test_freezeImage - pywinauto.timings.TimeoutError
ERROR test_AppFreeze.py::test_freezeImageFalseFail - pywinauto.timings.Tim...
ERROR test_AppRecord.py::test_recordMP4 - pywinauto.timings.TimeoutError
ERROR test_AppRecord.py::test_recordCompound - pywinauto.timings.TimeoutError
ERROR test_AppRecord.py::test_captureMultipleSameLengthRecordings - pywina...
ERROR test_AppRecord.py::test_captureVariousLengthRecordings - pywinauto.t...
ERROR test_AppRecord.py::test_recordFalseFail - pywinauto.timings.TimeoutE...
ERROR test_AppRecord.py::test_RecordMultipleExams - pywinauto.timings.Time...

Is it a problem with the pipeline and how pywinauto requires an actual screen/monitor?

Thanks for the help!

K. Ngwin
  • 31
  • 3
  • I would recommend to start from this: https://pywinauto.readthedocs.io/en/latest/remote_execution.html I had no personal experience with Azure pipelines, but pywinauto tests run on AppVeyor CI fine. – Vasily Ryabov Aug 31 '22 at 07:29
  • thanks @VasilyRyabov! i'll check that out! if you don't mind sharing, are you running that self-hosted? – K. Ngwin Aug 31 '22 at 22:48
  • No, AppVeyor CI tests for pywinauto run on standard AppVeyor machines. See https://github.com/pywinauto/pywinauto/blob/atspi/appveyor.yml Probably AppVeyor provides active desktop for any tests by default. I would read Azure documentation about it first. – Vasily Ryabov Sep 01 '22 at 12:18
  • I think you need "Visible UI mode", the second option here: https://learn.microsoft.com/en-us/azure/devops/pipelines/test/ui-testing-considerations?view=azure-devops&tabs=mstest – Vasily Ryabov Sep 01 '22 at 12:21
  • Comments in this thread may be useful: https://stackoverflow.com/q/64498434/3648361 – Vasily Ryabov Sep 01 '22 at 12:22

1 Answers1

0

I tried couple of things and it works on my case: Since I have Pywinauto + python selenium(combined script) to test Windows application and see their status in Firefox status page.

  1. First, make your test machine available on Azure DevOps by creating self-Hosted agent. Use this link how to create: https://azureops.org/articles/azure-devops-self-hosted-agent/

  2. Once your Agent is created add it to agent pools, get there through project setting>>Agent pools(under Pipelines tab)

  3. Install all your python packages, for example python, pywinauto, selenium, selenium Firefox, Pandas, what is needed, all in your test machine manually.

4.Now let's create pipelines in Azure...

  • Create 'New pipeline'
  • Click on 'Use the classic edtior' option
  • select your repository, azure repo git or gitHub.
  • Select empty job and change your pipeline Agent pool to "your self-hosted agent pool"
  • Add tasks, start with python script and give a File Path. We don't need python version here, since we already installed that on local machine.
  • Add other reporting task that you needed..
  • Save and run.. it will workenter image description here

I hope this will help. Happy Automation :)

sushil
  • 1
  • 1
  • ok it makes sense. I will remove my comment not to make too much mess in the answer. I will remove this one also in 24 hours. – fascynacja May 10 '23 at 06:16