Testing jQuery Progress Bar example

This page is about Testing Automation of jQuery Progress Bar example. By learning this content, you can test jQuery progressbar using server side program by testing automation using JUnit and selenium.

In order to understand what test, please take a look at jQuery Progress Bar before reading this page.

About test cases

This test case is to run the jQuery Progressbar, and wait for it has been done. This pattern is often used in the web based Rich Client UI applications.

progressbar

By making testable code in this part, you can easily use this parts, because it does not obstruct your testable code.

The evidense screen shot is stored at location below.

/[Project]/screenshots/progressbar

screenshots of progressbar testing

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.

java package including testing class

The "JQueryProgressBarTest" 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 progress bar

In this test case, the test program do actions below.

  1. Go to the test page
  2. Start the progress bar
  3. While the progress bar is not cpmpleted, wait for it to compete
  4. When the progress bar is completes, check it and take screenshot

Source code

The source code of this test case is below.

After it submit the form, the backend job starts, and the prgress bar appears. Then it calls ActionUtils#waitForHiddenValueBecome() in order to wait for the backend job finished and the progress bar completes.

The source code of ActionUtils#waitForHiddenValueBecome() is below.

The html form, when both the progress bar appears and not appears, has hidden form value "showProgress". The hidden's access method("By" class instance) is given via the parameter of this function.

The Selenium's WebDriver can get exsting element, but can not detect the element does not exist. So when you write code to detect the status of web page, you have to prepare a hidden form variable with same access path to check the web browser's html status.


Go to Top