Testing Backup database example
This page is about Testing Automation of Backup and restore database example. Backing up and restoring data is often used in Testing Automation. It is because preparing the state of the database's data is required for the each test case when you test web based application.
In order to understand what test, please take a look at Backup and restore database before reading this page.
- About test cases
- Location of the source code
- Initialize WebDriver of the Selenium
- Backup database records
- Restore from backuped file
This testing automation example tests below.
- Backup the database
- Restore the database with backuped zip file
This example is testing the testing automating technique to handle database recod's status.
The evidense screen shot is stored at location below.
Those screenshots a taken by Selenium program using taking screenshot technique.
This test case uses next web page.
This page has 2 froms, one is to download the database data as zip file, and another is to restore the database data with the zip file.
The source code to test this is in "org.alinous.test.html5.basic" package.
In this test example, the testing needs to manage the order to execute. At first, download the database data, next, restore the data with it.
Therefore the test suite is used and it execute the test classes in correct order.
At the first of the JUnit Test class, we initialize and connect the WebDriver, and make the download folder empty.
In this test case, push the "Backup" button, and download zip file which all of the database records are included. It stores the zip file for the next test case.
The source code is below.
Before downloading the zip file, it has to call DownloadFile#clearDownloadFolder() and make the download folder empty.
After download a file, store it into the BackupAndRestoreTestSuite.FOLDER_DOWNLOAD folder, so that next test case can use it.
In this test case, select the stored zip file, and restore the database.
After download the zip file, it use it in this test case.
Select the downloaded file into the file input form, and submit the form.