Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sharing of practical testing skills: jmeter+Jenkins performance Test Automation Building

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

At this stage, I was lucky enough to take over the testing of the company's new products, so I was very busy all the time. Backstage received some private messages from students, want to know more about performance testing, just in my spare time, finally have time to sum up some practical experience and testing process of performance testing, I will chat with you.

Performance testing is used to ensure that the performance of the system meets the needs of users after product release, and plays an important role in software quality assurance. My preferred tool for performance testing is JMeter, and I have to say that JMeter is also a very good interface testing tool.

Jmeter application field

JMeter is a Java-based performance testing tool developed by the Apache organization. Used for stress testing of software, originally designed for Web application testing but later extended to other testing areas

1. Can be used for stress testing and performance testing, database testing, Java program testing, HTTP and FTP testing, Web Service testing, etc.

two。 Can be used to test the performance of static and dynamic resources (files, Servlet,Perl scripts, java objects, databases and queries, FTP servers, etc.)

3. Can be used to simulate huge loads on servers, networks, or objects to test their strength and analyze overall performance under different stress categories

4. Can be used to do functional / regression testing of the application, by creating a script with assertions to verify that your program returns the desired results

Although Jmeter is a widely used performance testing tool, users often need to spend a lot of extra energy and time to configure the test environment before performing the test.

At the same time, when testing, using a single server to simulate the load of thousands of users on the target server, limited by the performance of the server may not be able to meet the demand, which requires a distributed and concurrent testing environment with multiple servers.

Therefore, an automated performance test based on Jmeter and Jenkins is needed to solve the above problems.

Framework introduction

First of all, record or write the performance test script with jmeter, add related dependencies with maven, submit the performance test code to github, configure git to download the performance test code in jenkins, configure to run scripts and test reports, and configure to run failure automatically send email notification, so that the job configuration of performance test is completed.

Next, configure the job of the performance test as the downstream job of the development job. Once the developer has the new code to submit and run his own job, it will automatically trigger the job of our performance test. In this way, we have fully automated interface performance testing, and we only need to pay attention to the emails that fail the test!

1. Install java and maven

First, java and maven are installed on the remote pressure measuring machine.

Extract the corresponding tar package

Configure / etc/profile path

Source / etc/profile makes the configuration effective, which is very simple.

2. Install Jenkins

Wget-O / etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

Rpm-- import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

Yum install Jenkins

Start service jenkins start

Using ip:port access, go to the home page of Jenkins to configure accordingly.

Default port 8080, home directory path / usr/lib.

3. Create a new node machine on Jenkins

The node machine is the pressure measuring machine, that is, which machine you want to use to run your job.

First install the ssh plugin plug-in

Then add a credentials authority authentication that logs in according to the user name and password

The last part is to configure the node, which mainly involves configuring the jdk directory.

4. Install the performance plug-in on Jenkins

Mainly install HTML reports and performance test result report plug-ins

Download 2 Jenkins plug-ins and install them.

5. Create a new job

The core content is as follows

Select the node machine as the execution machine, use the shell command to build the behavior, and add html report and performance trend after the build.

6. Verification result

The final effect is as follows.

You can see the rich results of the html report

The performance baselines of each version can be compared horizontally

Ps: record the problems encountered in the process of automating jmeter performance testing.

Question:

Jenkins cannot show the html results of the performance test

Solution:

Modify the default configuration of Content Security Policy, enter ManageJenkins- > Script console, enter the following command and execute it.

Summary:

So far, jmeter+Jenkins performance test automation has been built, and you can also use Ant integration if necessary. There are still many deficiencies in this process, and I will continue to strive to share more valuable practical information in the future. The ancients said, "The more we share, the more we have", will share to the end.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report