CN117033249A - Test case generation method and device, computer equipment and storage medium - Google Patents

Test case generation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN117033249A
CN117033249A CN202311288653.XA CN202311288653A CN117033249A CN 117033249 A CN117033249 A CN 117033249A CN 202311288653 A CN202311288653 A CN 202311288653A CN 117033249 A CN117033249 A CN 117033249A
Authority
CN
China
Prior art keywords
test case
json
request
case
key
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
Application number
CN202311288653.XA
Other languages
Chinese (zh)
Other versions
CN117033249B (en
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.)
Aspire Technologies Shenzhen Ltd
Original Assignee
Aspire Technologies Shenzhen 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 Aspire Technologies Shenzhen Ltd filed Critical Aspire Technologies Shenzhen Ltd
Priority to CN202311288653.XA priority Critical patent/CN117033249B/en
Priority claimed from CN202311288653.XA external-priority patent/CN117033249B/en
Publication of CN117033249A publication Critical patent/CN117033249A/en
Application granted granted Critical
Publication of CN117033249B publication Critical patent/CN117033249B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Landscapes

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

Abstract

The embodiment of the application belongs to the technical field of software testing, and relates to a test case generation method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring key configuration information; performing case generation operation on the key configuration information based on a python orthogonal table method to obtain a manual test case; deriving json requests from ApiFox based on the interface URL information; acquiring each parameter corresponding to the json request to obtain a json format file; generating an initial automatic test case by taking the interface URL information as a primary key according to the Chinese description and the mapping field; and performing test case improvement operation on the initial automatic test cases based on the parameters corresponding to each json request to obtain target automatic test cases. The application can eliminate the work of manually inputting the test cases in the prior art, simplify the test flow, effectively improve the generation efficiency of the test cases and save the consumption of human resources.

Description

Test case generation method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of software testing technologies, and in particular, to a test case generating method, a test case generating device, a computer device, and a storage medium.
Background
With the rapid development of the software industry, the software test has a larger and larger effect, and the automatic test case generation method has a larger and larger amount. How to find an efficient test case generation algorithm is always a focus of attention in the test field.
Most of the current test case generation methods are manually input by testers.
However, when the test cases are written by the testers, the conventional test case generation method of the applicant often has great discounts on the value of the cases due to inconsistency of documents or insufficient experience of the testers. Sometimes a great deal of time and effort is spent and a better use case is not obtained. When the test case is designed, the problem that the design process of the test case is not standard exists. Meanwhile, the correctness of the output result of the designed use case (namely, the output data tested according to the test input data) is ensured by judging through manual combination requirement. The manual writing of the test cases occupies most of the test time of the testers, and the iteration of the version of the tested part leads to higher maintenance cost of the test cases. Therefore, the conventional test case generation method has the problems of low generation efficiency and overlarge manpower resource consumption.
Disclosure of Invention
The embodiment of the application aims to provide a test case generation method, a device, computer equipment and a storage medium, so as to solve the problems of low generation efficiency and excessive human resource consumption of the traditional test case generation method.
In order to solve the above technical problems, an embodiment of the present application provides a test case generating method, which adopts the following technical schemes:
acquiring key configuration information, wherein the key configuration information comprises key information interface field parameters, key test steps, interface URL information and related data table names;
performing case generation operation on the key configuration information based on a python orthogonal table method to obtain a manual test case;
deriving json requests from ApiFox based on the interface URL information;
obtaining each parameter corresponding to the json request to obtain a json format file, wherein the parameters corresponding to each json request comprise Chinese description in a comparison table and a database field mapped in the comparison table;
generating an initial automatic test case by taking the interface URL information as a primary key according to the Chinese description and the mapping field, wherein the initial automatic test case comprises a title description and a field value in an expected database table;
and performing test case improvement operation on the initial automatic test cases based on the parameters corresponding to each json request to obtain target automatic test cases.
Further, before the step of obtaining the key configuration information, the method further includes the following steps:
a startup use case configuration file;
configuring a use case generating path, a use case display style and a default use case header of the use case configuration file;
and enumerating the functional factors of the use case configuration file to obtain the key configuration information.
Further, the step of performing a case generation operation on the key configuration information based on the python orthogonal table method to obtain a manual test case specifically includes the following steps:
carrying out automatic arrangement and combination operation on the parameters of the key configuration information based on the python orthogonal table method to obtain an initial manual test case;
and performing exception handling operation on the initial manual test case to obtain the manual test case, wherein the exception handling operation comprises a factor mutual exclusion operation and a flow termination operation.
Further, the step of deriving the json request from ApiFox based on the interface URL information specifically includes the following steps:
reading an engineering catalog in the ApiFox, and exporting an interface file;
and taking the interface URL information as a unique key value to acquire a request body corresponding to the interface URL information, and obtaining the json request.
Further, the step of obtaining the json format file by obtaining the parameters corresponding to each json request specifically includes the following steps:
analyzing the request body of the json request based on a json library to obtain interface request information;
and creating an initial json file, and storing the interface request information in the initial json file to obtain the json format file.
Further, after the step of performing test case improvement operation on the initial automated test case based on the parameters corresponding to each json request to obtain a target automated test case, the method further includes the following steps:
when the target automatic test case is rotated, configuring Jenkins Pipeline, and integrating the target automatic test case into a target item;
configuring a timing task of the target item, and generating an alure test report;
automatically pushing the alure test report to related personnel.
In order to solve the above technical problems, the embodiment of the present application further provides a test case generating device, which adopts the following technical scheme:
the configuration information acquisition module is used for acquiring key configuration information, wherein the key configuration information comprises key information interface field parameters, key test steps, interface URL information and related data table names;
the manual test case generation module is used for carrying out case generation operation on the key configuration information based on a python orthogonal table method to obtain a manual test case;
the request export module is used for exporting json requests from ApiFox based on the interface URL information;
the parameter acquisition module is used for acquiring each parameter corresponding to the json request to obtain a json format file, wherein the parameters corresponding to each json request comprise Chinese description in a comparison table and a database field mapped in the comparison table;
the automatic test case generation module is used for taking the interface URL information as a primary key and generating an initial automatic test case according to the Chinese description and the mapping field, wherein the initial automatic test case comprises a title description and a field value in an expected database table;
and the test case perfecting module is used for carrying out test case perfecting operation on the initial automatic test case based on the parameters corresponding to each json request to obtain a target automatic test case.
Further, the device further comprises:
the configuration file starting module is used for starting the configuration file of the use case;
the file configuration module is used for configuring a use case generating path, a use case display style and a default use case header of the use case configuration file;
and the functional factor enumeration module is used for enumerating the functional factors of the use case configuration file to obtain the key configuration information.
In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical schemes:
the method comprises a memory and a processor, wherein the memory stores computer readable instructions, and the processor executes the computer readable instructions to realize the steps of the test case generating method.
In order to solve the above technical problems, an embodiment of the present application further provides a computer readable storage medium, which adopts the following technical schemes:
the computer readable storage medium has stored thereon computer readable instructions which, when executed by a processor, implement the steps of the test case generating method as described above.
The application provides a test case generation method, which comprises the following steps: acquiring key configuration information, wherein the key configuration information comprises key information interface field parameters, key test steps, interface URL information and related data table names; performing case generation operation on the key configuration information based on a python orthogonal table method to obtain a manual test case; deriving json requests from ApiFox based on the interface URL information; obtaining each parameter corresponding to the json request to obtain a json format file, wherein the parameters corresponding to each json request comprise Chinese description in a comparison table and a database field mapped in the comparison table; generating an initial automatic test case by taking the interface URL information as a primary key according to the Chinese description and the mapping field, wherein the initial automatic test case comprises a title description and a field value in an expected database table; and performing test case improvement operation on the initial automatic test cases based on the parameters corresponding to each json request to obtain target automatic test cases. Compared with the prior art, the method and the device can eliminate the work of manually inputting the test cases, simplify the test flow, effectively improve the generation efficiency of the test cases, save the consumption of human resources, simultaneously, can be used by developers when writing software, and verify whether the purpose of the program accords with the expectation.
Drawings
In order to more clearly illustrate the solution of the present application, a brief description will be given below of the drawings required for the description of the embodiments of the present application, it being apparent that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained from these drawings without the exercise of inventive effort for a person of ordinary skill in the art.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flowchart of a test case generating method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of the functional factors provided by the first embodiment of the present application;
FIG. 4 is a schematic diagram of an operation orthogonal table of a new company according to an embodiment of the present application;
FIG. 5 is a diagram of core code for solving the problem of flow termination according to the first embodiment of the present application;
FIG. 6 is a schematic diagram of a test case generating device according to a second embodiment of the present application;
FIG. 7 is a schematic diagram of an embodiment of a computer device in accordance with the application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the description of the drawings above are intended to cover a non-exclusive inclusion. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to make the person skilled in the art better understand the solution of the present application, the technical solution of the embodiment of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping class application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic video expert compression standard audio plane 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic video expert compression standard audio plane 4) players, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the test case generating method provided by the embodiment of the present application is generally executed by a server/terminal device, and accordingly, the test case generating device is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flowchart of one embodiment of a test case generation method according to the present application is shown. The test case generation method comprises the following steps: step S201, step S202, step S203, step S204, step S205, and step S206.
In step S201, key configuration information is acquired, wherein the key configuration information includes key information interface field parameters, key test steps, interface URL information, and related data table names.
In step S202, a case generation operation is performed on the key configuration information based on the python orthogonal table method, and a manual test case is obtained.
In the embodiment of the application, the Python realizes the design of the test case by the orthogonal table method, and mainly solves the problems of the orthogonal table, namely: the method can not automatically arrange and combine, mutual exclusion of factors and flow termination, and is realized by using a python writing case_generate tool.
In the embodiment of the present application, the implementation manner of the automatic permutation and combination may be that an excel template is designed first, each factor of the function to be tested is enumerated, as shown in fig. 3, then a Python script is written, each column is read from excel, and then permutation and combination are performed on each column cycle by using the advanced function characteristic reduce function of Python, so as to obtain the final permutation and combination. Finally, the permutation and combination are output to another table, and the core permutation and combination codes are as follows:
def orthogonal(self, list_array):
mutex_list = reduce(self.exclude_mutex_list, list_array)
tmp = [i[1] for i in mutex_list]
stop_list = self.exclude_stop_list(tmp)
orthogonal_list = [j.split(self.keyword_link) for j in [i for i in stop_list]]
return orthogonal_list
in the embodiment of the application, the solution of factor mutual exclusion can be that for the combination which can not be arranged together, we need to add the background color of the table, we provide that the elements of the table with the same color can not be arranged and combined together, as shown in fig. 4, the solution is a new company operation orthogonal table, when the values of the company names are mutually exclusive, and therefore, the mutually exclusive items are 'less than 250 characters and more than 250 characters' in the company name items. When the script is realized, the color attribute of the table background is read when the element value of each column is read, and when the elements with the same color are finally arranged and combined, the elements with the same color cannot be arranged and combined together, and the core code is shown in fig. 5.
In the embodiment of the application, some factors can cause the flow to terminate, such as 'company name is more than 250 characters', the verification is performed when the company verification parameters are submitted, and the method does not need to be continued downwards, so that the method is terminated when the arrangement and combination are performed to the factor of 'company name is more than 250 characters', the solution for the flow termination can be that the factor which can cause the flow to terminate is that a [ | ] mark is added behind the factor text, and when the python script takes [ | ], special treatment is performed to reject the factors after [ | ]. The core code is as follows:
def exclude_stop_list(self, mutex_list):
step_list = []
for step in mutex_list:
tmp = step.split(self.keyword_stop)[0]
if tmp not in step_list:
step_list.append(tmp)
return step_list
in step S203, a json request is derived from ApiFox based on the interface URL information.
In the embodiment of the application, an interface request exported by apilox is stored in an automatic engineering apischeme directory, and a json file of the interface request is saved.
In step S204, each parameter corresponding to the json request is obtained to obtain a json format file, where the parameter corresponding to each json request includes a chinese description in the lookup table and a mapped database field in the lookup table.
In the embodiment of the present application, the comparison table refers to the following structural body definitions: { interface field- -Chinese parameter description|database field name } - -the correspondence between the request interface parameter and the Chinese parameter name and the database field is using a dictionary table.
In step S205, an initial automation test case is generated according to the chinese description and the mapping field by using the interface URL information as a primary key, where the initial automation test case includes a header description and a field value in the expected database table.
In step S206, a test case improvement operation is performed on the initial automated test case based on the parameters corresponding to each json request, so as to obtain a target automated test case.
In an embodiment of the present application, a test case generating method is provided, including: acquiring key configuration information, wherein the key configuration information comprises key information interface field parameters, key testing steps, interface URL information and related data table names; performing case generation operation on the key configuration information based on a python orthogonal table method to obtain a manual test case; deriving json requests from ApiFox based on interface URL information; obtaining each parameter corresponding to the json request to obtain a json format file, wherein the parameters corresponding to the json request comprise Chinese description in a comparison table and a database field mapped in the comparison table; the method comprises the steps of taking interface URL information as a primary key, and generating an initial automatic test case according to Chinese description and mapping fields, wherein the initial automatic test case comprises title description and field values in an expected database table; and performing test case improvement operation on the initial automatic test case based on the parameters corresponding to each json request to obtain a target automatic test case. Compared with the prior art, the method and the device can eliminate the work of manually inputting the test cases, simplify the test flow, effectively improve the generation efficiency of the test cases, save the consumption of human resources, simultaneously, can be used by developers when writing software, and verify whether the purpose of the program accords with the expectation.
In some optional implementations of the present embodiment, before step S201, the following steps are further included:
a startup use case configuration file;
configuring a use case generating path, a use case display style and a default use case header of a use case configuration file;
and (5) enumerating the functional factors of the use case configuration file to obtain key configuration information.
In the embodiment of the application, before acquiring the key configuration information, the configuration file modification of the use case is required to be started, the use case generation [ path ], the use case display style (available default), the default use case header (not modifiable) comprise [ 'belonging module', 'use case title', 'preconditions', 'test step', 'expected result', 'keyword', 'priority', 'use case type', 'applicable stage' ]; the use case template keywords enumerate the various factors of the tested functions: the system comprises a functional module, an interface URL, key parameters, operation steps, a return status code and a database table name.
In some optional implementations of the present embodiment, step S202 specifically includes the following steps:
carrying out automatic arrangement and combination operation on parameters of key configuration information based on a python orthogonal table method to obtain an initial manual test case;
and performing exception handling operation on the initial manual test case to obtain the manual test case, wherein the exception handling operation comprises a factor mutual exclusion operation and a flow termination operation.
In the embodiment of the application, the automatic arrangement and combination of the parameters of the interface cases are realized according to the orthogonal table method, the factors are mutually exclusive (certain parameters cannot exist at the same time), the process is terminated (abnormal scenes such as that a certain parameter is null, no parameter exists, and very long characters exist), and finally the manual test case is generated.
In some optional implementations of the present embodiment, step S203 specifically includes the following steps:
reading an engineering catalog in ApiFox, and exporting an interface file;
and taking the interface URL information as a unique key value to acquire a request body corresponding to the interface URL information, thereby obtaining the json request.
In the embodiment of the application, the engineering catalog in the Apifox is read, the interface file is exported, and the request body of the interface is obtained according to the URL of the manual use case as the unique key value; and reading the engineering catalog in the Apifox, exporting an interface file, and acquiring a request body of the interface according to the URL of the manual use case as a unique key value.
In some optional implementations of this embodiment, the step S204 specifically includes the following steps:
analyzing a request body of the json request based on the json library to obtain interface request information;
and creating an initial json file, and storing interface request information in the initial json file to obtain a json format file.
In the embodiment of the application, the corresponding relation between the interface Chinese parameter name and the interface field and the database field is obtained; and comparing the manual test case with the interface Json request, firstly reading the manual test case, analyzing the interface information derived by ApiFox, and storing the interface information into a Json file.
In some optional implementations of the embodiment, after the interface information derived by analyzing ApiFox is saved to the json file, the json file may be requested by the association query interface with the manual test case URL and the case title as an association key, and the test case title, the request parameters (enumeration general), the expected corresponding state, the database field verification, and the like are assembled, and the automatic test case is saved in excel; and calling general addition, deletion, modification, checking and other library methods and assertion checking according to the interface types, reading test cases from Excel through an automatic test framework, updating a request body of a json file according to different parameters, and then sending a request according to a request library, and checking a request response result, a response code and a data table record.
In some optional implementations of the present embodiment, after step S205, the following steps are further included:
when the target automatic test case is transferred, configuring Jenkins Pipeline, and integrating the target automatic test case into a target item;
configuring a timing task of a target item, and generating an alure test report;
the alure test report is automatically pushed to the relevant personnel.
In the embodiment of the application, jenkins Pipeline is configured, realized automation use cases are integrated to projects, timing tasks are configured, smoking, regression and daily construction are performed, and an alure report is integrated to Jenkins job to automatically push test reports to a stem system person.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions. Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by computer readable instructions stored in a computer readable storage medium that, when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a random access Memory (Random Access Memory, RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
Example two
With further reference to fig. 6, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a test case generating apparatus, where an embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 6, the test case generating apparatus 200 of the present embodiment includes: a configuration information acquisition module 210, a manual test case generation module 220, a request export module 230, a parameter acquisition module 240, an automated test case generation module 250, and a test case perfection module 260, wherein:
a configuration information obtaining module 210, configured to obtain key configuration information, where the key configuration information includes key information interface field parameters, key test steps, interface URL information, and related data table names;
the manual test case generation module 220 is configured to perform a case generation operation on the key configuration information based on a python orthogonal table method, so as to obtain a manual test case;
a request deriving module 230, configured to derive a json request from ApiFox based on the interface URL information;
the parameter obtaining module 240 is configured to obtain each parameter corresponding to the json request, to obtain a json format file, where the parameter corresponding to each json request includes a chinese description in the lookup table and a mapped database field in the lookup table;
the automatic test case generating module 250 is configured to generate an initial automatic test case according to the Chinese description and the mapping field by using the interface URL information as a primary key, where the initial automatic test case includes a header description and a field value in an expected database table;
the test case improvement module 260 is configured to perform test case improvement operation on the initial automated test case based on the parameters corresponding to each json request, so as to obtain a target automated test case.
In this embodiment, there is provided a test case generating apparatus 200, including: a configuration information obtaining module 210, configured to obtain key configuration information, where the key configuration information includes key information interface field parameters, key test steps, interface URL information, and related data table names; the manual test case generation module 220 is configured to perform a case generation operation on the key configuration information based on a python orthogonal table method, so as to obtain a manual test case; a request deriving module 230, configured to derive a json request from ApiFox based on the interface URL information; the parameter obtaining module 240 is configured to obtain each parameter corresponding to the json request, to obtain a json format file, where the parameter corresponding to each json request includes a chinese description in the lookup table and a mapped database field in the lookup table; the automatic test case generating module 250 is configured to generate an initial automatic test case according to the Chinese description and the mapping field by using the interface URL information as a primary key, where the initial automatic test case includes a header description and a field value in an expected database table; the test case improvement module 260 is configured to perform test case improvement operation on the initial automated test case based on the parameters corresponding to each json request, so as to obtain a target automated test case. Compared with the prior art, the method and the device can eliminate the work of manually inputting the test cases, simplify the test flow, effectively improve the generation efficiency of the test cases, save the consumption of human resources, simultaneously, can be used by developers when writing software, and verify whether the purpose of the program accords with the expectation.
In some optional implementations of this embodiment, the test case generating device 200 further includes:
the configuration file starting module is used for starting the configuration file of the use case;
the file configuration module is used for configuring a use case generating path, a use case display style and a default use case header of the use case configuration file;
and the functional factor enumeration module is used for enumerating the functional factors of the use case configuration file to obtain key configuration information.
In some optional implementations of this embodiment, the manual test case generation module 220 includes:
the arrangement and combination sub-module is used for carrying out automatic arrangement and combination operation on the parameters of the key configuration information based on a python orthogonal table method to obtain an initial manual test case;
and the exception handling sub-module is used for carrying out exception handling operation on the initial manual test case to obtain the manual test case, wherein the exception handling operation comprises a factor mutual exclusion operation and a flow termination operation.
In some optional implementations of this embodiment, the request deriving module 230 includes:
the file export sub-module is used for reading the engineering catalogue in the ApiFox and exporting an interface file;
and the request body acquisition sub-module is used for acquiring a request body corresponding to the interface URL information by taking the interface URL information as a unique key value to obtain a json request.
In some optional implementations of the present embodiment, the parameter obtaining module 240 includes:
the request body analysis sub-module is used for analyzing a request body of the json request based on the json library to obtain interface request information;
and the file acquisition sub-module is used for creating an initial json file, and storing the interface request information in the initial json file to obtain a json format file.
In some optional implementations of this embodiment, the apparatus 200 further includes:
the case integration module is used for configuring Jenkins Pipeline when the target automatic test case is transferred, and integrating the target automatic test case into a target item;
the task configuration module is used for configuring a timing task of the target item and generating an alure test report;
and the report pushing module is used for automatically pushing the alarm test report to related personnel.
In order to solve the technical problems, the embodiment of the application also provides computer equipment. Referring specifically to fig. 7, fig. 7 is a basic structural block diagram of a computer device according to the present embodiment.
The computer device 300 includes a memory 310, a processor 320, and a network interface 330 communicatively coupled to each other via a system bus. It should be noted that only computer device 300 having components 310-330 is shown in the figures, but it should be understood that not all of the illustrated components need be implemented, and that more or fewer components may be implemented instead. It will be appreciated by those skilled in the art that the computer device herein is a device capable of automatically performing numerical calculations and/or information processing in accordance with predetermined or stored instructions, the hardware of which includes, but is not limited to, microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASICs), programmable gate arrays (fields-Programmable Gate Array, FPGAs), digital processors (Digital Signal Processor, DSPs), embedded devices, etc.
The computer equipment can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The computer equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 310 includes at least one type of readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), programmable Read Only Memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 310 may be an internal storage unit of the computer device 300, such as a hard disk or a memory of the computer device 300. In other embodiments, the memory 310 may also be an external storage device of the computer device 300, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the computer device 300. Of course, the memory 310 may also include both internal storage units and external storage devices of the computer device 300. In this embodiment, the memory 310 is typically used to store an operating system and various application software installed on the computer device 300, such as computer readable instructions of a test case generating method. In addition, the memory 310 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 320 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 320 is generally used to control the overall operation of the computer device 300. In this embodiment, the processor 320 is configured to execute computer readable instructions stored in the memory 310 or process data, such as computer readable instructions for executing the test case generating method.
The network interface 330 may include a wireless network interface or a wired network interface, the network interface 330 typically being used to establish communication connections between the computer device 300 and other electronic devices.
The computer equipment provided by the application can eliminate the work of manually inputting the test cases in the prior art, simplify the test flow, effectively improve the generation efficiency of the test cases, save the consumption of human resources, and simultaneously, can be used by a developer when writing software and verify whether the purpose of the program accords with the expectation.
The present application also provides another embodiment, namely, a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the test case generating method as described above.
The computer readable storage medium provided by the application can eliminate the work of manually inputting the test cases, simplify the test flow, effectively improve the generation efficiency of the test cases and save the consumption of human resources, and simultaneously, a developer can use the computer readable storage medium when writing software and verify whether the purpose of the program accords with the expectation.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
It is apparent that the above-described embodiments are only some embodiments of the present application, but not all embodiments, and the preferred embodiments of the present application are shown in the drawings, which do not limit the scope of the patent claims. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a thorough and complete understanding of the present disclosure. Although the application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing description, or equivalents may be substituted for elements thereof. All equivalent structures made by the content of the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the scope of the application.

Claims (10)

1. The test case generation method is characterized by comprising the following steps:
acquiring key configuration information, wherein the key configuration information comprises key information interface field parameters, key test steps, interface URL information and related data table names;
performing case generation operation on the key configuration information based on a python orthogonal table method to obtain a manual test case;
deriving json requests from ApiFox based on the interface URL information;
obtaining each parameter corresponding to the json request to obtain a json format file, wherein the parameters corresponding to each json request comprise Chinese description in a comparison table and a database field mapped in the comparison table;
generating an initial automatic test case by taking the interface URL information as a primary key according to the Chinese description and the mapping field, wherein the initial automatic test case comprises a title description and a field value in an expected database table;
and performing test case improvement operation on the initial automatic test cases based on the parameters corresponding to each json request to obtain target automatic test cases.
2. The test case generating method according to claim 1, further comprising, before the step of acquiring key configuration information, the steps of:
a startup use case configuration file;
configuring a use case generating path, a use case display style and a default use case header of the use case configuration file;
and enumerating the functional factors of the use case configuration file to obtain the key configuration information.
3. The test case generating method according to claim 1, wherein the step of performing a case generating operation on the key configuration information based on a python orthogonal table method to obtain a manual test case specifically comprises the following steps:
carrying out automatic arrangement and combination operation on the parameters of the key configuration information based on the python orthogonal table method to obtain an initial manual test case;
and performing exception handling operation on the initial manual test case to obtain the manual test case, wherein the exception handling operation comprises a factor mutual exclusion operation and a flow termination operation.
4. The test case generating method according to claim 1, wherein the step of deriving the json request from ApiFox based on the interface URL information specifically comprises the steps of:
reading an engineering catalog in the ApiFox, and exporting an interface file;
and taking the interface URL information as a unique key value to acquire a request body corresponding to the interface URL information, and obtaining the json request.
5. The test case generating method according to claim 4, wherein the step of obtaining parameters corresponding to each json request to obtain json format file specifically includes the steps of:
analyzing the request body of the json request based on a json library to obtain interface request information;
and creating an initial json file, and storing the interface request information in the initial json file to obtain the json format file.
6. The test case generating method according to claim 1, wherein after the step of performing test case improvement operation on the initial automated test case based on the parameters corresponding to each json request to obtain a target automated test case, further comprising the steps of:
when the target automatic test case is rotated, configuring Jenkins Pipeline, and integrating the target automatic test case into a target item;
configuring a timing task of the target item, and generating an alure test report;
automatically pushing the alure test report to related personnel.
7. A test case generating apparatus, comprising:
the configuration information acquisition module is used for acquiring key configuration information, wherein the key configuration information comprises key information interface field parameters, key test steps, interface URL information and related data table names;
the manual test case generation module is used for carrying out case generation operation on the key configuration information based on a python orthogonal table method to obtain a manual test case;
the request export module is used for exporting json requests from ApiFox based on the interface URL information;
the parameter acquisition module is used for acquiring each parameter corresponding to the json request to obtain a json format file, wherein the parameters corresponding to each json request comprise Chinese description in a comparison table and a database field mapped in the comparison table;
the automatic test case generation module is used for taking the interface URL information as a primary key and generating an initial automatic test case according to the Chinese description and the mapping field, wherein the initial automatic test case comprises a title description and a field value in an expected database table;
and the test case perfecting module is used for carrying out test case perfecting operation on the initial automatic test case based on the parameters corresponding to each json request to obtain a target automatic test case.
8. The test case generating device according to claim 7, wherein the device further comprises:
the configuration file starting module is used for starting the configuration file of the use case;
the file configuration module is used for configuring a use case generating path, a use case display style and a default use case header of the use case configuration file;
and the functional factor enumeration module is used for enumerating the functional factors of the use case configuration file to obtain the key configuration information.
9. A computer device comprising a memory having stored therein computer readable instructions which when executed by a processor implement the steps of the test case generation method of any of claims 1 to 6.
10. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of the test case generation method of any of claims 1 to 6.
CN202311288653.XA 2023-10-08 Test case generation method and device, computer equipment and storage medium Active CN117033249B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311288653.XA CN117033249B (en) 2023-10-08 Test case generation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311288653.XA CN117033249B (en) 2023-10-08 Test case generation method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117033249A true CN117033249A (en) 2023-11-10
CN117033249B CN117033249B (en) 2024-07-02

Family

ID=

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573566A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Multi-system test case generation method, device and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110297774A (en) * 2019-07-02 2019-10-01 四川长虹电器股份有限公司 A kind of automatic interface testing method based on python
CN111258884A (en) * 2020-01-08 2020-06-09 福建博思软件股份有限公司 System for automatically generating interface accuracy verification script
CN112100078A (en) * 2020-09-27 2020-12-18 中国建设银行股份有限公司 Method, device and equipment for generating interface test case
WO2021003818A1 (en) * 2019-07-08 2021-01-14 平安科技(深圳)有限公司 Interface test case generating method and apparatus, computer device, and storage medium
CN113297086A (en) * 2021-05-31 2021-08-24 马上消费金融股份有限公司 Test case generation method and device, electronic equipment and storage medium
CN113495831A (en) * 2020-04-03 2021-10-12 卫宁健康科技集团股份有限公司 Method, system, device and medium for generating test case based on keyword
CN113535565A (en) * 2021-07-19 2021-10-22 工银科技有限公司 Interface use case generation method, device, equipment, medium and program product
CN114741283A (en) * 2022-03-30 2022-07-12 徐工汉云技术股份有限公司 Automatic interface testing method and device based on python design
CN115061912A (en) * 2022-06-17 2022-09-16 平安银行股份有限公司 Test case generation and test method, system and medium
CN115391219A (en) * 2022-09-06 2022-11-25 平安银行股份有限公司 Test case generation method and device, electronic equipment and storage medium
CN115437954A (en) * 2022-10-11 2022-12-06 上海即科智能技术集团有限公司 Interface automation test data separation method

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110297774A (en) * 2019-07-02 2019-10-01 四川长虹电器股份有限公司 A kind of automatic interface testing method based on python
WO2021003818A1 (en) * 2019-07-08 2021-01-14 平安科技(深圳)有限公司 Interface test case generating method and apparatus, computer device, and storage medium
CN111258884A (en) * 2020-01-08 2020-06-09 福建博思软件股份有限公司 System for automatically generating interface accuracy verification script
CN113495831A (en) * 2020-04-03 2021-10-12 卫宁健康科技集团股份有限公司 Method, system, device and medium for generating test case based on keyword
CN112100078A (en) * 2020-09-27 2020-12-18 中国建设银行股份有限公司 Method, device and equipment for generating interface test case
CN113297086A (en) * 2021-05-31 2021-08-24 马上消费金融股份有限公司 Test case generation method and device, electronic equipment and storage medium
CN113535565A (en) * 2021-07-19 2021-10-22 工银科技有限公司 Interface use case generation method, device, equipment, medium and program product
CN114741283A (en) * 2022-03-30 2022-07-12 徐工汉云技术股份有限公司 Automatic interface testing method and device based on python design
CN115061912A (en) * 2022-06-17 2022-09-16 平安银行股份有限公司 Test case generation and test method, system and medium
CN115391219A (en) * 2022-09-06 2022-11-25 平安银行股份有限公司 Test case generation method and device, electronic equipment and storage medium
CN115437954A (en) * 2022-10-11 2022-12-06 上海即科智能技术集团有限公司 Interface automation test data separation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MOB64CA14116C53: "正交表法测试用例设计的Python实现", pages 1 - 23, Retrieved from the Internet <URL:https://blog.51cto.com/u_16213688/7401923> *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573566A (en) * 2024-01-16 2024-02-20 麒麟软件有限公司 Multi-system test case generation method, device and storage medium
CN117573566B (en) * 2024-01-16 2024-04-12 麒麟软件有限公司 Multi-system test case generation method, device and storage medium

Similar Documents

Publication Publication Date Title
CN116644213A (en) XML file reading method, device, equipment and storage medium
CN117234505A (en) Interactive page generation method, device, equipment and storage medium thereof
CN117216114A (en) Data stream association method, device, equipment and storage medium thereof
CN116974929A (en) Automatic test tool construction method, automatic test method and related equipment thereof
CN112363814A (en) Task scheduling method and device, computer equipment and storage medium
CN117111909A (en) Code automatic generation method, system, computer equipment and storage medium
CN116450723A (en) Data extraction method, device, computer equipment and storage medium
CN111177387A (en) User list information processing method, electronic device and computer readable storage medium
CN117033249B (en) Test case generation method and device, computer equipment and storage medium
CN115756692A (en) Method for automatically combining and displaying pages based on style attributes and related equipment thereof
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN117033249A (en) Test case generation method and device, computer equipment and storage medium
CN116302847B (en) Dynamic acquisition method and device of abnormal information, computer equipment and medium
CN117785181A (en) Code execution method, device, equipment and storage medium thereof
CN116541417A (en) Batch data processing method, device, computer equipment and storage medium
CN116467166A (en) Defect information processing method, device, equipment and storage medium thereof
CN116594599A (en) Vue project file scanning display method, device, equipment and storage medium thereof
CN117492752A (en) Page dynamic configuration method and device, computer equipment and storage medium
CN116166270A (en) XAML file correction method, XAML file correction device, computer equipment and storage medium
CN116701119A (en) Batch running task data monitoring method, device, equipment and storage medium thereof
CN117421233A (en) Annotation-based code generation method, annotation-based code generation device, computer equipment and storage medium
CN117194032A (en) Task execution method, device, equipment and storage medium thereof
CN117850842A (en) Plug-in updating method, device, equipment and storage medium thereof
CN115033486A (en) Processing method for error reporting of test case and related equipment thereof
CN117421207A (en) Intelligent evaluation influence point test method, intelligent evaluation influence point test device, computer 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