Tutorial: TwoDialogs Sample
|Top Previous Next|
This section outlines the usage of SmarteStudio for testing a very simple AUT.
Please run the application now. You will find it in the samples directory where you installed SmarteStudio.
By default, that will be C:\Program Files\SmarteSoft\SmarteStudio\Samples\TwoDialogs\TwoDialogs.exe.
You will see the following:
Please run the application a few times and observe its behaviour. If you press the OK button with the first edit box empty, the application will complain and return you to the dialog box.
If you put text in the first edit box but not the second, you will be shown a single line of text in a read-only edit box..
If you enter text in the second edit box as well as the first, pressing OK will put two lines of summary information in the read-only edit box.
An adequate testing strategy for this over-simple application might be to:
1. Put data in the first text box but not the second, and verify that the summary information is correct.
2. Press the OK button with no data in either text box, and verify that a message box is displayed.
3. Verify that if the success "Thank You" message is displayed the edit box input fields are cleared (but not the summary information).
If at this point you do not understand what the application is supposed to do, or the application is not behaving as described here, please contact support and clarify the details before proceeding.
Now, let's use SmarteStudio to implement the first of these tests.
Step 1. Run the TwoDialogs application and leave it in its default start state.
Step 2. Start SmarteStudio and make the window a conveniently large size. Click on the button (top left). Choose the first option there, "New Test."
Step 3. Navigate to the desired path using the "..." button on the "Create New Test" dialog.
Leave the "Use Methodology" as "Basic" for now.
Press the "Create" button.
You will now see the following:
Step 4. Recording the test sequence. Press the "Record/Learn" button in either the ribbon or on the toolbar. It has an icon like this:
You will see an application selection dialog like the following.
Select the "SmarteSoft SmarteStudio Two Dialogs Sample" entry.
Leave the library selection as "Auto."
Press the "Select" button at the bottom right.
Step 5. Record the activity in the application.
SmarteStudio will pause while it starts the necessary background processes and hooks into the running AUT.
Once those tasks are complete, you will see the following "Recording Activity" for "SmarteSoft SmarteStudio Two Dialogs Sample" dialog:
The AUT will be brought to the foreground and SmarteStudio will be minimized.
You will achieve best results in recording if you observe the following guidelines:
(1) Work slowly while recording. Perform one action and wait for the results to be recorded in the Recording Activity dialog as a new grid line-item before going to the next item.
(2) Use the mouse to select controls and operate them. Avoid using keyboard shortcuts and keyboard commands.
Step 6. Click in the first edit box in the TwoDialogs application. Type a name in there.
Watch the Recording activity dialog as you operate the AUT interface. As you press a button or fill a field, notice that the grid in the Recording activity has entries added to it.
As you take these actions, you will see the Recording Activity grid update accordingly:
For a full explanation of the controls on this dialog, refer to the reference for Recording Activity Dialog
When you have finished recording the activity for the AUT, press the "Finish" button or CTRL+3.
Note: Do not terminate the TwoDialogs application.
When you do this, the "Recording Activity" dialog will be closed and the AUT will lose focus. SmarteStudio will change the view to display the newly recorded script. It will look something like the following:
Notice that the two steps of the script are automatically documented and that they correspond precisely and in the same order as the way they appeared in the Recording Activity dialog during recording.
Step 7: Run ("Play") the recorded test script. Press the "Play" button on the ribbon or the toolbar.
As the script runs, the SmarteStudio window will be minimized to the taskbar and you will see the results of the script's activities on the TwoDialogs application window.
At the end of the script execution, the SmarteStudio window will be restored and the view will be of the report for the test:
Step 8: A refinement on the launching of TwoDialogs.exe.
To date, we have operated on the assumption that the TwoDialogs sample program (application) is running. If this situation remained, the test script would require that the AUT be running before the script started. That would require that the person running the test remembered where it resided. To overcome this, SmarteStudio provides a way to have the script run the program (AUT) before beginning the test.
There are at least 3 ways of adding application launch code to your test.
Way 1: Drag The File from the Test Files view
First, switch to Test Files view. Right-click on "Test" folder and choose "Add File(s)..." menu item:
And select the location of the TwoDialogs.exe (normally, it is C:\Program Files\SmarteSoft\SmarteStudio\Samples\TwoDialogs\TwoDialogs.exe),
Now you have the executable as a part of your test files set:
If you wish to launch TwoDialogs.exe once then just double-click on it in the tree. If you wish it to be launched every time the test starts then simply drag it from the tree into the source code:
The proper launch statement will be inserted:
Way 2: Type the Code
The Global object contains methods that are available to all scripts.
Select the TwoDialogs.js file in the Test Files view of the SmarteStudio main page.
Double-click the file name to open it in the main (editing) window of SmarteStudio. You will see the generated script from the recording session from earlier steps in this sample.
Place the cursor in the main editing window and click on the first line after
As soon as you type the ".", SmarteStudio will give you a drop down list of all the available methods available in the Global object:
Select the DoLaunch(cmdLine, wrkD) member and hit the Enter key.
Now your script contains the line:
You need to correct the references to the command line:
Way 3: Drag the Action from the Objects Tree
You may drag the method template from the Object Tree view. Expand the "Global" node and select the "DoLaunch" action in it. Drag the node into the proper position inside the script source:
Template call is inserted:
Now you need to correct the references to the command line: