Database Load Testing

A database application with high response time and poor performance can lead to huge problems. Database Load Testing helps in identifying the performance problems before you deploy your database applications for end users. Database Load Testing helps you design and simulate usage traffic which can be used to test your Database application infrastructure for performance, reliability and scalability. Load Testing of Database applications involves testing the performance and scalability of your Database application with varying user load. Database Load testing involves simulating real-life user load for the target Database application. It helps you determine how your Database application behaves when multiple users hits it simultaneously.

Following document will help you understand how you can successfully implement Database Load Testing for your Database applications using AppPerfect.

Database Load Testing with AppPerfect

AppPerfect offers Database Load Testing solution in the form of AppPerfect Load Test. AppPerfect Load Test Supports load testing for database Applications using JDBC protocol.

Creating Test Scripts for Database Load Testing :

  1. Creating new project is an easy one step process. Just start AppPerfect Load Test product and select File -> New.. menu option to create a New Load Testing project. For details on New Project creation refer to Creating a New Project chapter. For details on configuring project properties refer to Setting Project Properties chapter.
  2. Next Step is to configure Database connection with AppPerfect. Select Tools -> Options menu option and select the "Browsers, JDKs & DBs" Node. You can configure Database related properties like Database name, Connection URL, JDBC driver, User Name, password etc. under Database Connections. Click the button to Add New DB Connection and provide the connection settings for the Database you need to load test.

    Database Load Testing : Configuring DB Connection
  3. Next Step is to configure the Load Test project to use the database connection we just configured in earlier step. Select Project -> Properties menu option and select the Database Settings tab. Select the checkbox to Load Test Database and select the Database from the drop down. You can also configure Connection Pool settings here.

    Database Load Testing : Configuring Project Properties
  4. Load test script consists of a number of "Action Groups". A Action Group is a logical unit for combining actions inside a test. By default the groups present are for HTTP Load Testing. We will need to add new group for Database Load Testing. To create a new Database Action Group just select Project Node in the Editor tree, and right click and select the option.Add Group... from the popup menu. Provide descriptive name for the group clearly stating what tasks this group is going to implement. Select the type of Action Group as JDBC defining the type of application you are trying to load test.

    Database Load Testing : Adding Action Group

Adding Tasks to Database Group:

  1. Once you are done creating Database Group, you can add JDBC tasks to this group in form of database queries. These database queries will be executed when you execute the Load Test. To add JDBC task, select the Database Group in the Editor tree. Right click and select the option to "Add Task.." from the popup menu. This will launch the Add Task dialog.

    Database Load Testing : Add Task Option
  2. In Add Task dialog provide descriptive name for the task clearly stating what this task is going to do. You can either provide the query string or can import the queries from external file. Click on Validate Query button to confirm that provided query is correct.

    Database Load Testing : Add Database Task
  3. Add all the required JDBC tasks by repeating the earlier steps. Once you are done adding all JDBC tasks you can browse though them in the Editor views and can add required validations.

    Database Load Testing : Editor View

Extensive Validation and Custom Scripting support :

AppPerfect's Database Load Testing tool provide extensive support for validations. Once you are done adding JDBC tasks, you can edit your Test cases to perform required Validations. You can add validation on the result set returned as a result of query execution.

  1. Select the JDBC task in the Editor tree and on right hand side you will find options to add the validations for JDBC task. You can validate the number of rows present in the result set, Validate column names in the result set and can validate values returned in the result set.

    Database Load Testing : Validations
  2. Custom Validation Support : For any Database Load Testing tool, one of the important criteria is support for customization. Apart from validations explained above, In case you need to perform any custom validation on result set you can do so using scripting. AppPerfect stores recorded test as java script and one can add custom code to the test script to perform any custom database validation. We support custom scripting apis, using which you can execute the JDBC query and fetch appropriate fields from the result set and validate it against the required value. Script Editor can be invoked using Project -> Script Editor.. menu option. Please refer to Customizing Test Script chapter for more details.

    Database Load Testing : Script Editor

Extensive support for Parameterization :

AppPerfect's Database Load Testing solution supports extensive support for test parameterization, wherein you can configure virtual users to run same script over and over again with different data set each time. AppPerfect offers extensive parameter-management. Parameter selection and testing with various parameter values is completely automated. Parameters are stored as name-value pairs, making it intuitive for application developers and testers. Then, depending on the number of iterations for your project, multiple parameter values can be tested, with options to select parameters sequentially or randomly. For more details on Test Parameterization refer to Parameters chapter.

  1. Select the Parameters Node in the Editor tree and on right hand side you will find button to add a New Test Parameter for your test. This will launch the Parameterization wizard which will help you creating and associating data source in your test. You can choose data source to be Fixed pool of values, Database, records in CSV file or can derive it from calculated values.

    Database Load Testing : Test Parameterization
  2. Once you are done creating the Test Parameter you can associate same with JDBC task. JDBC Queries can be parameterized by specifying parameter name between two '@' characters. For example, for query 'Select productName from products where productId=?' and we want to parameterize productId, add the parameter to query as 'Select productName from products where productId=@PRODUCT_ID@'. Define a test parameter with the name PRODUCT_ID by selecting Parameters node in the Test Editor view as explained in earlier step.

Test Execution with detailed Result Analysis :

Once the test is completely designed you can execute it to Load or stress test your application with different load strategies as per your requirement. AppPerfect generates extensive reports for each virtual user and task. To replay the test select the Project -> Run.. menu option. AppPerfect will start specified virtual users simultaneously based on the selected Load Strategy. and each virtual user will execute the JDBC tasks in automated manner. At the end of test execution you can view the detailed results for each of the virtual user and export them to HTML, PDF etc. formats. In case of failure, you can pass on these exported reports to your development team for further analysis. For more details on Test Execution Results refer to Understanding Test Results chapter.

Database Load Testing : Results

Conclusion :

Database Load Testing helps you design and simulate usage traffic which can be used to test your database application infrastructure for performance, reliability and scalability. Once a test case is recorded it can be played back multiple times with different data sets. Its possible to validate output with different data inputs using the same test case by parameterizing the user input. Moreover tests once recorded can be reused and extended to cover more features and test cases as your application evolves,
AppPerfect's Database Load Testing solution is platform independent. Database Load Tests recorded on one platform can be executed over different operating systems and hardware configuration. AppPerfect Load Test is found to be most affordable, cost effective, efficient, reliable and accurate Database Load Testing solution by its customers. In case you have not yet tried AppPerfect Load Test, Download Now and give it a try today.