CN113485919A - Test method, test device and computer readable storage medium - Google Patents
Test method, test device and computer readable storage medium Download PDFInfo
- Publication number
- CN113485919A CN113485919A CN202110740117.3A CN202110740117A CN113485919A CN 113485919 A CN113485919 A CN 113485919A CN 202110740117 A CN202110740117 A CN 202110740117A CN 113485919 A CN113485919 A CN 113485919A
- Authority
- CN
- China
- Prior art keywords
- test
- page
- interface
- test case
- function
- 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.)
- Granted
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 470
- 238000010998 test method Methods 0.000 title claims abstract description 12
- 238000000034 method Methods 0.000 claims abstract description 21
- 230000006870 function Effects 0.000 claims description 99
- 238000004590 computer program Methods 0.000 claims description 8
- 238000013515 script Methods 0.000 abstract description 11
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000009825 accumulation Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test 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)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The invention discloses a test method, a test device and a computer readable storage medium, wherein the method comprises the following steps: according to a function to be tested of equipment, compiling a test case file corresponding to the function to be tested, wherein the test case file comprises a first page and a second page; importing the test case file into a test frame, and executing a test according to the test case file; and generating a test report according to the test case file with the completed test. The invention solves the problem that the existing test method needs to generate a test script through a test case and then automatically test.
Description
Technical Field
The present invention relates to the field of automated testing technologies, and in particular, to a testing method, a testing apparatus, and a computer-readable storage medium.
Background
The existing Python-based interface automatic test method comprises the steps of defining an interface template and a test case template, reading a test case, calling an interface to send a request, analyzing an interface return message and outputting a test report. The Python-based automatic interface testing method follows the basic principle of a testing framework, separates service logic from a testing script, separates the testing script from testing data, and can be changed according to requirements at any time.
Firstly, the defects of the scheme are that the test case is equivalent to the test script and only reflects the function of the test script, but the real test case is a necessary condition for guiding a tester to test, and the readability and the editability of the test case have great influence on the tester to execute the test.
Secondly, the above scheme mainly aims at the interface test of a client to a server in a network, and one script is executed by one line of case, the number of test scripts to be executed is expected to be huge, and for the interface test of the embedded device, the script needs to be downloaded into the device, and the memory of the embedded device is limited, so that the huge number of test scripts cannot be supported.
Disclosure of Invention
The invention mainly aims to provide a testing method, a testing device and a computer readable storage medium, and aims to solve the problem that equipment cannot support a huge number of testing scripts in the existing automatic testing method.
In order to achieve the above object, the present invention provides a test method, comprising the steps of:
according to a function to be tested of equipment, compiling a test case file corresponding to the function to be tested, wherein the test case file comprises a first page and a second page;
importing the test case file into a test frame, and executing a test according to the test case file;
and generating a test report according to the test case file with the completed test.
Optionally, the step of writing a test case file corresponding to the function to be tested according to the function to be tested of the device includes:
according to the functions to be tested of the equipment, writing a first page of the test case file according to columns, wherein the first page comprises: the function interface serial number, the function interface name, the first expected result, the parameter of the first test case and the element of the first test case;
according to the functions to be tested of the equipment, writing a second page of the test case file according to columns, wherein the second page comprises: the second test case self element, the test case number, the function interface calling sequence, the cycle number, the single-interface test interface, the second expected result and the test return result.
Optionally, the second page comprises a cycle number; the step of importing the test case file into a test framework and executing the test according to the test case file comprises the following steps:
importing the test case file into a test frame, and sequentially executing the test case file according to the test case number of the second page, wherein the test case file comprises sub test cases;
recording the execution times of executing the sub-test cases;
judging the test type of the sub-test case according to the second page, and executing a test flow corresponding to the test type;
and exporting the test case file with the completed test according to the cycle times, the execution times and the test case file.
Optionally, the second page includes a single interface test interface; the step of judging the test type of the test case file according to the second page and executing the test flow corresponding to the test type comprises the following steps:
judging whether a single-interface test interface in the second page has a record or not;
if the single interface test interface exists, performing a single interface test process according to the recorded single interface test interface;
and if not, executing the service logic test flow.
Optionally, the first page includes a first expected result and an entry parameter; the second page comprises a function interface calling sequence; the step of performing the single interface test flow according to the recorded single interface test interface comprises the following steps:
reading a function interface calling sequence of the second page, searching a function interface serial number of the first page according to the interface calling sequence of the second page, reading a first parameter of the row where the function interface serial number is located in the first page except the single-interface test interface, and reading all parameter of the row where the function interface serial number corresponding to the single-interface test interface is located in the first page;
and calculating the number of input parameters in the single-interface test interface, and executing the sub-test cases with the number of times corresponding to the number of the input parameters according to the read input parameters and the calling sequence of the second page function interface.
Optionally, the second page includes a second expected result and a test return result; the step of calculating the number of the input parameters in the single-interface test interface and executing the sub-test cases with the number of times corresponding to the number of the input parameters according to the read input parameters and the calling sequence of the second page function interface comprises the following steps:
judging whether the test result of each executed sub-test case is consistent with a second expected result in a second page or not, and outputting a test conclusion;
and filling the test conclusion into a test return result in the second page.
Optionally, the first page includes a function interface serial number; the second page comprises a function interface calling sequence and a test return result; the step of executing the business logic test flow comprises;
reading a function interface calling sequence of the second page, searching a function interface serial number of the first page according to the function interface calling sequence of the second page, and reading a first parameter of the row of the function interface serial number in the first page;
according to the interface calling sequence of the second page, sequentially executing the sub-test cases which correspond to the interface calling sequence and contain the first parameter;
judging whether the test result of the executed sub-test case is consistent with a second expected result in a second page or not, and outputting a test conclusion;
and filling the test conclusion into a test return result in the second page.
Optionally, the second page comprises a cycle number; the step of exporting the test case file with the completed test according to the cycle number, the execution number and the test case file comprises the following steps:
judging whether the cycle times are equal to the execution times or not;
if not, accumulating by a preset amount according to the execution times, and executing: the step of judging the test type of the sub-test case according to the second page and executing the test flow corresponding to the test type;
if yes, judging whether a next sub test case exists according to the test case number of the second page and the executed test case number;
if the next sub-test case exists, executing: recording the execution times of executing the sub-test cases;
and if the next sub-test case does not exist, exporting the test case file with the completed test.
To achieve the above object, the present invention further provides a testing apparatus, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when executed by the processor, implements the steps of the testing method as described above.
To achieve the above object, the present invention further provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the testing method as described above.
According to the testing method, the testing device and the computer readable storage medium, the testing case file corresponding to the function to be tested is compiled according to the function to be tested of the equipment, and the testing case file is divided into the first page and the second page, so that a tester can understand the testing case more easily, and the requirement on the coding level of the tester is reduced; the test case file is led into the test frame, and the test is executed according to the test case file, so that the test case is combined with the test frame, the test flow is simplified, and the test efficiency is improved; the test report is generated according to the test case file of which the test is finished, so that the tester can fully know the test result, the workload of the tester is reduced, and the communication efficiency between the tester and the developer is improved.
Drawings
FIG. 1 is a schematic diagram of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a first embodiment of the testing method of the present invention;
FIG. 3 is a diagram illustrating a first page according to a first embodiment of the testing method of the present invention;
FIG. 4 is a diagram illustrating a second page according to a first embodiment of the testing method of the present invention;
FIG. 5 is a detailed flowchart of step S20 in the second embodiment of the testing method of the present invention;
FIG. 6 is a schematic flow chart of a testing method according to a third embodiment of the present invention;
FIG. 7 is a detailed flowchart of step S232 of the third embodiment of the testing method of the present invention;
FIG. 8 is a detailed flowchart of step S233 of the third embodiment of the testing method of the present invention;
FIG. 9 is a flowchart illustrating a testing method according to a fourth embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a hardware structure of a testing apparatus provided in various embodiments of the present invention. The testing device comprises a communication module 01, a memory 02, a processor 03 and the like. Those skilled in the art will appreciate that the test device shown in fig. 1 may also include more or fewer components than shown, or combine certain components, or a different arrangement of components. The processor 03 is connected to the memory 02 and the communication module 01, respectively, and the memory 02 stores a computer program, which is executed by the processor 03 at the same time.
The communication module 01 may be connected to an external device through a network. The communication module 01 may receive data sent by an external device, and may also send data, instructions, and information to the external device, where the external device may be an electronic device such as a mobile phone, a tablet computer, a notebook computer, and a desktop computer.
The memory 02 may be used to store software programs and various data. The memory 02 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data or information created according to the use of the test apparatus, or the like. Further, the memory 02 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 03, which is a control center of the test apparatus, connects various parts of the entire test apparatus using various interfaces and lines, and performs various functions of the test apparatus and processes data by running or executing software programs and/or modules stored in the memory 02 and calling data stored in the memory 02, thereby performing overall monitoring of the test apparatus. Processor 03 may include one or more processing units; preferably, the processor 03 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 03.
Those skilled in the art will appreciate that the test device configuration shown in FIG. 1 does not constitute a limitation of the test device and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
Various embodiments of the method of the present invention are presented in terms of the above-described hardware architecture.
Referring to fig. 2, in a first embodiment of the testing method of the present invention, the testing method comprises the steps of:
step S10, according to the function to be tested of the device, writing a test case file corresponding to the function to be tested, wherein the test case file comprises a first page and a second page;
in this embodiment, the device is an embedded device, such as a mobile phone, an air conditioner, a refrigerator, a television, and the like, and the function to be tested is a function of the embedded device, such as a function of turning on or off a screen of the mobile phone, a function of turning on or off an air conditioner, and the like; the test case file is specifically an EXCEL file, and the first page is a sheet page in the EXCEL file, that is, in this embodiment, the test case file is an EXCEL file having two sheet pages.
In one embodiment, step S10 further includes:
according to the functions to be tested of the equipment, writing a first page of the test case file according to the example, wherein the first page comprises: the function interface serial number, the function interface name, the first expected result, the parameter of the first test case and the element of the first test case;
referring to fig. 3, a schematic diagram of a first page of the present invention is shown, taking implementation of turning on and off different leds on a control device as an example, where the first page is written by example, and from left to right, the first column is a function interface serial number, that is, a serial number is defined for a function interface, so as to call the interface, for example, 1, 2, 3, 4, etc., when testing is convenient. The second column is a function interface name, which corresponds to the function interface serial number one by one, such as __ init __ (led _ name) corresponding to function interface serial number 1, get _ leds () corresponding to function interface serial number 2, and so on. The third column is an explanation, for example, an explanation of __ init __ (LED _ name) corresponding to the function interface number 1 is an initialization process, and an explanation of get _ LEDs () corresponding to the function interface number 2 is a list of resources for acquiring LED lamps. The fourth column is a first expected result and parameter access parameters, the first expected result corresponds to the parameter access parameters one by one, the number of the parameter access parameters can be one or one group, when the parameter access parameter is one, the first expected result corresponds to one parameter access parameter, and when the parameter access parameter is one group, the first expected result corresponds to one group of parameter access parameters; the fifth column is the comment and discussion of the corresponding function interface. The first test case self element comprises the explanation of a third column and the comment and discussion of a function interface of a fifth column, and the first test case self element is used for assisting the understanding of testers, and the key field is not called in the actual test process;
according to the function to be tested of the equipment, writing a second page of the test case file according to the example, wherein the second page comprises: the second test case self element, the test case number, the function interface calling sequence, the cycle number, the single-interface test interface, the second expected result and the test return result;
referring to fig. 4, a schematic diagram of a second page according to the present invention is shown, where the second page is compiled in columns, and from left to right, the first column is test case numbers, such as 1, 2, and 3, and each test case number corresponds to one child test case in a traversal test sequence during testing. The second column is the test subject. The third column is the test priority. The fourth column summarizes the test protocol. The fifth column is a test case comment. And the fifth column is a function interface calling sequence and is used for calling the corresponding function interface according to the function interface serial number in the first page. The sixth column is the cycle number, which is the cycle number of the test case execution represented by the test case number in each row. And the seventh column is a single-interface test interface used for performing single-interface entry test on the selected interface. The eighth column is the second expected result. The ninth column is a test return result for recording the result returned by the test case execution automation test in each row. The tenth column is a test case comment, and it should be noted that the elements of the second test case include the test subject in the second column, the test priority in the third column, the test scenario summary in the fourth column, and the test case comment in the tenth example, which are all used to assist the tester to understand that the key field is not called in the actual test. It should be noted that, in this embodiment, the order of the columns included in the first page and the second page is not fixed, and a person skilled in the art may randomly sort each column according to actual needs to implement writing of the test case file, which is not limited herein.
After step S10, execution: step S20, importing the test case file into a test frame, and executing a test according to the test case file;
in this embodiment, the edited test case file may be downloaded to a python-based test framework in the embedded device, and data information in the first page and the second page in the test case file may be read, and an automated test may be performed according to the data information.
Step S30, generating a test report according to the test case file with the completed test;
the completed test case file contains the conclusion of each test, and a test report can be generated according to the test conclusion in the test case file and the problems in the test process, wherein the test report can comprise one or more of the factors of test case total number, test result, failed test case number, interface return message, failure reason analysis and the like during test.
According to the testing method provided by the invention, the test case file corresponding to the function to be tested is compiled according to the function to be tested of the equipment, and the test case file is divided into the first page and the second page, so that a tester can understand the test case more easily, and meanwhile, through the design of the test case of the first page and the second page, the elements and the test logic of the test case are embodied, the requirement on the coding level of the tester is reduced, the number of the test cases is reduced, and a case can realize a plurality of entry-parameter tests of an interface; the test case file is led into the test frame, and the test is executed according to the test case file, so that the test case is combined with the test frame, the test flow is simplified, the steps from the test case file to the test script generation are omitted, and the test efficiency is improved; the test report is generated according to the test case file of which the test is finished, so that the tester can fully know the test result, the workload of the tester is reduced, and the communication efficiency between the tester and the developer is improved.
Further, referring to fig. 5, in the testing method of the present invention proposed based on the first embodiment of the present invention, the present invention proposes a second embodiment, and the step S20 includes:
step S21, importing the test case file into a test frame, and executing the test case file in sequence according to the test case number of the second page, wherein the test case file comprises sub test cases;
the test case files are sequentially executed according to the test case numbers of the second page, that is, the test case files are sequentially executed in the second page according to the first test case number in rows, for example, the test case numbers are 1, 2 and 3, the test case files are sequentially executed in rows according to the sequence of 1, 2 and 3, each row in the second page is a sub-test case, for example, when the test case numbers are 1, 2 and 3, 3 corresponding sub-test cases exist;
step S22, recording the execution times of the sub-test cases;
in this embodiment, the number of times of the child test case is recorded, that is, the number of times of execution of each row in the second page.
Step S23, judging the test type of the sub test case according to the second page, and executing the test flow corresponding to the test type;
the test types comprise a single interface test type and a combinational logic test type; when the cycle number in the second page is greater than a preset number, the test type may be divided into a reliability test for a multi-call interface of a single-interface test type and a reliability test for a combinational logic test type, and the preset number may be any number greater than 1.
Step S24, exporting the test case file with completed test according to the cycle number, the execution number and the test case file;
the completed test case file contains a test conclusion.
According to the invention, the test case file is imported into the test frame, and the test case file is sequentially executed according to the test case number of the second page, wherein the test case file comprises the sub-test cases, so that the test case is matched with the test frame, the test frame can directly read data in the test case, and the test process is optimized; the test times are prevented from being omitted in the reliability test by recording the execution times of executing the test case file; by judging the test type of the sub-test case according to the second page and executing the test flow corresponding to the test type, the coverage of single-interface test, combinational logic test and reliability test of multiple calling interfaces is realized, the test flow is simplified, and the test efficiency is improved; the test case file with the completed test is exported according to the cycle times, the execution times and the test case file, so that the test conclusion is obtained, and the test staff can conveniently understand the test case file.
Further, referring to fig. 6, in the testing method according to the present invention proposed based on the first embodiment of the present invention, the present invention proposes a third embodiment, and the step S23 includes:
step S231, judging whether a record exists in the single-interface test interface in the second page;
the record is a designated interface existing in a table of the single-interface test interface, such as an interface a, an interface b, an interface c and the like;
step S232, if the single interface test interface exists, performing a single interface test process according to the recorded single interface test interface;
referring to fig. 7, the step S232 further includes:
step S2321, reading the function interface calling sequence of the second page, searching the function interface serial number of the first page according to the interface calling sequence of the second page, reading the first access parameter of the row where the function interface serial number is located in the first page except the single-interface test interface, and reading all the access parameters of the row where the function interface serial number corresponding to the single-interface test interface is located in the first page;
in this embodiment, if the single-interface test interface is an interface b, the call sequence of the function interfaces is a, b, c, and d, and the serial numbers of the function interfaces in the first page corresponding to the call sequence of the function interfaces are sequentially 1, 2, 3, and 4, the first parameter entry in the row where 1, 3, and 4 except the serial number of the function interface is 2 in the first page is read, it should be noted that, when only one parameter entry is provided, only one parameter entry is read, when the parameter entry is a group, the first parameter entry in the group is read, and all parameter entry in the row where the single-interface test interface b is provided are read, it should be noted that, when only one parameter entry is provided, only one parameter entry is read, and when the parameter entry is a group, all parameter entries in the group are read.
Step S2322, calculating the input parameter quantity in the single-interface test interface, and according to the read input parameter, according to the sub-test cases with the times corresponding to the input parameter quantity in the calling sequence of the second page function interface;
the input parameter quantity is the input parameter quantity of the interface b, for example, if the input parameter quantity of the interface b is 1, the test case file is executed for 1 time according to the interface calling sequence of a, b, c and d; and if the number of the input parameters of the interface b is 5, executing the test case file for 5 times according to the interface calling sequence of a, b, c and d.
In an embodiment, after performing step S2322, performing: step S2323, judging whether the test result of each executed sub-test case is consistent with a second expected result in a second page, and outputting a test conclusion;
step S2324, filling the test conclusion into a test return result in a second page;
in this embodiment, before executing step S2323, it is further determined whether a record exists in the second expected result in the second page, and if a record exists, step S2323 is executed; if no record exists, whether the test result of each test case file execution conforms to the first expected result in the first page is judged. Under the condition that the test result is consistent with the expected result, outputting a test conclusion of pass; and in the case that the test result does not accord with the expected result, outputting the test conclusion as fail. And filling the test conclusion into a test return result.
After step S232, step S233 is executed, and if not, a service logic test flow is executed;
in an embodiment, referring to fig. 8, the step S233 further includes:
step S2331, reading a function interface calling sequence of the second page, searching a function interface sequence number of the first page according to the function interface calling sequence of the second page, and reading a first parameter of the row of the function interface sequence number in the first page;
in this embodiment, as for the function interface calling sequence and the function interface serial number in step S2321, the corresponding function interface serial numbers 1, 2, 3, and 4 are found according to the function interface calling sequences a, b, c, and d, and the first parameter of the row where the function interface serial numbers 1, 2, 3, and 4 are located is read.
Step S2332, according to the interface calling sequence of the second page, sequentially executing the sub-test cases which correspond to the interface calling sequence and contain the first parameter;
in this embodiment, the corresponding function interface serial numbers 1, 2, 3, and 4 are found according to the function interface calling sequences a, b, c, and d, the first parameter of the row in which the function interface serial numbers 1, 2, 3, and 4 are located is read, and the sub-test cases corresponding to the function interface serial numbers are sequentially executed.
Step S2333, judging whether the test result of the executed sub-test case is consistent with a second expected result in a second page or not, and outputting a test conclusion;
step S2334, filling the test conclusion into a test return result in a second page;
in this embodiment, before step S2333 is executed, it is further determined whether there is a record of the second expected result in the second page, and if there is a record, step S2333 is executed; if no record exists, whether the test result of each test case file execution conforms to the first expected result in the first page is judged. Under the condition that the test result is consistent with the expected result, outputting a test conclusion of pass; and in the case that the test result does not accord with the expected result, outputting the test conclusion as fail. And filling the test conclusion into a test return result.
According to the invention, the single-interface test and the combinational logic test are carried out on the test case file, and the test result is obtained, so that the stable and normal work of the related system and function of the equipment can be ensured, the correctness of interface calling in a single-interface application scene is ensured, meanwhile, the test efficiency is improved, the user experience is improved, and the product research and development cost is reduced through the automatic test.
Further, referring to fig. 9, in the testing method according to the present invention proposed based on the first embodiment of the present invention, the present invention proposes a fourth embodiment, and the step S24 includes:
step S241, determining whether the number of cycles is equal to the number of executions;
step S242, if not, accumulating by a preset number according to the execution times, and executing: step S23;
in this embodiment, the preset number is 1, and the accumulation is performed by the preset number according to the execution times, that is, the execution times is increased by 1 after each execution is completed, for example, the execution times is 2, the execution times is changed to 3 after one complete execution, the execution times is changed to 4 after one complete execution, and so on, until the execution times is equal to the loop times, then S243 is performed.
Step S243, if yes, determining whether a next child test case exists according to the test case number of the second page and the test case number after execution;
the test case is represented by each line in the test case file.
Step S244, if there is a next child test case, executing: step S22;
step S245, if the next sub-test case does not exist, exporting a test case file with the test completed;
in the invention, the reliability test of multiple calling interfaces related to single interface test and combinational logic test can be realized by judging the cycle times and the execution times, and the stability of the interface function is ensured; meanwhile, the completeness of the test process is ensured by judging whether the test case is executed completely and then exporting the completed test case file, so that the tester can better understand the test process, the workload of the tester is reduced, and the communication efficiency between the tester and the developer is improved.
The invention also proposes a computer-readable storage medium on which a computer program is stored. The computer-readable storage medium may be the Memory 02 in the testing apparatus of fig. 1, and may also be at least one of a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, and an optical disk, and the computer-readable storage medium includes several pieces of information for enabling the testing apparatus to perform the method according to the embodiments of the present invention.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. A method of testing, comprising the steps of:
according to a function to be tested of equipment, compiling a test case file corresponding to the function to be tested, wherein the test case file comprises a first page and a second page;
importing the test case file into a test frame, and executing a test according to the test case file;
and generating a test report according to the test case file with the completed test.
2. The testing method of claim 1, wherein the step of writing a test case file corresponding to a function to be tested according to the function to be tested of the device comprises:
according to the functions to be tested of the equipment, writing a first page of the test case file according to columns, wherein the first page comprises: the function interface serial number, the function interface name, the first expected result, the parameter of the first test case and the element of the first test case;
according to the functions to be tested of the equipment, writing a second page of the test case file according to columns, wherein the second page comprises: the second test case self element, the test case number, the function interface calling sequence, the cycle number, the single-interface test interface, the second expected result and the test return result.
3. The test method of claim 2, wherein the second page comprises a number of cycles; the step of importing the test case file into a test framework and executing the test according to the test case file comprises the following steps:
importing the test case file into a test frame, and sequentially executing the test case file according to the test case number of the second page, wherein the test case file comprises sub test cases;
recording the execution times of executing the sub-test cases;
judging the test type of the sub-test case according to the second page, and executing a test flow corresponding to the test type;
and exporting the test case file with the completed test according to the cycle times, the execution times and the test case file.
4. The test method of claim 3, wherein the second page comprises a single interface test interface; the step of judging the test type of the test case file according to the second page and executing the test flow corresponding to the test type comprises the following steps:
judging whether a single-interface test interface in the second page has a record or not;
if the single interface test interface exists, performing a single interface test process according to the recorded single interface test interface;
and if not, executing the service logic test flow.
5. The testing method of claim 4, wherein the first page includes a first expected result and an enrollment parameter; the second page comprises a function interface calling sequence; the step of performing the single interface test flow according to the recorded single interface test interface comprises the following steps:
reading a function interface calling sequence of the second page, searching a function interface serial number of the first page according to the interface calling sequence of the second page, reading a first parameter of the row where the function interface serial number is located in the first page except the single-interface test interface, and reading all parameter of the row where the function interface serial number corresponding to the single-interface test interface is located in the first page;
and calculating the number of input parameters in the single-interface test interface, and executing the sub-test cases with the number of times corresponding to the number of the input parameters according to the read input parameters and the calling sequence of the second page function interface.
6. The test method of claim 5, wherein the second page includes a second expected result and a test return result; the step of calculating the number of the input parameters in the single-interface test interface and executing the sub-test cases with the number of times corresponding to the number of the input parameters according to the read input parameters and the calling sequence of the second page function interface comprises the following steps:
judging whether the test result of each executed sub-test case is consistent with a second expected result in a second page or not, and outputting a test conclusion;
and filling the test conclusion into a test return result in the second page.
7. The test method of claim 4, wherein the first page includes a function interface serial number; the second page comprises a function interface calling sequence and a test return result; the step of executing the business logic test flow comprises;
reading a function interface calling sequence of the second page, searching a function interface serial number of the first page according to the function interface calling sequence of the second page, and reading a first parameter of the row of the function interface serial number in the first page;
according to the interface calling sequence of the second page, sequentially executing the sub-test cases which correspond to the interface calling sequence and contain the first parameter;
judging whether the test result of the executed sub-test case is consistent with a second expected result in a second page or not, and outputting a test conclusion;
and filling the test conclusion into a test return result in the second page.
8. The test method of claim 3, wherein the second page comprises a number of cycles; the step of exporting the test case file with the completed test according to the cycle number, the execution number and the test case file comprises the following steps:
judging whether the cycle times are equal to the execution times or not;
if not, accumulating by a preset amount according to the execution times, and executing: the step of judging the test type of the sub-test case according to the second page and executing the test flow corresponding to the test type;
if yes, judging whether a next sub test case exists according to the test case number of the second page and the executed test case number;
if the next sub-test case exists, executing: recording the execution times of executing the sub-test cases;
and if the next sub-test case does not exist, exporting the test case file with the completed test.
9. A testing apparatus, characterized in that the testing apparatus comprises a memory, a processor and a computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the testing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the testing method according to one of the claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110740117.3A CN113485919B (en) | 2021-06-30 | 2021-06-30 | Test method, test device, and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110740117.3A CN113485919B (en) | 2021-06-30 | 2021-06-30 | Test method, test device, and computer-readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113485919A true CN113485919A (en) | 2021-10-08 |
CN113485919B CN113485919B (en) | 2024-01-26 |
Family
ID=77937275
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110740117.3A Active CN113485919B (en) | 2021-06-30 | 2021-06-30 | Test method, test device, and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113485919B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114443473A (en) * | 2021-12-29 | 2022-05-06 | 山东有人物联网股份有限公司 | Automated testing framework, method, system and computer readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016122508A1 (en) * | 2015-01-29 | 2016-08-04 | Hewlett Packard Enterprise Development Lp | Test generation for browser-based user interface |
JP2018092374A (en) * | 2016-12-02 | 2018-06-14 | 株式会社日立製作所 | Test case creating device, and test case creating method |
CN108255738A (en) * | 2018-04-09 | 2018-07-06 | 平安普惠企业管理有限公司 | Automated testing method, device, computer equipment and storage medium |
CN110941559A (en) * | 2019-11-27 | 2020-03-31 | 北京搜狐新媒体信息技术有限公司 | Automatic test method and system |
-
2021
- 2021-06-30 CN CN202110740117.3A patent/CN113485919B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016122508A1 (en) * | 2015-01-29 | 2016-08-04 | Hewlett Packard Enterprise Development Lp | Test generation for browser-based user interface |
JP2018092374A (en) * | 2016-12-02 | 2018-06-14 | 株式会社日立製作所 | Test case creating device, and test case creating method |
CN108255738A (en) * | 2018-04-09 | 2018-07-06 | 平安普惠企业管理有限公司 | Automated testing method, device, computer equipment and storage medium |
CN110941559A (en) * | 2019-11-27 | 2020-03-31 | 北京搜狐新媒体信息技术有限公司 | Automatic test method and system |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114443473A (en) * | 2021-12-29 | 2022-05-06 | 山东有人物联网股份有限公司 | Automated testing framework, method, system and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113485919B (en) | 2024-01-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108287694B (en) | Application program construction method, system, computer device and storage medium | |
US11379348B2 (en) | System and method for performing automated API tests | |
CN110716870B (en) | Automatic service testing method and device | |
CN108628748B (en) | Automatic test management method and automatic test management system | |
CN110096434A (en) | Interface testing method and device | |
CN110825619A (en) | Automatic generation method and device of interface test case and storage medium | |
CN110231994B (en) | Memory analysis method, memory analysis device and computer readable storage medium | |
CN112241360A (en) | Test case generation method, device, equipment and storage medium | |
CN115080398A (en) | Automatic interface test system and method | |
CN111290951A (en) | Test method, terminal, server, system and storage medium | |
CN111679982A (en) | Automatic testing method for REST API (representational State transfer) interface software | |
CN113836014A (en) | Interface testing method and device, electronic equipment and storage medium | |
CN115934503A (en) | Program testing method, device, equipment and storage medium | |
CN111708712A (en) | User behavior test case generation method, flow playback method and electronic equipment | |
CN113220566B (en) | Method and device for generating interface performance test script and computer equipment | |
CN117370203B (en) | Automatic test method, system, electronic equipment and storage medium | |
CN113485919B (en) | Test method, test device, and computer-readable storage medium | |
CN116561003A (en) | Test data generation method, device, computer equipment and storage medium | |
CN114490337A (en) | Debugging method, debugging platform, equipment and storage medium | |
CN113419738A (en) | Interface document generation method and device and interface management equipment | |
CN112765040B (en) | Page test method, system, computer equipment and storage medium | |
CN114817393B (en) | Data extraction and cleaning method and device and storage medium | |
CN115840715B (en) | Software test management method, device and storage medium | |
CN118503117A (en) | Selenium-based automatic test method, terminal equipment and storage medium | |
CN116955140A (en) | SDK test method, device, equipment 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |