CN113778861A - Page element automatic testing method and device based on Jmeter and computer terminal - Google Patents

Page element automatic testing method and device based on Jmeter and computer terminal Download PDF

Info

Publication number
CN113778861A
CN113778861A CN202110936504.4A CN202110936504A CN113778861A CN 113778861 A CN113778861 A CN 113778861A CN 202110936504 A CN202110936504 A CN 202110936504A CN 113778861 A CN113778861 A CN 113778861A
Authority
CN
China
Prior art keywords
page
jmeter
tested
test
test plan
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110936504.4A
Other languages
Chinese (zh)
Inventor
黎志雄
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Sekorm Component Network Co Ltd
Original Assignee
Shenzhen Sekorm Component Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Sekorm Component Network Co Ltd filed Critical Shenzhen Sekorm Component Network Co Ltd
Priority to CN202110936504.4A priority Critical patent/CN113778861A/en
Publication of CN113778861A publication Critical patent/CN113778861A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a page element automatic testing method and device based on a Jmeter and a computer terminal. The method comprises the following steps: s1, creating a Jmeter test plan, adding a thread group and a cycle controller in the Jmeter test plan, and setting test parameters of the thread group and the cycle controller; s2, adding an HTTP request in the Jmeter test plan, and configuring the page address of the page to be tested in the HTTP request; s3, adding a response assertion in the Jmeter test plan, wherein the response assertion is the position of the page element to be tested in the page to be tested; and S4, executing the Jmeter test plan to obtain test feedback data. The invention realizes the automatic test of the webpage elements by using a Jmeter tool, improves the test efficiency and reduces the labor cost.

Description

Page element automatic testing method and device based on Jmeter and computer terminal
Technical Field
The invention relates to the field of webpage testing, in particular to a method and a device for automatically testing webpage elements based on a meter and a computer terminal.
Background
The webpage needs to be tested after being compiled, manual testing is mainly used in the prior art, although some testing tools are used in the testing process, a large number of testing scripts still need to be compiled, more workers are needed in the testing process, a large amount of manpower is consumed, the testing cost is high, and the testing efficiency is low. The Jmeter tool is a popular open-source testing tool at present, is mostly used for automatic testing of various server software, interfaces and the like at present, and is not used for testing page elements of web pages.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method, an apparatus and a computer terminal for page element automated testing based on a Jmeter, aiming at the above-mentioned defects in the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows: a page element automatic testing method based on a Jmeter is constructed, and the method comprises the following steps:
s1, creating a Jmeter test plan, adding a thread group and a cycle controller in the Jmeter test plan, and setting test parameters of the thread group and the cycle controller;
s2, adding an HTTP request in the Jmeter test plan, and configuring the page address of a page to be tested in the HTTP request;
s3, adding a response assertion in the Jmeter test plan, wherein the response assertion is the position of a page element to be tested in the page to be tested;
and S4, executing the Jmeter test plan to obtain test feedback data.
Further, in the method for automatically testing page elements based on a meter according to the present invention, the step S1 of setting the test parameters of the thread group and the loop controller includes: and setting the thread number of the thread group and the cycle times of the cycle controller.
Further, in the method for automatically testing page elements based on a meter according to the present invention, the setting of the thread number of the thread group includes: and setting the thread number of the thread group and the duration of the thread number.
Further, in the method for automatically testing page elements based on a Jmeter according to the present invention, the thread group includes at least two thread numbers, and the setting of the thread number of the thread group and the duration of the thread number includes: setting the thread number of the thread group and the duration of each thread number;
the setting of the number of cycles of the cycle controller includes: and setting the cycle times of each thread number in the cycle controller.
Further, in the method for automatically testing page elements based on meter according to the present invention, the step S2 of configuring the page address of the page to be tested in the HTTP request includes: and configuring page addresses of at least two pages to be tested in the HTTP request.
Further, in the method for automatically testing page elements based on a meter according to the present invention, the step S3 includes: adding at least two response assertions in the Jmeter test plan, wherein each response assertion corresponds to the position of a page element to be tested in the page to be tested.
Further, in the method for automatically testing page elements based on a meter according to the present invention, after the step S4, the method further includes:
and S5, automatically comparing the test feedback data with preset normal data, and generating a configuration result tree and an aggregation report according to a comparison result.
In addition, the invention also provides a page element automatic testing device based on the Jmeter, which comprises:
the system comprises a test plan creating unit, a parameter setting unit and a parameter setting unit, wherein the test plan creating unit is used for creating a Jmeter test plan, adding a thread group and a cycle controller in the Jmeter test plan, and setting test parameters of the thread group and the cycle controller;
the page address setting unit is used for adding an HTTP request in the Jmeter test plan and configuring the page address of a page to be tested in the HTTP request;
the page element setting unit is used for adding a response assertion in the Jmeter test plan, wherein the response assertion is the position of a page element to be tested in the page to be tested;
and the execution unit is used for executing the Jmeter test plan to obtain test feedback data.
Further, the page element automation testing device based on the Jmeter of the present invention further comprises:
and the test result comparison unit is used for automatically comparing the test feedback data with preset normal data and generating a configuration result tree and an aggregation report according to a comparison result.
In addition, the invention also provides a computer terminal, which comprises a memory and a processor, wherein the processor is connected with the memory;
the memory is used for storing a computer program;
the processor is configured to execute a computer program stored in the memory to implement the page element automated testing method as described above.
The implementation of the page element automatic testing method and device based on the Jmeter and the computer terminal has the following beneficial effects: the invention realizes the automatic test of the webpage elements by using a Jmeter tool, improves the test efficiency and reduces the labor cost.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a flowchart of a method for automated testing of page elements based on a Jmeter according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for automated testing of page elements based on Jmeter according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a page element automation test device based on a meter according to an embodiment of the present invention.
Detailed Description
For a more clear understanding of the technical features, objects and effects of the present invention, embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
In a preferred embodiment, referring to fig. 1, the method for automatically testing page elements based on a meter of this embodiment is applied to a computer terminal, a page to be tested is a web page, the page to be tested includes a plurality of page elements to be tested, the page to be tested is stored in a server, and the computer terminal accesses the server to perform a test by executing a meter test plan. Specifically, the method for automatically testing the page elements based on the Jmeter comprises the following steps:
s1, creating a Jmeter test plan, adding a thread group and a loop controller in the Jmeter test plan, and setting the test parameters of the thread group and the loop controller, wherein the loop controller is used for controlling the execution of the thread group.
S2, adding an HTTP request in the Jmeter test plan, and configuring the page address of the page to be tested in the HTTP request. And in the process of executing the Jmeter test plan, accessing the page to be tested through the page address to obtain the feedback data of the page to be tested.
And S3, adding a response assertion in the Jmeter test plan, wherein the response assertion is the position of the page element to be tested in the page to be tested. It can be understood that the page to be tested often includes a plurality of page elements to be tested, but not all the page elements to be tested need to be tested, the page elements to be tested are selected to set the response assertion, the response assertion includes the position information and the test content of the page elements to be tested, that is, the response assertion can be positioned to the page elements to be tested, and the response assertion is added to the Jmeter test plan after the setting is completed.
And S4, executing the Jmeter test plan to obtain test feedback data. Specifically, when the meter test plan is executed, the page address of the page to be tested in the HTTP request is read first, and the page to be tested is accessed using the page address. Secondly, after the page to be tested is successfully accessed, all response assertions of the Jmeter test plan are read, the page elements to be tested corresponding to the response assertions are detected, each page element to be tested returns a test result, the test results of all the response assertions form test feedback data, and a tester judges whether the page elements to be tested are normal or not by analyzing the test feedback data.
According to the embodiment, the webpage elements are automatically tested by using the Jmeter tool, so that the testing efficiency is improved, and the labor cost is reduced.
In the method for automatically testing page elements based on a meter of some embodiments, the step S1 of setting the test parameters of the thread group and the loop controller includes: the thread number of the thread group is set, and the thread number can be one or more. And setting the cycle times of a cycle controller, wherein the cycle controller is used for controlling the execution times of each thread number, and automatically entering next execution after a certain thread number is executed once until the execution times reach the preset cycle times. According to the embodiment, multiple continuous execution of the thread number is realized by setting the cycle number, and the test efficiency is improved.
In the method for page element automated testing based on Jmeter of some embodiments, setting the thread number of the thread group includes: the thread number of the thread group and the duration of the thread number are set, and the duration of the thread number is the time for the thread number to be executed. In the embodiment, the testing time of the thread number is controlled by setting the duration, so that the diversified testing requirements are met, and the testing efficiency is improved.
In the method for page element automated testing based on Jmeter of some embodiments, the thread group includes at least two thread numbers, and setting the thread number of the thread group and the duration of the thread number includes: the number of threads of the thread group and the duration of each thread number are set. Meanwhile, setting the number of cycles of the cycle controller includes: the number of cycles per thread count in the cycle controller is set. In the embodiment, an individualized test strategy can be set for each thread number, so that the test diversification requirement is met.
In the method for automatically testing page elements based on a meter according to some embodiments, the step S2 of configuring the page address of the page to be tested in the HTTP request includes: and the page addresses of at least two pages to be tested in the HTTP request are configured, so that one Jmeter test plan can finish the test work of a plurality of pages to be tested, and the test efficiency is improved. Alternatively, an execution sequence of a plurality of pages to be tested can be set, and each page to be tested is tested in sequence according to the execution sequence.
In the method for automatically testing page elements based on a meter of some embodiments, the step S3 includes: at least two response assertions are added in the Jmeter test plan, and each response assertion corresponds to the position of a page element to be tested in a page to be tested. Alternatively, an execution sequence of the plurality of response assertions may be set, and the page elements to be tested corresponding to each response assertion may be executed in sequence according to the execution sequence. The Jmeter test plan of the embodiment comprises a plurality of response assertions, so that a plurality of page elements to be tested are tested at one time, and the test efficiency is improved.
In the method for automatically testing a page element based on a meter according to some embodiments, referring to fig. 2, after step S4, the method further includes:
and S5, automatically comparing the test feedback data with preset normal data, and generating a configuration result tree and an aggregation report according to the comparison result. Automatically comparing the test feedback data with preset normal data, and if the test feedback data is consistent with the preset normal data through comparison, indicating that the test is normal; if the test feedback data is inconsistent with the preset normal data, the test is abnormal. And displaying the abnormal page to be tested and the page elements to be tested when the test is abnormal, and modifying by a worker according to the abnormal page to be tested and the page elements to be tested. The embodiment can automatically judge the abnormal test data, greatly reduces the workload of testers and further reduces the labor cost.
In a preferred embodiment, referring to fig. 3, the meter-based page element automatic testing apparatus of this embodiment is applied to a computer terminal, a page to be tested is a web page, the page to be tested includes a plurality of page elements to be tested, the page to be tested is stored in a server, and the computer terminal accesses the server to perform a test by executing a meter test plan. Specifically, the page element automatic testing device based on the meter comprises:
and the test plan creating unit is used for creating a Jmeter test plan, adding a thread group and a loop controller in the Jmeter test plan, setting the test parameters of the thread group and the loop controller, and controlling the execution of the thread group by the loop controller.
And the page address setting unit is used for adding the HTTP request in the Jmeter test plan and configuring the page address of the page to be tested in the HTTP request. And in the process of executing the Jmeter test plan, accessing the page to be tested through the page address to obtain the feedback data of the page to be tested.
And the page element setting unit is used for adding a response assertion in the Jmeter test plan, and the response assertion is the position of the page element to be tested in the page to be tested. It can be understood that the page to be tested often includes a plurality of page elements to be tested, but not all the page elements to be tested need to be tested, the page elements to be tested are selected to set the response assertion, the response assertion includes the position information and the test content of the page elements to be tested, that is, the response assertion can be positioned to the page elements to be tested, and the response assertion is added to the Jmeter test plan after the setting is completed.
And the execution unit is used for executing the Jmeter test plan to obtain test feedback data. Specifically, when the meter test plan is executed, the page address of the page to be tested in the HTTP request is read first, and the page to be tested is accessed using the page address. Secondly, after the page to be tested is successfully accessed, all response assertions of the Jmeter test plan are read, the page elements to be tested corresponding to the response assertions are detected, each page element to be tested returns a test result, the test results of all the response assertions form test feedback data, and a tester judges whether the page elements to be tested are normal or not by analyzing the test feedback data.
According to the embodiment, the webpage elements are automatically tested by using the Jmeter tool, so that the testing efficiency is improved, and the labor cost is reduced.
The Jmeter-based page element automation testing apparatus of some embodiments further includes: and the test result comparison unit is used for automatically comparing the test feedback data with preset normal data and generating a configuration result tree and an aggregation report according to the comparison result. Automatically comparing the test feedback data with preset normal data, and if the test feedback data is consistent with the preset normal data through comparison, indicating that the test is normal; if the test feedback data is inconsistent with the preset normal data, the test is abnormal. And displaying the abnormal page to be tested and the page elements to be tested when the test is abnormal, and modifying by a worker according to the abnormal page to be tested and the page elements to be tested. The embodiment can automatically judge the abnormal test data, greatly reduces the workload of testers and further reduces the labor cost.
In a preferred embodiment, the computer terminal of this embodiment includes a memory and a processor, and the processor is connected to the memory. The memory is used for storing a computer program; the processor is used for executing the computer program stored in the memory to realize the page element automatic testing method of the embodiment. Alternatively, the computer terminal may be a desktop computer, a notebook computer, a tablet computer, a smart phone, and the like. The computer terminal of the embodiment uses a Jmeter tool to realize automatic testing of webpage elements, so that the testing efficiency is improved, and the labor cost is reduced.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above embodiments are merely illustrative of the technical ideas and features of the present invention, and are intended to enable those skilled in the art to understand the contents of the present invention and implement the present invention, and not to limit the scope of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be covered by the claims of the present invention.

Claims (10)

1. A page element automatic testing method based on a Jmeter is characterized by comprising the following steps:
s1, creating a Jmeter test plan, adding a thread group and a cycle controller in the Jmeter test plan, and setting test parameters of the thread group and the cycle controller;
s2, adding an HTTP request in the Jmeter test plan, and configuring the page address of a page to be tested in the HTTP request;
s3, adding a response assertion in the Jmeter test plan, wherein the response assertion is the position of a page element to be tested in the page to be tested;
and S4, executing the Jmeter test plan to obtain test feedback data.
2. The method for automated measuring of page elements based on Jmeter of claim 1, wherein the setting of the test parameters of the thread group and the loop controller in the step S1 comprises: and setting the thread number of the thread group and the cycle times of the cycle controller.
3. The method for page element automated testing based on Jmeter of claim 2, wherein the setting the thread number of the thread group comprises: and setting the thread number of the thread group and the duration of the thread number.
4. The method of claim 3, wherein the thread group comprises at least two thread numbers, and the setting of the thread number and the duration of the thread number of the thread group comprises: setting the thread number of the thread group and the duration of each thread number;
the setting of the number of cycles of the cycle controller includes: and setting the cycle times of each thread number in the cycle controller.
5. The method for page element automated testing based on Jmeter of claim 1, wherein the step S2 of configuring the page address of the page to be tested in the HTTP request comprises: and configuring page addresses of at least two pages to be tested in the HTTP request.
6. The method for automated measuring of page elements based on Jmeter of claim 1, wherein the step S3 comprises: adding at least two response assertions in the Jmeter test plan, wherein each response assertion corresponds to the position of a page element to be tested in the page to be tested.
7. The method for automated measuring of page elements based on Jmeter of claim 1, further comprising after the step S4:
and S5, automatically comparing the test feedback data with preset normal data, and generating a configuration result tree and an aggregation report according to a comparison result.
8. A page element automatic testing device based on a Jmeter is characterized by comprising:
the system comprises a test plan creating unit, a parameter setting unit and a parameter setting unit, wherein the test plan creating unit is used for creating a Jmeter test plan, adding a thread group and a cycle controller in the Jmeter test plan, and setting test parameters of the thread group and the cycle controller;
the page address setting unit is used for adding an HTTP request in the Jmeter test plan and configuring the page address of a page to be tested in the HTTP request;
the page element setting unit is used for adding a response assertion in the Jmeter test plan, wherein the response assertion is the position of a page element to be tested in the page to be tested;
and the execution unit is used for executing the Jmeter test plan to obtain test feedback data.
9. The Jmeter-based page element automation test device of claim 8, further comprising:
and the test result comparison unit is used for automatically comparing the test feedback data with preset normal data and generating a configuration result tree and an aggregation report according to a comparison result.
10. A computer terminal comprising a memory and a processor, said processor being coupled to said memory;
the memory is used for storing a computer program;
the processor is configured to execute a computer program stored in the memory to implement the page element automated testing method of claims 1 to 8.
CN202110936504.4A 2021-08-16 2021-08-16 Page element automatic testing method and device based on Jmeter and computer terminal Pending CN113778861A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110936504.4A CN113778861A (en) 2021-08-16 2021-08-16 Page element automatic testing method and device based on Jmeter and computer terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110936504.4A CN113778861A (en) 2021-08-16 2021-08-16 Page element automatic testing method and device based on Jmeter and computer terminal

Publications (1)

Publication Number Publication Date
CN113778861A true CN113778861A (en) 2021-12-10

Family

ID=78837822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110936504.4A Pending CN113778861A (en) 2021-08-16 2021-08-16 Page element automatic testing method and device based on Jmeter and computer terminal

Country Status (1)

Country Link
CN (1) CN113778861A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112817857A (en) * 2021-02-05 2021-05-18 深圳市世强元件网络有限公司 Method for automatically monitoring website abnormity based on JMeter and Jenkins and computer equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112817857A (en) * 2021-02-05 2021-05-18 深圳市世强元件网络有限公司 Method for automatically monitoring website abnormity based on JMeter and Jenkins and computer equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
四叶草134: "Jmeter-测试计划,线程组,取样器,逻辑控制器,断言和监听器", pages 1 - 29, Retrieved from the Internet <URL:《https://www.cnblogs.com/wz123/p/10243239.html》> *
想吃橘子鸭!: "Jmeter中使用断言的几种常用方式", Retrieved from the Internet <URL:https://www.cnblogs.com/jiajia6666/p/12797899.html> *
退乎: "jmeter 添加html断言, JMeter-断言", Retrieved from the Internet <URL:https://blog.csdn.net/weixin_36255837/article/details/118300291> *

Similar Documents

Publication Publication Date Title
CN109302522B (en) Test method, test device, computer system, and computer medium
US20130326486A1 (en) Keyword based software testing system and method
CN106055464B (en) Data buffer storage testing schooling pressure device and method
CN108664372A (en) Monitoring device, method and the computer readable storage medium of test process
CN111625434A (en) Database OLTP benchmark performance test method, system and related components
CN107992424A (en) Automatic test analysis method, application server and computer-readable recording medium
CN112817857A (en) Method for automatically monitoring website abnormity based on JMeter and Jenkins and computer equipment
CN114238071A (en) DCS software automatic verification system and method based on digital simulation technology
CN105389200A (en) Multi-group stimulation batch simulation method and system applied to super-large scale chip verification
CN114138670A (en) Method based on interface automation test and function, performance and safety test fusion
CN108287781B (en) Memory occupation monitoring method, device and system
CN111737065B (en) Interface test method and system of demand model based on server interface test
CN112486811A (en) Interface test method, device, equipment and medium
CN113126993A (en) Automatic testing method and system applied to vehicle detection software
CN113778861A (en) Page element automatic testing method and device based on Jmeter and computer terminal
CN111796578A (en) Vehicle controller testing method, device and system and storage medium
CN113127331A (en) Fault injection-based test method and device and computer equipment
CN115982045A (en) Interface automation test verification method and device, electronic equipment and storage medium
CN111177014B (en) Software automatic test method, system and storage medium
CN112530615B (en) Variable forcing method and system suitable for nuclear power station equipment
CN109800170B (en) Test method, test equipment and readable storage medium based on API test platform
US7546589B2 (en) Semi-automated desk checking system and method
CN114578210A (en) Mainboard test method, device, equipment and storage medium
CN111813665A (en) Big data platform interface data testing method and system based on python
CN111506490A (en) Automatic test method and device for application service interface and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination