![]() ![]() |
Quickstart Tutorial |
|||||||||||||||||||||||||
|
||||||||||||||||||||||||||
WET Quick start guide
Bangalore
WET is a
framework to facilitate automated testing of web applications. WET
uses Watir as the underlying library to automatically drive web
pages. This guide gets you started with WET and its powerful
features.
In this guide, we will see how to start using wet
and automate a simple set of tests.
Download and Install
WET
The install guide has the instructions on the
installation process.
Plan your test
The key to the success of any test automation project is the amount of planning that goes into it. First we will list the scenario and test points around that.
Scenario :
The sample test scenario is to navigate to the sample page and submit a bug. Finally we will verify whether we get a confirmation for that page. Let us list the above scenario as test statements.
No. |
Test Step Details |
Object + Action |
Verification step |
---|---|---|---|
1. |
Open Bug Submission Form |
Launch Browser from WET UI. |
|
|
|
Navigate to http://www.wet.qantom.org/handson.html |
Verify that the Bug Submission Form is open. |
2. |
In the Bug submission page, enter all the values and Click Submit Query.
|
In the Name textfield, enter "Support" |
|
|
|
In the Email textfield, enter "support@qantom.com" |
|
|
|
In the summary text field enter – "This is a sample bug" |
|
|
|
In the product List select "Customer Management" |
|
|
|
In the problem type List select "Cosmetic issue" |
|
|
|
In the problem details textarea enter "When you click on customer Foo, customer bar is actually shown" |
|
|
|
In the Special Notes textarea enter "My machine is a Win XP running sp4" |
|
|
|
In the about yourself textarea enter "I am a new WET user" |
|
|
|
Click on the "Submit Query" button. |
|
|
|
|
A new web page is shown which
has the header text |
|
|
|
This page accurately displays the information that you wrote in the previous page. |
Ok that's it. We are done with planning a simple scenario. Let's start off with the task of recording our scenario. Note that record in Wet doesn't mean record-playback in the way that other test automation tools refer to this term. The benefits and flip side of record-playback are beyond the scope of this tutorial. The following points should make it clear:
WET offers a fine trade-off between traditional record-playback automation vs. pure scripted test automation.
WET's
choice not to go the traditional record-playback way was a pure
design choice and is inspired by Albert Einstein's quote
Make everything as simple as possible, but not simpler.
WET's technique of creating scripts relies on the tester who will be instructing (similar to what (s)he would be doing when executing) all the test steps that needs to be recorded, rather than using the system under test that is automatically converted to scripts by the test tool.
So in the context of WET, recording is more like the making of a movie. There's a lot more people involved than the cameraman and the casts! Enough said. Let's start recording our scenario now
Start
WET
To start WET, Click Start -> Programs ->
Qantom -> WET. The WET application starts up as shown below:
Illustration
1: Wet Manager - The gateway of WET
|
Step1 = Open Bug Submission Form
Recall the manual test steps and the actions to be take:
|
Test Step |
Action |
Verification |
1. |
Open Bug Submission Form |
Launch Browser from WET UI |
|
|
|
Navigate to http://www.wet.qantom.org/handson.html |
Verify that the Bug Submission Form is open. |
To accomplish this task using WET:
Click on the Simulated IE Image / button in the Wet Manager.
Launch one script editor applications
Now associate the Simulated IE with the recently open script editor
Let's keep it simple to start with – so dont worry about associating with object depots yet!
In the tools menu of the Simulated IE (aka Proxied web browser), you will find an option to navigate to a web page. Click on that and in the resulting dialog box enter http://www.wet.qantom.org/handson.html and press the go button.
A new IE browser opens and navigates to http://www.wet.qantom.org/handson.html automatically.
Inside the WET UI, the Bug Submission Form is opened in sync with the Internet explorer.
Now let's do the verification step – which is to check whether or not the right page is opened.
In the simulated IE, right click anywhere on the browser and say 'Check_text'
The corresponding script line is added to the script in the current Transaction.
The verification point in this test case is to see if the Submit bug page is opened. Right click on a blank area in the simulated browser, select check_text in the drop down list.
In
the function dialog box that pops up, type /Bug
Submission Form/
in the text
field and click Add. Check ON the checkbox that says “Variable?”.
In
this step you are instructing WET to verify whether the web page has
the text Bug Submission Form.
Note: Checking this on simply states that the text Bug Submission Form is not a string literal but a regular expression. Detailed explanation about this is beyond the scope of this tutorial. You will learn more about this when you learn about ruby's regular expression.
Drawing
1: Screen shot of the Function assistant
Step 2 = Enter all the valid values in the submit bug form.
2. |
In the Bug submission page, enter all the values and Click Submit Query.
|
In the Name textfield, enter "Support" |
|
|
|
In the Email textfield, enter "support@qantom.com" |
|
|
|
In the summary text field enter "This is a sample bug" |
|
|
|
In the product List select "Customer Management" |
|
|
|
In the problem type List select "Cosmetic issue" |
|
|
|
In the problem details textarea enter "When you click on customer Foo, customer bar is actually shown" |
|
|
|
In the Special Notes textarea enter "My machine is a Win XP running sp4" |
|
|
|
In the about yourself textarea enter "I am a new WET user" |
|
|
|
Click on the "Submit Query" button. |
|
|
|
|
A new web page is shown which
has the header text |
|
|
|
This page accurately displays the information that you wrote in the previous page. |
In the Simulated IE:
Right-click on the Name textfield, select set and enter Support in the function dialog box that pops up and click Add.
Right-click on the Email textfield, select set and enter “support@qantom.com” in the dialog box that pops up and click Add.
Right-click on the Summary textfield, select set and enter “This is a sample bug”in the dialog box that pops up and click Add.
Right-click on the Problem details textfield, select set and enter ”When you click on customer Foo, customer bar is actually shown" in the dialog box that pops up and click Add.
Right-click on the Special Notes textfield, select set and enter “My machine is a Win XP running sp4" in the dialog box that pops up and click Add.
Right-click on the About Yourselves textfield, select set and enter “I am a new WET user" in the dialog box that pops up and click Add.
The next step is to select the options for the product List and problem type List. Right-click on the problem type drop down menu and click select. In the function dialog box that pops up, select Customer Management and then click Add.
Similarly select Cosmetic issue from the problem type List and then click Add.
Then, Right-click on Submit Query and select click.
The Web Bug Report page should now be shown on both the the real browser and the simulated browser.
Drawing
2: Screenshot of the page after submitting a bug
Note: Due to Jira Issue WET-350, you will have to do a View->Sync-><whichever browser> manually after doing the 'submit' operation. This issue will be fixed before the final release of 1.0
Finally, we need to verify that the Bug Report page is shown. Right-click in the blank area of the proxy UI and click check_text. In the function dialog box that pops up enter /Web Bug Report/ and click add. Check ON the checkbox that says 'Variable?'.
That's it . You have completed recording your first script.
Organize your test and save.
If you have used WET 0.9.8, the way to save WET tests in 1.0 may appear to be a regression in the way WET works. Trust us – it is not! Before creating the WET Tests, the individual artifacts generated in the 'record' step must be saved separately. In this case, it is only the WET script.
First of all designate a folder area for your wet tests – say c:wet_samples
Go the script editor and save the generated script to c:wet_samplesug_submission1 cripts cript.rb
Now launch a test definition editor using the WET Manager – The test definition editor is the UI to create / edit WET tests
Drawing
3: Screen shot of the Test Definition Editor
Edit the first node of the treeview in this testdefinition editor so that the name is changed from 'Please_specify_name_here' to 'bug_submission'
Change the test description to a more meaningful value – say “This test is to submit a cosmetic bug and verify that the bug is submitted”
We are not using object depot or datatables. So dont worry about any of the other fields in the right hand side of the test definition editor.
We dont need any preconditions yet. So let's delete all preconditions – To do so expand the precondition node and select the FirstPrecondition tree node. Now go to the edit menu and say Precondition -> Delete
Likewise, we dont need any teardowns. Delete the teardown by choosing the FirstTeardown and doing Edit->Teardown->Delete
Let's now change the name of the only transaction to a more meaningful name – say 'Submit_cosmetic_bug'. First select the FirstTransaction treenode after expanding the Transactions treenode. Edit the treenode label so that its name is “Submit_cosmetic_bug”
Click on the first tree node which reads please_specify_a_name here. Specify a name for your test. Let us call it Submit_a_bug.
Click on the props tab on the right panel and enter the details. Provide a brief description of the test steps in the Description textarea:
This is the main transaction. It navigates to the Bug Submission Form and enters text in the textfields, select options from the list and finally click the Submit Query button.
Set the script path for this transaction to the script that you created minutes back. To do so say 'Choose' for the script path. An open file dialog is shown in which you should set the path to the recently saved script path – c:wet_samplesug_submission1 cripts cript.rb
Save the test definition – to say c:wet_samplesug_submission1
Double check that the files that you just created are as per expectations. To double check use the following zip file as a reference
Congrats! You have now completed creating your first WET test. Its the time to run it.
Execute
the WET test.
The Test Definition editor has an option to directly execute tests. Just click on the Tools -> Execute test menu option
The test starts running and after the various steps are performed, then a message box is shown in the test definition editor pronouncing the results.
This message box also gives you an option of whether or not you want to view the test results. Click on 'Yes'.
The test result opens automatically in your favorite browser.
The test results is also stored in <test_def_path> esults directory.
Drawing
4: Result of executing the first tutorial test
Summary
You
have seen as to how easy it was to create your first set of WET
tests and generate results for that. We have used only some of the
basic functionality that wet offers. WET has much more power under
its hood like integrated datatable support, support for storing
objects in a centralized object depot, integrated batch runner and
more. Jump into the excitement, join the WET users community at
http://lists.sourceforge.net/lists/listinfo/wet-users
and check out all the features that WET has to offer.
Hope you enjoy getting your test automation hands WET!
WET is a opensource automated web testing tool which uses Watir as the library to drive web pages. WET drives an IE Browser
directly and so the automated testing done using WET is equivalent to how a user would drive the web pages. WET extends the
scripting abilities of Watir and also offers the convenience of recorders. It is licensed under LGPL and BSD style open source licenses.
|