CN115658532A - Automated case testing method, automated case testing apparatus, and storage medium - Google Patents

Automated case testing method, automated case testing apparatus, and storage medium Download PDF

Info

Publication number
CN115658532A
CN115658532A CN202211372688.7A CN202211372688A CN115658532A CN 115658532 A CN115658532 A CN 115658532A CN 202211372688 A CN202211372688 A CN 202211372688A CN 115658532 A CN115658532 A CN 115658532A
Authority
CN
China
Prior art keywords
test
tested
testing
case
automatic
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
CN202211372688.7A
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211372688.7A priority Critical patent/CN115658532A/en
Publication of CN115658532A publication Critical patent/CN115658532A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses an automatic case testing method, an automatic case testing device and a computer storage medium, wherein the automatic case testing method comprises the following steps: acquiring a test instruction of a user; extracting a test method from the automatic framework based on the test instruction, and reading a case to be tested in the data sheet by using the automatic framework; and automatically testing the cases to be tested by using a testing method, and returning a testing result. By the method, the test method and the case to be tested can be obtained from the automatic framework through the test instruction based on the user, the case to be tested is tested by the test method, and the automatic test case is compiled according to the user requirements, so that personalized automatic test is realized.

Description

Automated case testing method, automated case testing apparatus, and storage medium
Technical Field
The present application relates to the field of automated testing, and in particular, to an automated case testing method, an automated case testing apparatus, and a computer storage medium.
Background
With the continuous development of the internet industry, the software is larger and larger in scale and complex in structure in the software development process, so that each function and corresponding module of the software need to be tested. Due to the continuous expansion of the software application field, the test of the software system becomes more difficult and complicated, and the limitation of the traditional manual test is more and more obvious. Automated software testing techniques may overcome many of the problems of conventional testing techniques.
In an application scenario, an automated test can be performed by generating an automated test case by using an automated platform, but the method for performing a test by using an automated platform is not favorable for a tester to know the specific content of the test case, so that the method cannot be reused and is inconvenient for the tester to learn and improve the test case. And the update iteration cycle of the test case of the automation platform is too long, so that the version of the test file used in the test is backward and the actual requirements of the user cannot be met.
Disclosure of Invention
The technical problem mainly solved by the application is how to realize the personalized test of the automatic case. In view of the foregoing, the present application provides an automated case testing method, an automated case testing apparatus, and a computer storage medium.
In order to solve the technical problem, the application adopts a technical scheme that: an automated case testing method is provided, the method comprising: acquiring a test instruction of a user; extracting a test method from the automation framework based on the test instruction, and reading a case to be tested in the data sheet by using the automation framework; and automatically testing the case to be tested by using a testing method, and returning a testing result.
Before obtaining the test instruction of the user, the method further comprises the following steps: responding to a first input instruction of a user, and writing data to be tested into a data table; wherein, each row of data in the data table is a group of independent cases to be tested.
Before extracting the test method from the automation framework based on the test instruction, the method further comprises the following steps: and responding to a second input instruction of the user, and packaging a test method corresponding to the interface to be tested in the automation framework.
The method for automatically testing the cases to be tested by utilizing the testing method comprises the following steps: acquiring an interface to be tested based on the test instruction; inputting the case to be tested into the interface to be tested, and automatically testing the interface to be tested according to the testing method.
After the test method is used for automatically testing the cases to be tested, the method further comprises the following steps: comparing the test result with a preset result; and judging whether the functions of the interfaces to be tested are correct or not based on the comparison result.
The automation framework is TestNg, and the data sheet is excel sheet.
The method for automatically testing the cases to be tested by using the testing method comprises the following steps: writing the cases to be tested and the test methods into the same test class, and calling the cases to be tested respectively by the test methods to carry out automatic test; or independently writing the cases to be tested into a data class, writing the test method into a test class, and calling the data class in the test class to perform automatic test.
The automatic case testing method further comprises the following steps: upgrading the automation framework and the test method by using a maven library; the upgrading of the automation framework and the test method by using the maven library comprises the following steps: the automation framework and test method are upgraded using the maven's local warehouse, remote warehouse and/or central warehouse.
In order to solve the technical problem, the other technical scheme adopted by the application is as follows: an automated case testing apparatus is provided that includes a processor and a memory, the memory coupled to the processor, the memory storing program data, the processor for executing the program data to implement the automated case testing method as described above.
In order to solve the technical problem, the other technical scheme adopted by the application is as follows: a computer-readable storage medium is provided, which stores program data for implementing the above-mentioned automated case testing method when executed.
The beneficial effect of this application is: different from the situation of the prior art, the automatic case testing method provided by the application is applied to an automatic case testing device, and the automatic case testing device acquires a testing instruction of a user; extracting a test method from the automation framework based on the test instruction, and reading a case to be tested in the data sheet by using the automation framework; and automatically testing the cases to be tested by using a testing method, and returning a testing result. Through the mode, compared with a conventional automatic case testing method, the testing method which is adopted by the application and uses the automatic frame to obtain the testing method and the cases to be tested, and substitutes the cases to be tested into the testing method for testing can realize flexible testing of the automatic cases, so that the personalized requirements of users are met, and the users can adjust the testing method and the cases to be tested in the automatic frame according to the requirements of the users to obtain better testing results. The automatic case testing method can adjust the automatic cases according to the requirements of users, namely testing personnel, so as to obtain the automatic cases which are consistent with the requirements of the users, and the automatic cases are used for testing corresponding codes, so that more accurate and personalized results can be obtained.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Wherein:
fig. 1 is a schematic flowchart of an embodiment of an automated case testing method provided in the present application;
FIG. 2 is a data representation intent for use in the automated case testing apparatus provided herein;
FIG. 3 is a schematic block diagram of a first embodiment of an automated case testing apparatus provided herein;
FIG. 4 is a schematic diagram of a second embodiment of an automated case testing apparatus provided herein;
FIG. 5 is a schematic structural diagram of an embodiment of a computer-readable storage medium provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Software testing is the process of operating a program under specified conditions to discover bugs, to measure software quality, and to evaluate whether it can meet design requirements. It is used by developers to verify software functionality, test performance, and determine which defects need to be corrected. Because of the enormous scale of software and the increasing complexity of software projects, the traditional software testing by human testers cannot meet the time frame requirements of developers. Therefore, there is an increasing demand for automated testing and workflow to speed up the testing process while effectively ensuring integrity and consistency during the testing process.
The automated testing refers to the automation of software testing, an application program or a system is operated in a preset state, the preset conditions comprise normal and abnormal, and finally, the operation result is evaluated. And converting the artificially driven test behaviors into a process executed by a machine.
Referring to fig. 1, fig. 1 is a schematic flow chart of an embodiment of an automated case testing method provided in the present application.
Step 11: and acquiring a test instruction of a user.
Specifically, the user's test instructions include the program or software that the user wants to test, as well as the specific requirements regarding the test. The user can input a specific test instruction on the display screen, so that the automatic case testing device can acquire the detailed test instruction.
In an embodiment of the present application, before obtaining the test instruction of the user, the method further includes: responding to a first input instruction of a user, and writing data to be tested into a data table; wherein, each row of data in the data table is a group of independent cases to be tested.
Referring to fig. 2, fig. 2 is a schematic representation of data used in an automated case testing apparatus provided herein. The data table may be an excel table, and a user inputs data to be tested to the table by inputting the data to be tested to the table, where each line of data in the table is an automated case to be tested, i.e., a test scenario, and includes all parameters required in the test scenario. Each column represents a class of input parameters. The automated case testing apparatus may automatically read each row of data in the data table in sequence. The excel table is used for storing the test data, and the test data and the test codes are stored separately, so that a user can conveniently modify and maintain the test data, and the separate management of the test codes and the test data is realized.
In an embodiment of the present application, as shown in the first row of fig. 2, an automated case named as inquiring debit card short-cut payment protocol information may be tested, where the test parameters further include a service return code, a service type number, a customer information management number, a bank card number, and the like, and are used to test whether the function of inquiring debit card short-cut payment protocol information in software is correct.
Optionally, the user may also enter written test methods into the automated case testing apparatus for testing test data from the cases to be tested from the data sheet. The automatic case testing device can package the testing method transmitted by the user and store the testing method in the automatic framework in the form of jar package, so that the testing method contained in the jar package can be used in a subsequent testing mode by introducing the jar package. The jar package merges a series of files into a single compressed file.
The automated testing framework is a framework used for automated testing. The automated framework is a tool set composed of one or more automated testing basic modules, automated testing management modules, automated testing statistical modules and the like.
In an embodiment of the application, a TestNg frame can be used as an automation frame in an automatic case testing device, and the TestNg frame is a test frame in Java and supports comprehensive class testing and multi-thread testing.
In an embodiment of the present application, the automated case testing apparatus may also upgrade the automated framework and the testing method using a local warehouse of the maven library, a remote warehouse, and/or a central warehouse. The automatic case testing device manages the automatic framework and the version of the jar package packaged in the framework through the maven library, and therefore rapid upgrading iteration of the automatic framework is achieved.
Specifically, the maven warehouse stores all the components shared by the maven project, such as any one dependency, plug-in, or output of project building. The automatic case testing device updates the automatic frame and the testing method by utilizing the maven warehouse, comprises the steps of firstly searching for a required upgrading file under a local directory of the whole project, if the required upgrading file is not found, searching for the upgrading file from the remote warehouse, and if the required upgrading file is not found, searching for the upgrading file in the central warehouse.
The remote warehouse serves a warehouse erected in the local area network, and the private server acts on the remote warehouse on the wide area network and is used by a maven user in the local area network. When the automatic case testing device needs to download the upgrade file, the automatic case testing device requests from the private server, if the upgrade file does not exist on the private server, the automatic case testing device downloads the upgrade file from an external remote warehouse, and after the upgrade file is cached on the private server, the automatic case testing device provides service for the download request of maven. The central repository, i.e. the external remote repository, contains the most popular open source Java components in the world, as well as source code, author information, license information, etc. The central repository is configured to complete between automated testing by the automated case testing apparatus.
Step 12: and extracting the test method from the automation framework based on the test instruction, and reading the case to be tested in the data sheet by using the automation framework.
Optionally, the automatic case testing device can write the cases to be tested and the testing method into the same testing class, and the testing method calls all the cases to be tested respectively to perform automatic testing; or independently writing the cases to be tested into a data class, writing the test method into a test class, and calling the data class in the test class to perform automatic test. When test data are more, through the mode of depositing respectively, can be favorable to the maintenance of data more, can also realize lazy loading, and the automatic case testing arrangement can be one by one when a large amount of data need be tested load data promptly, and need not once only load data to the memory in, avoided the waste of memory and the danger that the possible memory is not enough.
Step 13: and automatically testing the case to be tested by using a testing method, and returning a testing result.
Specifically, the automatic case testing device acquires an interface to be tested based on a testing instruction; inputting the case to be tested into the interface to be tested, and automatically testing the interface to be tested according to the testing method. Each case to be tested is input into the interface to be tested for testing until all cases to be tested are tested. The specific input instruction needs to be automatically coded in the automatic case testing device by a user to realize the calling of the interface, so that the testing purpose is achieved. The method has the advantages that the automatic case test writing with codes is realized by simply writing the calling codes by the user, the coding practice of the user can be increased, the code operation capability and the code reading capability are improved, and the method is favorable for accelerating the progress of putting the test into the actual development process.
Specifically, after the automated case testing device performs an automated test on a case to be tested by using a testing method, the method further includes: comparing the test result with a preset result; and judging whether the function of the interface to be tested is correct or not based on the comparison result.
Different from the prior art, the automatic case testing method provided by the application is applied to an automatic case testing device, and the automatic case testing device acquires a testing instruction of a user; extracting a test method from the automatic framework based on the test instruction, and reading a case to be tested in the data sheet by using the automatic framework; and automatically testing the case to be tested by using a testing method, and returning a testing result. Through the mode, compared with a conventional automatic case testing method, the testing method for obtaining the testing method and the cases to be tested by using the automatic frame and substituting the cases to be tested into the testing method for testing can achieve flexible testing of the automatic cases, so that personalized requirements of users are met, and the users can adjust the testing method and the cases to be tested in the automatic frame according to the requirements of the users to obtain better testing results. The automatic case testing method can adjust the automatic cases according to the requirements of users, namely testers, so as to obtain the automatic cases which are consistent with the requirements of the users, and the automatic cases are used for testing corresponding codes, so that more accurate and personalized results can be obtained.
The method of the above embodiment may be implemented by using an automated case testing apparatus, which is described below with reference to fig. 3, where fig. 3 is a schematic structural diagram of a first embodiment of the automated case testing apparatus provided in the present application.
As shown in fig. 3, the automated case testing apparatus 30 of the embodiment of the present application includes an obtaining module 31, an extracting module 32, and a testing module 33.
The obtaining module 31 is configured to obtain a test instruction of a user.
And the extracting module 32 is used for extracting the testing method from the automation framework based on the testing instruction, and reading the case to be tested in the data table by using the automation framework.
And the test module 33 is configured to perform an automatic test on the case to be tested by using a test method, and return a test result.
The method of the above embodiment may be implemented by using an automated case testing apparatus, and referring to fig. 4, fig. 4 is a schematic structural diagram of a second embodiment of the automated case testing apparatus provided in the present application, where the automated case testing apparatus 40 includes a memory 41 and a processor 42, the memory 41 is used for storing program data, and the processor 42 is used for executing the program data to implement the following method:
acquiring a test instruction of a user; extracting a test method from the automatic framework based on the test instruction, and reading a case to be tested in the data sheet by using the automatic framework; and automatically testing the cases to be tested by using a testing method, and returning a testing result.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of a computer-readable storage medium provided in the present application, where the computer-readable storage medium 50 stores program data 51, and when the program data 51 is executed by a processor, the program data is used to implement the following methods:
acquiring a test instruction of a user; extracting a test method from the automation framework based on the test instruction, and reading a case to be tested in the data sheet by using the automation framework; and automatically testing the cases to be tested by using a testing method, and returning a testing result.
Embodiments of the present application may be implemented in software functional units and may be stored in a computer readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solutions of the present application, which are essential or contributing to the prior art, or all or part of the technical solutions may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application or are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (10)

1. An automated case testing method, comprising:
acquiring a test instruction of a user;
extracting a test method from an automation framework based on the test instruction, and reading a case to be tested in a data sheet by using the automation framework;
and automatically testing the cases to be tested by using the testing method, and returning a testing result.
2. The automated case testing method of claim 1,
before the obtaining of the test instruction of the user, the method further includes:
responding to a first input instruction of a user, and writing data to be tested into the data table;
wherein each row of data in the data table is a group of independent cases to be tested.
3. The automated case testing method of claim 1 or 2,
before the extracting of the test method from the automation framework based on the test instruction, the method further comprises:
and responding to a second input instruction of the user, and packaging a test method corresponding to the interface to be tested in the automation frame.
4. The automated case testing method of claim 3, wherein
The automatic test of the case to be tested by using the test method comprises the following steps:
acquiring the interface to be tested based on the test instruction;
and inputting the case to be tested into the interface to be tested, and automatically testing the interface to be tested according to the testing method.
5. The automated case testing method of claim 3,
after the test method is used for carrying out automatic test on the case to be tested, the method further comprises the following steps:
comparing the test result with a preset result;
and judging whether the functions of the interfaces to be tested are correct or not based on the comparison result.
6. The automated case testing method of claim 1,
the automatic frame is TestNg, and the data sheet is an excel sheet.
7. The automated case testing method of claim 1,
the automatic test of the case to be tested by using the test method comprises the following steps:
writing the cases to be tested and the testing method into the same testing class, and calling the cases to be tested respectively by the testing method to carry out automatic testing;
or writing the cases to be tested into a data class separately, writing the test method into a test class, and calling the data class in the test class to perform automatic test.
8. The automated case testing method of claim 1,
the automatic case testing method further comprises the following steps:
upgrading the automation framework and the test method by using a maven library;
the upgrading the automation framework and the test method by using the maven library comprises the following steps:
the automation framework and the test method are upgraded using the local warehouse, remote warehouse and/or central warehouse of the maven.
9. An automated case testing apparatus, comprising a memory and a processor coupled to the memory;
wherein the memory is configured to store program data and the processor is configured to execute the program data to implement the automated case testing method of any of claims 1 to 8.
10. A computer storage medium for storing program data for implementing an automated case testing method according to any one of claims 1 to 8 when executed by a computer.
CN202211372688.7A 2022-11-03 2022-11-03 Automated case testing method, automated case testing apparatus, and storage medium Pending CN115658532A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211372688.7A CN115658532A (en) 2022-11-03 2022-11-03 Automated case testing method, automated case testing apparatus, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211372688.7A CN115658532A (en) 2022-11-03 2022-11-03 Automated case testing method, automated case testing apparatus, and storage medium

Publications (1)

Publication Number Publication Date
CN115658532A true CN115658532A (en) 2023-01-31

Family

ID=84996278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211372688.7A Pending CN115658532A (en) 2022-11-03 2022-11-03 Automated case testing method, automated case testing apparatus, and storage medium

Country Status (1)

Country Link
CN (1) CN115658532A (en)

Similar Documents

Publication Publication Date Title
US9274930B2 (en) Debugging system using static analysis
US7895575B2 (en) Apparatus and method for generating test driver
CN111782266B (en) Software performance benchmark determination method and device
CN111784108B (en) Modeling method and device of main data management platform
CN110196720B (en) Optimization method for generating dynamic link library by Simulink
CN115357515B (en) Debugging method and device of multi-core system, computer equipment and storage medium
CN112631903A (en) Task testing method and device, electronic equipment and storage medium
CN111752841A (en) Single test simulation method, device, equipment and computer readable storage medium
CN111143228B (en) Test code generation method and device based on decision table method
CN115658532A (en) Automated case testing method, automated case testing apparatus, and storage medium
CN114661615B (en) FPGA software testing method and device
CN113064895B (en) Incremental updating method, device and system for map
CN115269431A (en) Interface testing method and device, electronic equipment and storage medium
CN113157590A (en) Test case generation method and device
CN111400190A (en) Automatic test flow generation method and device and computer readable storage medium
CN113672222A (en) Application program interface management device and construction method thereof
CN111414194A (en) Interface information generation method and system, electronic equipment and storage medium
CN112115010B (en) Simulation test method of self-service equipment, intelligent terminal and storage medium
CN112148581A (en) Code specification checking method, device, system and storage medium
CN112181834B (en) Method, device and equipment for debugging lua based on gdb and storage medium
CN114944998B (en) Internet of things system testing method and device based on simulator
CN113626043B (en) Automatic packaging method and system for container development environment based on Kubernetes
CN113377677B (en) Unit testing method and device
CN117873607A (en) Processing method and device for target operation corresponding to custom function
CN117149622A (en) Test method and device based on vehicle-mounted SOA and electronic equipment

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