📜 ⬆️ ⬇️

Automate automated testing or the power of batch files

- Why are not you working?
- It is tested

Hi, Habroliudi.

I decided to share with you my experience on a tautological topic - automated test automation. As we all know, in order not to waste time on regression tests, smart testers came up with sometime to use something other than hands to run tests.
But I wanted to automate the full cycle, that is, from the beginning of the tests to the results. So…


Automate the cyclic testing of applications on different operating systems without human intervention.


There is a software product, new versions of which are being actively developed. Therefore, the need for regression testing is obvious. Multiplatform product - you need to test on different operating systems.

In the "iron" plan - there are 5 test computers, 1 server, 1 FTP server - all this is affectionately called a "test farm". The difficulty in my case was that it was all 2,000 kilometers away from me, and access was only via RDP and KVM.

In software, the application under test is written with Qt and Squish is selected for testing. Acronis Snap Deploy is used to install different operating systems on test computers.


There are scripts that directly test the application. You need to run them, get results, change OS, run, get results, and so on in the loop. In the end, it would be nice to format these results somehow.

How do I automatically install the system image on the target computer using Acronis Snap Deploy? To install the image in more automatic mode, we need to restart the target computer when it hits the PXE server (computers must be configured to boot from the network card first), select PE Media. A PE environment is loaded in which you can locally run a system image warmly. The PE environment must be prepared in advance, that is, the Aronis Snap Deploy Command Line command line utility (asdcmd.exe) and the psexesvc.exe service are built and nested into it, inserted into Acronis PXE Server and set to the default boot.
How are we going to run spripts? On the server of the test farm (further it will be only about it) according to the schedule there will be launched a .bat file, which will run the scripts.

So the chain in which all the force of .bat files and psexec in particular is revealed is:
At a certain time, a .bat file is launched that calls the required system on the target computer:

net start AcronisPXE.exe
psexec \\ compIP reboot
ping compIP
ping compIP
net stop AcronisPXE.exe
psexec \\ compIP asdcmd /deploy [param]

Next, we wait while the image is deployed. To do this, we need to advance in each image (they need to be created all the same) in a file, for example, ready.txt. We check when the file becomes available, which indicates the end of the deployment:

psexec \\compIP cmd
if exist ready.txt (
goto do
) else ( ping compIP)
do scripts.bat

Thus, after installing the image, we begin testing. The scripts.bat file starts the Squish installation, tests, generates the results, sends them, and so on. In the end, he calls our batch file, which repeats it all again. So that the process is not cyclical, you can control it in different ways, for example, a simple counter.


This solution allows us to double-click on Banik to launch the whole process of multiplatform automated testing.

Also, I don’t think that this is a very non-trivial task, and I think there should be some simpler solutions to this problem. Now I dig towards Altiris.

Thank you all for taking the time to read this opus.

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

All Articles