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

This test case is to check the Ajax dialog can communicate correctly with the parent html's form.

jquery dialog testing

The evidense screen shot is stored at location below.


test screenshot

Those screenshots a taken by Selenium program using taking screenshot technique.

Location of the source code

The source code to test this is in "org.alinous.test.html5.jqparts" package.

source code of testing java package

The "jQueryDialogTest" class has the testing code of the JUnit.

Initialize WebDriver of the Selenium

At the first of the JUnit Test class, we initialize and connect the WebDriver, and make the download folder empty.

Testing ajax dialog

This test is to execute following actions.

  1. Goto the first page with ajax dialog
  2. Open ajax dialog
  3. Change or add ajax dialog's form value
  4. Close the dialog and check the value of parent html form changed

source code

The source code is below.

At first, go to "/samples/dialog/" by calling WebDriver#get().

ajax dialig testing first page

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.

parent form

After all, check the inputs' value in the form, and the values are not expected ones, assert by fail() function of JUnit.

Go to Top