CN112559345A - LoadRunner-based interface testing method, computer equipment and storage medium - Google Patents

LoadRunner-based interface testing method, computer equipment and storage medium Download PDF

Info

Publication number
CN112559345A
CN112559345A CN202011466705.4A CN202011466705A CN112559345A CN 112559345 A CN112559345 A CN 112559345A CN 202011466705 A CN202011466705 A CN 202011466705A CN 112559345 A CN112559345 A CN 112559345A
Authority
CN
China
Prior art keywords
interface
loadrunner
document
test
testing method
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
CN202011466705.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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN202011466705.4A priority Critical patent/CN112559345A/en
Publication of CN112559345A publication Critical patent/CN112559345A/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/3684Test management for test design, e.g. generating new test cases
    • 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

Abstract

The invention discloses an automatic interface testing method based on LoadRunner, which comprises the following steps: step 1, reading docx interface document content, and at least obtaining the following data information: url address, request parameter, return code, return information, request mode, port; step 2, writing the data information obtained in the step 1 into a new interface test case document and outputting the new interface test case document; step 3, repeating the steps 1 and 2 until the last line of the docx interface document; step 4, compiling a Java interface test script by using a LoadRunner tool; and 5, executing the test script by the LoadRunner and outputting the test result to a result document. The method can directly and automatically generate the test case according to the docx interface document provided by the developer, and can directly and efficiently test according to the automatically generated test case document.

Description

LoadRunner-based interface testing method, computer equipment and storage medium
Technical Field
The invention relates to the technical field, in particular to an automatic interface testing method based on LoadRunner, computer equipment and a storage medium.
Background
The interface test method in the prior art comprises the following procedures:
the first step is as follows: developing a docx interface document for providing test use; the second step is that: the tester compiles a test case according to the docx interface document; the third step: testing; the fourth step: and (6) storing the result.
The existing testing method has the following technical defects:
1. when the development of interface documents is complex, the number of interfaces to be tested is large, and the parameters are complex, the test cases are compiled according to the development and supply interface documents, and interface test omission and test case data errors may exist.
2. The test case compiling efficiency is low.
Disclosure of Invention
The invention aims to overcome the defects in the background art, and provides an automatic interface testing method based on LoadRunner, computer equipment and a storage medium, which can reduce the process of compiling test cases by testers according to docx interface documents, can directly automatically generate test cases according to the docx interface documents provided by developers, and can directly perform rapid and efficient testing according to the automatically generated test case documents.
In order to achieve the technical effects, the invention adopts the following technical scheme:
an automatic interface testing method based on LoadRunner comprises the following steps:
step 1, reading docx interface document content, and at least obtaining the following data information: url address, request parameter, return code, return information, request mode, port; wherein the docx interface document can be directly provided by a developer;
step 2, writing the data information obtained in the step 1 into a new interface test case document and outputting the new interface test case document;
step 3, repeating the steps 1 and 2 until the last line of the docx interface document;
step 4, compiling a Java interface test script by using a LoadRunner tool;
and 5, executing the test script by the LoadRunner and outputting the test result to a result document.
In the automatic interface test method based on the LoadRunner, a tester takes a docx interface document as input to carry out interface test, the result is output, and the output result comprises a test case document and an interface test result document, wherein the developed docx interface document is input into an analysis module, and data such as an interface url address, a request mode, a request parameter and the like which are rapidly and automatically analyzed are automatically transmitted to a corresponding position of an HTTP interface automatic script corresponding to the LoadRunner to carry out automatic interface test, and the analyzed interface url address, the analyzed request mode and the request parameter are automatically output to the test case document to be stored, so that the test efficiency can be effectively improved, and the problem of test failure caused by manual links in the prior art is solved.
Further, in the step 1, the docx interface document is automatically read and written by using xwpfwordextra of the POI related package in Java.
Further, the new interface test case document in the step 2 adopts xwpfdockent in the POI jar package.
Furthermore, the Java interface test script comprises a domain name, a port, a URL address, a request mode, a request parameter, a parameter transmission mode, a return code, and return information.
Furthermore, the address, the request mode, the request parameter and the port data in the Java interface test script are occupied by parameter names.
Further, in the step 5, a Java fprintf method is specifically adopted to output the test result to the result document.
Further, still include:
and 6, comparing the output new interface test case document with the docx interface document content.
Further, a manual comparison mode is specifically adopted in the step 6.
Meanwhile, the invention also discloses computer equipment which comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the processor realizes the steps of the LoadRunner-based interface automatic testing method when executing the computer program.
Meanwhile, the invention also discloses a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program realizes the steps of the automatic interface testing method based on LoadRunner when being executed by a processor.
Compared with the prior art, the invention has the following beneficial effects:
the automatic interface test method, the computer equipment and the storage medium based on the LoadRunner can realize that the automatic interface test is directly carried out according to docx interface documents provided by developers, test results and test case documents are generated, the process that the testers compile the test cases according to the interface documents can be reduced, the test cases are automatically generated according to the docx interface documents provided by the developers, and the rapid and efficient test is directly carried out according to the automatically generated interface documents.
Drawings
Fig. 1 is a schematic flow chart of the LoadRunner-based interface automated testing method of the present invention.
Detailed Description
The invention will be further elucidated and described with reference to the embodiments of the invention described hereinafter.
Example (b):
the first embodiment is as follows:
as shown in fig. 1, an interface automation test method based on LoadRunner aims to improve the efficiency of interface test script development, an interface test tool of the embodiment uses LoadRunner11, selects a JavaVuser protocol, and uses Java as a programming language. The method specifically comprises the following steps:
step 1, reading docx interface document content, and at least obtaining the following data information: url address, request parameter, return code, return information, request mode, port, etc.
Wherein the docx interface document can be provided directly by a developer.
Specifically, in this embodiment, the POI related package in Java is used to quickly and automatically read and write the provided docx interface document: the core of the method is that XWPFWordExtractor is used for reading docx interface document content and acquiring keywords: url address, request parameter, return code, return information, request mode, port, etc.
Specifically, in this embodiment, the step is implemented by importing a jar packet and a related dependent packet that require a poi-scratch pad, and reading the docx interface document file is performed through an xwpf module in the jar packet, specifically, writing a Java method to obtain data such as a keyword url address, a request parameter, a return code, return information, a request mode, a port, and the like through line-by-line matching of a regular expression.
And 2, writing the data information acquired in the step 1 into a new interface test case document and outputting the new interface test case document.
The new interface test case document is realized by adopting XWPFDoccuent in a POI jar packet, namely the output new interface test case document is realized by adopting a core method XWPFDoccuent in the POI jar packet, and the realization pseudo code is as follows:
new an empty XWPFDocument: xwpfdockent doc ═ new xwpfdockent ().
And then writing the url address, the request parameter, the return code, the return information, the request mode, the port and other data acquired in the step 1 into XWPFDcolumn and outputting the XWPFDcolumn.
Step 3, repeating the steps 1 and 2 until the last line of the docx interface document;
and 4, compiling a Java interface test script template by using a LoadRunner tool.
Specifically, a domain name, a port and a URL address are added to the template to construct an address with a complete interface; an HTTP request of an interface is required to be constructed through a request mode, a parameter transmission mode and an incoming parameter; check point data is needed to verify whether the request return is correct; when the checkpoint fails, the returned error content needs to be extracted.
Specifically, in this embodiment, the changed data such as the request address, the request mode, the request parameter, the port, and the like in the Java interface script are occupied by the parameter name, the parsing module script and the interface test script are located in the same jar packet, and the data is transmitted to the parameter position corresponding to the Java interface test script by the method of obtaining the url address, the request parameter, the return code, the return information, the request mode, and the port through the parsing module.
And 5, executing the test script by the LoadRunner and outputting the test result to a result document.
In this embodiment, the interface response result is obtained and automatically output to the document by using a Java fprintf method.
And 6, comparing the output new interface test case document with the docx interface document content.
In this embodiment, a manual comparison method is specifically adopted.
In the automatic interface test method based on the LoadRunner, a tester takes a docx interface document as input to carry out interface test, the result is output, and the output result comprises a test case document and an interface test result document, wherein the developed docx interface document is input into an analysis module, and data such as an interface url address, a request mode, a request parameter and the like which are rapidly and automatically analyzed are automatically transmitted to a corresponding position of an HTTP interface automatic script corresponding to the LoadRunner to carry out automatic interface test, and the analyzed interface url address, the analyzed request mode and the request parameter are automatically output to the test case document to be stored, so that the test efficiency can be effectively improved, and the problem of test failure caused by manual links in the prior art is solved.
Example two
The embodiment discloses a computer device which can be a server and comprises a processor, a memory, a network interface and a database which are connected through a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing data related to the LoadRunner-based interface automation test method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a LoadRunner-based interface automated testing method.
In another embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and when the processor executes the computer program, the steps of the LoadRunner-based interface automation testing method in the first embodiment are implemented, and are not described herein again to avoid repetition.
In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the LoadRunner-based interface automation testing method in the first embodiment. To avoid repetition, further description is omitted here.
It will be understood that the above embodiments are merely exemplary embodiments taken to illustrate the principles of the present invention, which is not limited thereto. It will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the spirit and substance of the invention, and these modifications and improvements are also considered to be within the scope of the invention.

Claims (10)

1. An automatic interface testing method based on LoadRunner is characterized by comprising the following steps:
step 1, reading docx interface document content, and at least obtaining the following data information: url address, request parameter, return code, return information, request mode, port;
step 2, writing the data information obtained in the step 1 into a new interface test case document and outputting the new interface test case document;
step 3, repeating the steps 1 and 2 until the last line of the docx interface document;
step 4, compiling a Java interface test script by using a LoadRunner tool;
and 5, executing the test script by the LoadRunner and outputting the test result to a result document.
2. The LoadRunner-based interface automation test method according to claim 1, wherein XWPFWordExtractor of a POI-related package in Java is specifically used in step 1 to automatically read and write docx interface documents.
3. The automatic interface testing method based on the LoadRunner as claimed in claim 2, wherein the new interface test case document in the step 2 is XWPFDoccuent in the POI jar package.
4. The automatic interface testing method based on the LoadRunner as claimed in claim 1, wherein the Java interface testing script comprises a domain name, a port, a URL address, a request mode, a request parameter, a parameter transmission mode, a return code and return information.
5. The automatic interface testing method based on the LoadRunner as claimed in claim 4, wherein the Java interface test script uses parameter name occupation for request address, request mode, request parameter and port data.
6. The LoadRunner-based interface automation testing method as claimed in claim 1, wherein in step 5, a Java fprintf method is specifically adopted to output the testing result to a result document.
7. The LoadRunner-based interface automated testing method according to any one of claims 1 to 6, further comprising:
and 6, comparing the output new interface test case document with the docx interface document content.
8. The automatic interface testing method based on the LoadRunner as claimed in claim 7, wherein step 6 specifically adopts a manual comparison mode.
9. A computer device comprising a memory, a processor and a computer program stored in said memory and executable on said processor, characterized in that said processor implements the steps of the LoadRunner-based interface automation test method according to any one of claims 1 to 8 when executing said computer program.
10. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the LoadRunner-based interface automation testing method according to any one of claims 1 to 8.
CN202011466705.4A 2020-12-14 2020-12-14 LoadRunner-based interface testing method, computer equipment and storage medium Pending CN112559345A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011466705.4A CN112559345A (en) 2020-12-14 2020-12-14 LoadRunner-based interface testing method, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011466705.4A CN112559345A (en) 2020-12-14 2020-12-14 LoadRunner-based interface testing method, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112559345A true CN112559345A (en) 2021-03-26

Family

ID=75064393

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011466705.4A Pending CN112559345A (en) 2020-12-14 2020-12-14 LoadRunner-based interface testing method, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112559345A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277511A (en) * 2022-06-23 2022-11-01 安徽希施玛数据科技有限公司 Recording method, recording device, electronic device, and computer-readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160299837A1 (en) * 2011-07-21 2016-10-13 International Business Machines Corporation Software test automation systems and methods
CN110427331A (en) * 2019-09-03 2019-11-08 四川长虹电器股份有限公司 The method for automatically generating performance test script based on interface testing tool
CN110716870A (en) * 2019-09-23 2020-01-21 中国建设银行股份有限公司 Automatic service testing method and device
CN110825619A (en) * 2019-10-12 2020-02-21 深圳壹账通智能科技有限公司 Automatic generation method and device of interface test case and storage medium
CN111510330A (en) * 2020-04-10 2020-08-07 中国联合网络通信集团有限公司 Interface management apparatus, method and storage medium
CN111949520A (en) * 2020-07-31 2020-11-17 上海中通吉网络技术有限公司 Automatic interface test method and equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160299837A1 (en) * 2011-07-21 2016-10-13 International Business Machines Corporation Software test automation systems and methods
CN110427331A (en) * 2019-09-03 2019-11-08 四川长虹电器股份有限公司 The method for automatically generating performance test script based on interface testing tool
CN110716870A (en) * 2019-09-23 2020-01-21 中国建设银行股份有限公司 Automatic service testing method and device
CN110825619A (en) * 2019-10-12 2020-02-21 深圳壹账通智能科技有限公司 Automatic generation method and device of interface test case and storage medium
CN111510330A (en) * 2020-04-10 2020-08-07 中国联合网络通信集团有限公司 Interface management apparatus, method and storage medium
CN111949520A (en) * 2020-07-31 2020-11-17 上海中通吉网络技术有限公司 Automatic interface test method and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MEIMENG: "POI解析Word中文API", 《HTTPS://WWW.JIANSHU.COM/P/AAEA598D26E2?UTM_CAMPAIGN=MALESKINE&UTM_CONTENT=NOTE&UTM_MEDIUM=SEO_NOTES&UTM_SOURCE=RECOMMENDATION》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277511A (en) * 2022-06-23 2022-11-01 安徽希施玛数据科技有限公司 Recording method, recording device, electronic device, and computer-readable storage medium

Similar Documents

Publication Publication Date Title
US9015671B2 (en) Integrating program construction
US8458681B1 (en) Method and system for optimizing the object code of a program
US7150006B2 (en) Techniques for managed code debugging
US9424008B2 (en) API descriptions
US8429632B1 (en) Method and system for debugging merged functions within a program
CN109597618B (en) Program development method, program development device, computer device, and storage medium
CN110737631A (en) data analysis method and device based on Flink engine
CN109542464B (en) Development and deployment system, method and storage medium of IoT (Internet of things) equipment script program
US8881126B2 (en) Systems and methods for testing a compiler through compile-time decision feedback
CN112559345A (en) LoadRunner-based interface testing method, computer equipment and storage medium
CN117009231B (en) Automatic generation method and device for high-reliability unit test based on conversational large language model
CN113591422A (en) System for generating test case flow information in chip verification and application
CN117370217A (en) Automatic interface test result generation method based on python
CN115470152B (en) Test code generation method, test code generation device, and storage medium
CN111124937A (en) Method and system for assisting in improving test case generation efficiency based on instrumentation function
CN116340169A (en) XPath path detection method and device for page element
CN116048481A (en) Service information processing system and method
CN114816364A (en) Method, device and application for dynamically generating template file based on Swagger
CN114780420A (en) Method, device, equipment and storage medium for automatic test based on test case
CN114661615A (en) FPGA software testing method and device
Wang et al. Application of model-based testing on a quorum-based distributed storage
JP2021111389A (en) Improvement in parsability of code snippet
CN111813665A (en) Big data platform interface data testing method and system based on python
CN111694729A (en) Application testing method and device, electronic equipment and computer readable medium
CN113312080B (en) System, device and method for updating chip software and hardware configuration in chip EDA simulation

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210326