Functional and performance testing are an integral part of any website or app testing, and the reason is, they can indicate various bottlenecks, errors, and bugs existing in the system. Based on those feedbacks, one can improve the quality of their products before the final launch.
In today’s day and age, when agile methodology is the way forward, teams opt for CI/CD-based approach in the software testing process. The reason behind that is continuous integration helps you to improve the product quality and lower costs. If you run the test separately, it would cost you more, and you can’t conduct any cross-analysis.
In this scenario, open-source automation testing tools are the best bet. They allow you to integrate CI/CD approaches with the testing process. Taurus is one such automation testing tool that can convert test suites into human-readable formats such as JSON or YAML. It also allows you to conduct parallel testing.
In this blog, we will conduct functional and performance testing with the help of Tauras and Selenium. We will also show you the process of integrating these tests into the CI/CD cycle.
Let’s support there’s a website for flight ticket purchasing where users visit the site, select a ticket, and make the payment. In this scenario, here’s how you can conduct functional testing.
Selenium is one of the finest test automation tools that can help you record such a use case. The user will visit the flight ticket booking website to provide the date, departure, and destination.
After that, they will move to the payment page to add credit card/debit card details. After completing the payment, the website should show a confirmation page to the user. Now, you can record this script using Selenium IDE and add it to Tauras.
Run the recorded Selenium script through Tauras by invoking the ‘selenium’ extractor and config file:
---
execution:
- executor: selenium
# functional tests
scenario:
script: selenium/usecase-purchase.py
Now, save this script in YAML format and then run it in the terminal through Tauras:
bzt abc.yml
The YAML script parsed by Tauras allows you to define each step of the use case:
---
execution:
- concurrency: 10
hold-for: 10s
steps: 4
scenario: usecase-purchase
scenarios:
usecase-purchase:
timeout: 5s
retrieve-resources: true
store-cache: false
store-cookie: false
default-address: https://blazedemo.com
headers:
User-Agent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36'
Accept-Language: 'en-US'
Accept-Encoding: 'gzip, deflate, sdch'
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp'
requests:
- /index.php
- url: '/reserve.php'
method: POST
headers:
Content-Type: application/x-www-form-urlencoded
body:
fromPort: Philadelphia
toPort: Rome
- url: '/purchase.php'
method: POST
headers:
Content-Type: application/x-www-form-urlencoded
body:
airline: United Airlines
flight: '234'
fromPort: Philadelphia
price: '432.98'
toPort: Rome
- url: '/confirmation.php'
method: POST
headers:
Content-Type: application/x-www-form-urlencoded
body:
inputName: John Doe
address: A Test Street
city: Anytown
state: SomeState
zipCode: '54321'
cardType: Visa
creditCardNumber: '7463385993'
nameOnCard: John Doe
rememberMe: 'on'
With the help of any functional testing tools and these three steps, you can conduct functional testing. Now, let’s move on to the performance testing part in our upcoming section.
As per our use case, you want to check if the website pages load within the required response time range. For this purpose, you have to define the threshold value for each page in Tauras. If the page loading time surpasses the threshold value, the test case will be marked as failed, and you’ll want Tauras to take the necessary action.
Performance testing using threshold values allows you to determine the failure or success within a matter of minutes. So, you could take action accordingly and contribute to the betterment of your website or application performance. In addition, there is a Pass/Fail module in Tauras. Using that, you can conduct the performance test and improve business performance.
You can add the Tauras data to YAML format as below:
reporting:
- module: passfail
criteria:
- avg-rt of IndexPage>10ms for 1s, continue as failed
- avg-rt of ReservePage>15ms for 1s, continue as failed
- avg-rt of PurchasePage>15ms for 1s, continue as failed
- avg-rt of ConfirmationPage>15ms for 1s, continue as failed
As discussed earlier, you would want to incorporate the agile methodology in software testing. For that purpose, you can assist Continous Integration platforms like Jenkins and add test cases to them. Then, all you need to do is run a few commands using shell script, and run performance tests easily. There are also many core web vital tools that help to fix the speed and performance issues.
The developers and testers get real-time feedback in case of any functionality or code change in the website or application. In addition, it will help you to find out the root cause that is making web pages load slower than expected. It is precisely why Jenkins is in massive demand nowadays, and software testers worldwide have made it a part of their ecosystem.
Functional and performance testing are two pillars of any website or application testing. It gives you a clear perspective of where your product stands in the market and what changes you need to make before making it live in production. In today’s day and age, when so many open-source tools are available in the market, you can utilize them to make this process easier.
In this blog, we have provided details on conducting functional testing and performance testing using Selenium and Tauras. We hope it will help you in your software testing process. What are your thoughts on this subject? Do let us know in the comments section.