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
- Location of the source code
- Initialize WebDriver of the Selenium
- Testing progress bar
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.
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.
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 "JQueryProgressBarTest" 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.
In this test case, the test program do actions below.
- Go to the test page
- Start the progress bar
- While the progress bar is not cpmpleted, wait for it to compete
- When the progress bar is completes, check it and take screenshot
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.