In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to implement Python performance automation testing framework. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
context
Performance testing, as a testing activity for in-depth evaluation of systems, interfaces or business processes, has different concerns and perspectives from functional testing. At the same time, because it may involve a wide range of personnel, such as performance testers, functional testers, developers, operation and maintenance, DBAs, etc., there is often a common phenomenon of long testing cycles. However, for performance regression after bottleneck optimization, based on existing environmental data, test scripts, scenario configuration, etc., performance automation can be considered, freeing performance testers from tedious scenario execution, resource monitoring, result collection, etc., thus saving time and allowing performance personnel to concentrate on the more important result analysis stage.
Based on these considerations and practical requirements, it is necessary to develop a framework to automate performance testing.
Analysis of two problems
As the saying goes, before you develop a performance test automation framework, you need to consider the following questions:
1. What development language was chosen?
2. What are the performance testing tools that the framework deals with?
3. How to design a framework that gives users more peace of mind and makes it easier to respond to needs?
4. How do you separate common functions and reuse them?
5. How do I control the execution sequence in multiple scenarios?
6. How to perform data preparation?
7. How to efficiently implement window control and file download on multiple linux hosts?
8. How to make database monitoring easier?
9. How to make crawling html pages easier?
10. How to extract and analyze text content?
11. How to write HTML more elegantly?
…………………………….
Three solutions.
Well, that's a list of problems, but of course, these are just a few of the problems of implementing a usable, reliable automation framework that requires a basic solution before development.
In framework development, the design principles and solutions are as follows:
Python as the development language, and is pure Python implementation, reject other script forms, bat ah, shell ah, to maintain the future maintainability of the framework;
Performance testing tools are mainly LR. Some scenarios may use Jmeter. Therefore, the framework will give priority to LR. According to subsequent requirements, support for Jmeter will be considered.
The framework should provide a simple, easy-to-configure unified interface, and users do not need to care about the internal implementation of the framework;
The framework should be modular in design to improve functional reuse;
The framework supports the requirement of scene sequence control conveniently through unified configuration interface;
Detach database operation function, support environment initialization operation before execution of each scene, and this action should be optional or configurable;
File transfer, command execution, sql script execution of windows-linux can be realized through parimiko;
Monitoring database performance status by obtaining awr reports;
Monitoring server resources through nmon;
Parse html files using beautiful soap;
Configuration is in xml format and parsed using cElementTree;
The execution process of the framework should have detailed logging, which can be realized by logging;
Support generating test reports in html format;
Four-frame process
The framework is mainly divided into three functional modules: scenario execution, resource monitoring, result analysis and reporting; the flow chart is as follows:
Five frame directory structure
The framework implementation directory structure is as follows:
Config directory: provides unified configuration entry for framework, presql directory provides scripts for scene initialization preparation;
Log directory: provide detailed log of framework execution, log by day, log will be rewritten on that day;
Report directory: generate report after framework execution, including summary_report.html and resource_report.html;
Result directory: this directory is used to store the execution results, including Linux directory for storing Linux resource monitoring, LR directory for scene execution results, and Oracle directory for database operation monitoring;
Scenarios directory: Scene execution file directory and Perf_Autotest_Tep directory for storing LR result analysis template;
Scripts directory: framework scripts directory;
VI. Achieving effects
After the framework is executed, the report will be sent in the form of an email, and the attachments include summary_report.html and resource_report.html. The effect is as follows:
summary_report.html Effect:
resource_report.html Effect:
Thank you for reading! About "how to implement Python performance automation test framework" this article is shared here, I hope the above content can have some help for everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.