Testing jQuery Dialog example
This page is about Testing Automation of jQuery Dialog example. By learning this content, you can test jQuery dialog using ajax by testing automation using JUnit and selenium.
In order to understand what test, please take a look at jQuery Dialog before reading this page.
- About test cases
- Location of the source code
- Initialize WebDriver of the Selenium
- Testing ajax dialog
This test case is to check the Ajax dialog can communicate correctly with the parent html's form.
The evidense screen shot is stored at location below.
Those screenshots a taken by Selenium program using taking screenshot technique.
The source code to test this is in "org.alinous.test.html5.jqparts" package.
The "jQueryDialogTest" class has the testing code of the JUnit.
At the first of the JUnit Test class, we initialize and connect the WebDriver, and make the download folder empty.
This test is to execute following actions.
- Goto the first page with ajax dialog
- Open ajax dialog
- Change or add ajax dialog's form value
- Close the dialog and check the value of parent html form changed
The source code is below.
At first, go to "/samples/dialog/" by calling WebDriver#get().
And change the value of "str01", whichi is text input, and "sel01", which is select input. Then push the "Show dialg" button.
Then check the selected value is same with ones before the "show dialog" button pushed. After that, change the value of the dialog and push the "Close" button. Then the dialog is closed and the parent form's values are change.
After all, check the inputs' value in the form, and the values are not expected ones, assert by fail() function of JUnit.