Archive

Posts Tagged ‘Samples’

RoutineBot – Simple Interface Test Automation Samples

February 21st, 2009

There are few simple interface testing samples available in setup package. For details check \Samples\ directory of installation folder.

More script samples are available in the online help for RoutineBot sytax.

Please note: these tests contains some system-specific information such as fixed paths to script files and screen samples of WinCalc, which might also be different on your system. If you will install RoutineBot in the “C:\program files\RoutineBot\” folder and you are running WinXP then scripts most likely will be executed normally.

Test batch file

In the samples folder we have placed a batch file which allows to automate testing with many scripts. Here it is:

@echo off
CLS

echo ————————–
echo Test 1 – Multiply values
call calc-button-click.bat
echo Test 1 result:
type res1.txt
echo ————————–

echo Test 2 – Summarize values
call calc-test.bat
echo Test 2 result:
type res2.txt
echo ————————–

pause

once quality assurance engineer run this file, the scripts will be executed one by one, here is what should be outputted:

Calc Button Click Test

This test will run Windows calculator and click there some buttons to multiply two numbers. Then it will check if result is what was expected and will close with “passed” message. Check the list commands supported in RoutineBot.

  • You can check the content of the script by unzipping calc-button-click.zip file.

The script text is:

Execute(‘C:\WINDOWS\system32\calc.exe’);
MouseFocuse(‘2button.bmp’,10000);
MouseClick;
MouseFocuse(‘multbutton.bmp’,10000);
MouseClick;
MouseFocuse(‘5button.bmp’,10000);
MouseClick;
MouseFocuse(‘equalbutton.bmp’,10000);
MouseClick;
MouseFocuse(‘multresult.bmp’,10000);
KillProcess(‘C:\WINDOWS\system32\calc.exe’);

  1. The script runs run cacl.exe
  2. The script searches for the image of “2″ button and clicks this button
  3. The script searches for the image of “*” button and clicks this button
  4. The script searches for the image of “5″ button and clicks this button.
  5. The script searches for the image of “=” button and clicks this button.
  6. The script searches for the resulted image, if found – execution successful if not found then execution failed.
  7. The script kills the calc.exe process.

To execute this script you should pass its name as a parameter to the Interpreter.exe. RoutineBot can generate the batch file with necessary parameters automatically, here is how the calc-button-click.bat looks like:

The most important are script name “calc-button-click.zip” and the -messagefile (which is res1.txt for this script) values.

Other samples

  • Share/Bookmark

admin Samples ,

Start testing GUI with RoutineBot in just few minutes

February 21st, 2009

This is a short step by step guide on how to start using RoutineBot for GUI testing purposes. We will show how to run the program that you want to test, how to perform simple actions with it and how to check if results are what you except them to be. Finally, we will log necessary information into the text file.

  • Starting version 3.0 RoutineBot supports automated scripts recording, so it simplifies the creation of first script, recording user’s activity basing on snap-shots or mouse movement. Learn more about recording of scripts.

If you have a question, you can check our FAQ section. There are some common questions listed.

Step 1. Run RoutineBot

RoutineBot Icon
First run RoutineBot. You will see then two tabs “Select sample” and “Script”. Right now we need to go to the “Script” tab.

Step 2. Run the program you want to test

You will see then two tags "Select sample" and "Script". First run RoutineBot. You will see then two tags “Select sample” and “Script”. Right now we need to go to the “Script” tag.
Click "Add action button" Click “Add action button”.
Select "Execute" action in the "Action" drop list. Select “Execute” action in the “Action” drop list.
Enter the full path to Windows Calculator. Enter the full path to Windows Calculator.
Press "OK" button to add the action into your script. Press “OK” button to add the action into your script.

In the script editor it will be: Execute(‘C:\Windows\System32\calc.exe’);

Step 3. Taking pictures and making script

Click "Run script" button. The program will execute the script. Click “Run script” button. The program will execute the script.

The only command we now have in the scrip is executing WinCalc, so it will do this.

Go to "Select sample" tag and click "Make snapshot" button. Go to “Select sample” tag and click “Make snapshot” button.
You will have 5 seconds to switch to WinCalc and move the mouse across the Calculator window. You will have 5 seconds to switch to WinCalc and move the mouse across the Calculator window.

You can re-try if necessary by clicking “Make snapshot” button again.

It is now time to crop the image. It is now time to crop the image. Move mouse to the image and select the region that you need. For this example, I will use the image with “2″ button.
Click "Save sample" to save the sample image into the library of the project. Click “Save sample” to save the sample image into the library of the project.
Enter some meaningful name of the image to save and some comment if you need it. Click OK button. Enter some meaningful name of the image to save and some comment if you need it. Click OK button.
Then, it is time to assign some action to the created image. Then, it is time to assign some action to the created image. Click “Select action” button.
Select "MouseFocuse" action from the list (actually, by default it will already be selected). Select “MouseFocuse” action from the list (actually, by default it will already be selected).
Select image sample to act on. Select image sample to act on. By default it will be the last taken screen. So most likely, you will not need to change anything.
Click "OK" button. Click “OK” button.

Step 4. Adding some testing functionality

Again, click "Add action button" Again, click “Add action button”.
Select in the action drop list the "MouseClick" button. Select in the action drop list the “MouseClick” button.
Now click "Run script" button to see what the RoutineBot will do. Now click “Run script” button to see what the RoutineBot will do. It should run the WinCalc.exe, then move mouse to the “2″ button and then click on it.
Now go to the "Select sample" tag, click "Make snapshot" button and do a snapshot of results window in WinCalc. Now go to the “Select sample” tag, click “Make snapshot” button and do a snapshot of results window in WinCalc.
Then crop it as shown on the screenshot. Then crop it as shown on the screenshot.
Click "Save sample" button and save the image under "2_res" name. Click “Save sample” button and save the image under “2_res” name.
Click "Select action" button. Click “Select action” button.
Select "MouseFocuse" action Select “MouseFocuse” action.
Click OK. Click OK.
Here is the script text. We will modify it a little to save results to log file Here is the script text. We will modify it a little to save results to log file.

Step 5. Modified script

Here is how modified script looks like.
We have added:

  • Res:= …. , if the program will find the image 2_res.bmp, then it will return 1, if  not it will return 0
  • If res is 1 then we will write OK text to the text.txt file
  • If res is 0 then we will write “Failed” to the text.txt file

Other samples

  • Share/Bookmark

admin Samples , ,