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

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.


taken screenshots

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

This test case uses next web page.

Backup and restore database 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.

Location of the source code

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

Test case and test suite

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.

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.

Backup database records

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.

backup database

Source code

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.

Restore from backuped file

In this test case, select the stored zip file, and restore the database.

Restore database

Source code

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.

Go to Top