Skip to main content

Performance Testing

I had an opportunity to give a speech about how we can automate performance testing in CI/CD pipeline in a conference held in Istanbul for the first time "Test automation and Digital QA Submit Istanbul, #TAS19". My subject was "Automated Performance Testing", the first part of the speech is to explain what is performance tests. 

In this post, I want to explain my thoughts about performance testing. Next posts will focus on automated performance testing and using K6 as a performance testing tool.

What is Performance Testing By Definition

Defining the performance of the system by testing the functionalities of the system in terms of the non-functionalities 

Performance Testing is
  • A non-functional testing
  • Testing the functionalities of the system
  • Both black-box and white-box testing
  • Defining how the system works under any loads
  • Applied under different load levels
  • Applied under different load increments
  • Applied under different durations

What is Performance Testing in Terms of Process

Performance testing should be also executed in a process. Performance engineers should ensure that they collected requirements, created the correct amount of virtual users, created test scenarios and they can execute them. As a final, they should check the result and the system, if required after fixing, re-execution may be needed.

Performance testing should start with planning, in this stage, you should align with customer/user needs. Without understanding the requirements any test can not be evaluated. Two main parts of the testing are verification and validation. By verification, we are checking the requirements and by validation, we are checking these requirements are valid with the global expectation at least the targetted users. Therefore this stage is very important.

In the next steps, you should create performance test scripts and create test environment and in the execution stage, you can run test scripts against the requirements in the reserved/isolated performance testing environment.   

In the monitoring stage, you should check that the execution is happening as expected by checking the system. The performance scripts create requests which are reached to the related part of the system and they create related data on the databases/caches. Which means that your scripts run as expected. 

In the analyzing stage, you can check the result and if necessary you can fix some configurative, network-related or database-related problems. After that if necessary, you can get ready for the next iteration. These iterations should keep going until the desired level of confidence is gathered.

Types of Performance Testing

Types of performance testing depend on the strategy that applied during the test by means of the loads, the duration and increment of the load.

Load Test

The load test is to understand the behavior of the system under a specific load. It is performing under a specific amount of the load to check if the system gives the expected responses with keeping it stable for the long term

Load Test is
  • Basic form
  • Widely known-form
  • A specific amount of load
  • Checking the expected response time
  • Giving a result that users are facing 

Stress Test

The stress test is to test the upper boundary of the system. When the load is increased to the level of the upper boundary, the stress test aims to get the response of the system. 

Stress Test is
  • Testing the upper boundary of the system
  • Needing more resources
  • Needing more investigation for boundaries
  • Needing more attention
  • Prone to break the system, aka: soak, endurance testing
  • Preparation for promotion like black friday, 11.11 

Soak - Endurance Test

Soak test is to test the upper boundary of the system for a prolonged time. Soak is good if you are not sure the expected amount of the user for some occasions.

Soak Test is
  • Testing the upper boundary of the system
  • Testing the system for a prolonged time
  • Needing more resources
  • Needing more investigation for boundaries
  • Needing more attention
  • Aims to break the system
  • Preparation for campaigns like black Friday, 11.11 

Spike Test

Spike test is to test the behavior of the system when the amount of load is suddenly increased and decreased. It aims to find system failures when loads is changing to an unexpected amount. 

Spike Test is
  • Testing the sudden increase and decrease of loads
  • Requiring more load generations
    • depends on the tools (load the system, then spike it)
  • Good for some occasion like simulating 
    • push notifications for e-coms
    • announcing critical news

Capacity Test

Capacity testing is aiming to find the maximum amount of the user that the system can handle. By this test we can find the how many user can use the system.

Capacity Test is
  • Testing the max user
  • Finding the behavior when more users join
  • Providing info about the loss of user data

Volume Test

The volume test is testing the database directly instead of the whole system. With the volume testing, we can find if there is any bottleneck with the database system. 

Spike Test is
  • Testing the database 
  • Testing the with a large amount of data

Popular posts for software testing and automation

Selenium Error "Element is not currently interactable and may not be manipulated"

Selenium webdriver can drive different browsers like as Firefox, Chrome or Internet Explorer. These browsers actually cover the majority of internet users, so testing these browsers possibly covers the 90% of the internet users. However, there is no guaranty that the same automation scripts can work without a failure on these three browsers. For this reason, automation code should be error-prone for the browsers you want to cover. The following error is caught when the test script run for Chrome and Internet Explorer, but surprisingly there is no error for the Firefox. Selenium gives an error like below: Traceback (most recent call last):   File "D:\workspace\sample_project\", line 10, in <module>     m.login()   File "D:\workspace\ sample_project \", line 335, in login     driver.find_element_by_id("id_username").clear()   File "C:\Python27\lib\site-packages\selenium-2.35.0-py2.7.egg\selenium\webdriver\r

Change Default Timeout and Wait Time of Capybara

One of the biggest challenge for automation is handling timeout problem. Most of the time, timeout is 60 seconds but it may sometimes not enough if you have badly designed asynchronous calls or the third party ajax calls. This makes handling timeout more complex. set large enough to tolerate network related problems. For Selenium based automation frameworks, like Capybara, default Webdriver timeout is set to Net::ReadTimeout (Net::ReadTimeout) Changing ReadTimeout If you have timeout problem for Capybara, it gives an error like above. This means that the page is not fully loaded in given timeout period. Even you can see that page is loaded correctly but webdriver wait until the Ajax calls finish. class BufferedIO #:nodoc: internal use only def initialize (io) @io = io @read_timeout = 60 @continue_timeout = nil @debug_output = nil @rbuf = '' end . . . . . def rbuf_fill beg

Create an Alias for Interactive Console Work: Selenium and Capybara

If you are working on shell most of the time Aliases are very helpfull and time saving. For testing purposes you can use Alias for getting ready your test suites. In this post, I want to explain both running Selenium and Capybara on console and creating aliases for each.  This post is for Windows machines, if you are using Unix-like see   this post . Creating Scripts for Selenium and Capybara First of all, it is assumed that you have installed Selenium and Capybara correctly and they work on your machines. If you haven't installed, you can see my previous posts. I am using the Selenium with Python and the Capybara with Ruby. You can use several different language for Selenium but Capybara works only with Ruby.  Create scripts in a directory called scripts (in your home folder, like as  ~/scripts ) for your automation tool as following, save them as capybara.rb, :  Creating Aliases Depends on your favourite shell, you need to add the alias to .bashrc bash

Page-Object Pattern for Selenium Test Automation with Python

Page-object model is a pattern that you can apply it to develop efficient automation framework. With the page-model, it is possible to minimize maintenance cost. Basically page-object means that your every page is inherited from a base class which includes basic functionalities for every page. If you have some new functionalities that every page should have, you can simple add it to the base class. Base class is like the following: In this part we are creating pages which are inherited from base page. Every page has its own functionalities written as python functions. Some functions return to a new page, it means that these functions leave the current page and produce a new page. You should write as much as functions you need in the assertion part because this is the only part you can use the webdriver functions to interact with web pages . This part can be evaluate as providing data to assertion part.   The last part is related to asserting your test cases against to the

Performance Testing on CI: Locust is running on Jenkins

For a successful Continuous Integration pipeline, there should be jobs for testing the performance of the application. It is necessary if the application is still performing well. Generally performance testing is thought as kinds of activities performed one step before going to live. In general approach it is true but don't forget to test your application's performance as soon as there is an testable software, such as an api end point, functions, and etc. For CI it is a good approach to testing performance after functional testing and just before the deployment of next stage. In this post, I want to share some info about Jenkins and Locust. In my previous post you can find some information about Locust and Jenkins. Jenkins operates the CI environment and Locust is a tool for performance testing. To run the Locust on Jenkins you need command line arguments which control the number of clients ,   hatch rate,  running locust without web interface and there should be so