⬆️ ⬇️

How to visually automate game testing using the AutoIt3 language: preview

The topic considers the possibility of automating the testing of a game under Windows, which is closed, has non-standard controls and is recognized by special tools as a window, using the Sapper’s example using the AutoIt scripting language. It also explores the interest of readers to the topic of game automation. It will be interesting to know your opinion.





To my past topics I received comments about a lot of water in the article, given the experience, there will be little water in this. Let's start.



Among the methods of visual automation, I highlight:

1. Mouse simulation

2. Keyboard simulation

3. Heshum graphic area

4. OCR

5. Image search by mask in the graphics area.

6. Work with pixels

7. Work with application memory

')

Describe everything now I do not see the point. For a start, I want to see interest in the topic from readers and participants of the habr.



test case:


Opening a cell

1. Start the game

2. Click on the hidden field

3. Get the result

4. Compare the result with the expected



Script Algorithm:


I launch the sapper, if I start I turn to the next line, if not, I create a screenshot with the launch error in the script folder.

I compare the pixelCheckSum function with the sum of the game graphic area with the mask-constant, if the amounts are not equal, then I create a screenshot with the launch error in the script folder.

I calculate randomly x, y coordinates

I keep the color of the pixel coordinates x, y

I click the mouse on the x, y coordinates of the playing field

I compare the change in the color of the x, y pixel with the old value, if it has not changed, then I create a screenshot with the launch error in the script folder.

The end.



The script is not perfect, it does not take into account a lot of factors, but still it allows you to check the basic functionality of Minesweeper.







Download Minesweeper win7 + compiled script

Download script source

Source: https://habr.com/ru/post/107104/



All Articles