CN117632771A - Method, device, equipment and medium for generating test cases in real time - Google Patents

Method, device, equipment and medium for generating test cases in real time Download PDF

Info

Publication number
CN117632771A
CN117632771A CN202410101998.8A CN202410101998A CN117632771A CN 117632771 A CN117632771 A CN 117632771A CN 202410101998 A CN202410101998 A CN 202410101998A CN 117632771 A CN117632771 A CN 117632771A
Authority
CN
China
Prior art keywords
data structure
data
branch
association
establishing
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
CN202410101998.8A
Other languages
Chinese (zh)
Other versions
CN117632771B (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.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202410101998.8A priority Critical patent/CN117632771B/en
Publication of CN117632771A publication Critical patent/CN117632771A/en
Application granted granted Critical
Publication of CN117632771B publication Critical patent/CN117632771B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention relates to the technical field of computers, and provides a method, a device, equipment and a medium for generating test cases in real time. The method comprises the following steps: establishing a first data structure, a second data structure, a third data structure and a fourth data structure for test case type description, demand description and content description; establishing a first association between the third data structure and the first data structure and a second association between the third data structure and the second data structure, and establishing a third association between the fourth data structure and the first data structure, the second data structure and the third data structure respectively; inquiring the fourth data structure based on the parameters transferred by the operation to obtain corresponding fields so as to update the fourth data structure; and synchronizing the updated data in the fourth data structure into the first data structure, the second data structure and the third data structure, updating the first association and the second association, and generating test cases for executing operations on brain graph branches. The scheme improves the generation efficiency of the test cases.

Description

Method, device, equipment and medium for generating test cases in real time
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for generating test cases in real time.
Background
The test cases are required to be used in the software test, the quality of the test cases relates to the quality of the software test, the project is gradually increased along with the gradual perfection of the storage product line, the requirements on the test cases are also higher, and the requirements on the efficiency and the quality of the test cases are also higher.
The existing test case generation method generally adopts an xmind and excel form for combination, adopts xmind for downlink design, and then adopts an excel import system. The design and writing processes of the test cases have repeated content, one test case can be realized through two documents (an xmind design document and an excel design document), the efficiency of generating the test case is not improved, and the problem of inaccurate data can be caused.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, apparatus, device and medium for generating test cases in real time.
According to a first aspect of the present invention, there is provided a method for generating test cases in real time, the method for generating test cases in real time including:
Establishing a first data structure, a second data structure and a third data structure for respectively describing the type description, the demand description and the content description of the test case, and establishing a fourth data structure, wherein data of brain graph branches are stored in the fourth data structure;
establishing a first association between the third data structure and the first data structure, and a second association between the third data structure and the second data structure, and establishing a third association for synchronizing data of the brain graph branch between the fourth data structure and the first data structure, the second data structure, and the third data structure, respectively, wherein the first association and the second association are updated based on the synchronized data of the brain graph branch;
executing operation on the brain graph branch, inquiring the fourth data structure based on the parameters transferred by the operation to obtain corresponding fields, and updating the fourth data structure based on the corresponding fields and the parameters transferred by the operation;
and synchronizing the updated data in the fourth data structure into the first data structure, the second data structure and the third data structure based on the third association, further updating the first association and the second association, and generating a test case for executing the operation on the brain graph branch in response to the completion of updating.
In some embodiments, the step of creating a first data structure, a second data structure, and a third data structure for the test case type description, the requirement description, and the content description, respectively, includes:
establishing a corresponding first data structure based on a plurality of types of test cases;
establishing a corresponding second data structure based on a plurality of requirements for the test case;
and establishing a third data structure for describing the content of the test case based on the preset condition, the test step and the expected result.
In some embodiments, the step of establishing the corresponding first data structure based on the plurality of types of test cases includes:
a first data structure including a parent class type and a child class type is established based on several types of test cases.
In some embodiments, the step of establishing a corresponding second data structure based on the number of requirements for the test case comprises:
a second data structure including parent and child requirements is established based on the number of requirements for the test case.
In some embodiments, the step of establishing a first association between the third data structure and the first data structure comprises:
And adding an identifier of a type corresponding to the test case in the third data structure, and matching one corresponding type in the first data structure based on the identifier of the type to establish a first association between the third data structure and the first data structure.
In some embodiments, the step of establishing a second association between the third data structure and the second data structure comprises:
and associating the test case with a plurality of requirements based on the identification of the test case in the third data structure and the identification of the requirements in the second data structure to establish a second association between the third data structure and the second data structure.
In some embodiments, the step of establishing a fourth data structure comprises:
and establishing a fourth data structure based on the labels respectively corresponding to the test cases, preset conditions, test steps, expected results, requirements and types in the first data structure, the second data structure and the third data structure, and the corresponding identification, content and data of the branches in the brain graph branches.
In some embodiments, the step of establishing a third association for synchronizing data of the brain map branch between the fourth data structure and the first, second and third data structures, respectively, comprises:
A third association of data for synchronizing the brain map branches between the fourth data structure and the first, second and third data structures, respectively, is established based on the corresponding tag.
In some embodiments, the performing an operation on the brain map branch comprises:
and executing an adding operation, a deleting operation and a modifying operation on the brain graph branch.
In some embodiments, the step of updating the fourth data structure based on the corresponding field and the parameters passed by the operation comprises:
in response to executing the adding operation on the brain graph branch, querying a first field in the fourth data structure and storing, adding an identification corresponding to the branch to be added to the corresponding identification of the branch in the fourth data structure, and adding parameters transferred by the adding operation to data of the branch in the fourth data structure.
In some embodiments, the step of updating the fourth data structure based on the corresponding field and the operation-passed parameter further comprises:
responding to the execution of modification operation on the brain graph branches, inquiring a second field in the fourth data structure and storing the second field, and inquiring whether data of branches to be modified in the fourth data structure are persistent data or not;
And in response to the data of the branch to be modified being persistent data, updating the data of the branch to be modified based on the input parameters.
In some embodiments, the step of updating the fourth data structure based on the corresponding field and the operation-passed parameter further comprises:
and updating the data of the branch to be modified in the fourth data structure based on the first field and the input parameters in the fourth data structure in response to the data of the branch to be modified being non-persistent data.
In some embodiments, the step of updating the fourth data structure based on the corresponding field and the operation-passed parameter further comprises:
responding to the execution of deleting operation on the brain graph branches, inquiring a third field in the fourth data structure and storing the third field, and inquiring whether data of the branches to be deleted in the fourth data structure are persistent data or not;
deleting the data of the branch to be deleted in response to the data of the branch to be deleted being persistent data;
and deleting the data of the branch to be deleted in the fourth data structure based on the first field in the fourth data structure in response to the data of the branch to be deleted being non-persistent data.
According to a second aspect of the present invention, there is provided an apparatus for real-time generation of test cases, the apparatus comprising:
the first module is used for establishing a first data structure, a second data structure and a third data structure which are used for describing the type, the requirement description and the content description of the test case respectively, and establishing a fourth data structure, wherein the data of the brain graph branch is stored in the fourth data structure;
a second module for establishing a first association between the third data structure and the first data structure, and a second association between the third data structure and the second data structure, and for establishing a third association for synchronizing data of the brain graph branch between the fourth data structure and the first data structure, the second data structure, and the third data structure, respectively, wherein the first association and the second association are updated based on the synchronized data of the brain graph branch;
a third module, configured to perform an operation on the brain graph branch, query the fourth data structure for a corresponding field based on a parameter transferred by the operation, and update the fourth data structure based on the corresponding field and the parameter transferred by the operation;
And a fourth module, configured to synchronize the updated data in the fourth data structure to the first data structure, the second data structure, and the third data structure based on the third association, further update the first association and the second association, and generate a test case for executing the operation on the brain graph branch in response to the update being completed.
According to a third aspect of the present invention, there is also provided an electronic device including:
at least one processor; and
and the memory stores a computer program which can be run on a processor, and the processor executes the method for generating the test cases in real time when executing the program.
According to a fourth aspect of the present invention, there is also provided a computer readable storage medium storing a computer program which, when executed by a processor, performs the method of real-time generation of test cases as described above.
The method for generating the test case in real time includes the steps of firstly, respectively establishing a first data structure, a second data structure and a third data structure for type description, demand description and content description of the test case, and establishing a fourth data structure, wherein data of brain graph branches are stored in the fourth data structure, then, establishing a first association between the third data structure and the first data structure and a second association between the third data structure and the second data structure, and establishing a third association between the fourth data structure and the first data structure, the second data structure and the third data structure. And inquiring corresponding fields in a fourth data structure for corresponding operations of the brain graph branches, updating data of the brain graph branches in the fourth data structure based on the corresponding fields and parameters transferred by the operations, storing the updated data of the brain graph branches into a first data structure, a second data structure and the third data structure based on a third association, and updating the first association and the second association to generate corresponding test cases in real time. The design and the generation process of the test case do not involve two documents, the test case is generated after the design of the test case is completed, the generation efficiency of the test case is improved, further, the data of the test case is counted in real time, the management is convenient, the process is transparent, and the problem that the generated test case is inaccurate is avoided.
In addition, the invention also provides a device for generating the test case in real time, an electronic device and a computer readable storage medium, which can also realize the technical effects, and are not repeated here.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are necessary for the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention and that other embodiments may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for real-time generation of test cases according to one embodiment of the present invention;
FIG. 2 is another flow chart of a method for real-time generation of test cases according to one embodiment of the present invention;
FIG. 3 is a schematic diagram of a brain branch structure according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an apparatus for real-time generation of test cases according to another embodiment of the present invention;
FIG. 5 is an internal block diagram of an electronic device in accordance with another embodiment of the present invention;
Fig. 6 is a block diagram of a computer readable storage medium according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention will be further described in detail with reference to the accompanying drawings.
It should be noted that, in the embodiments of the present invention, all the expressions "first" and "second" are used to distinguish two entities with the same name but different entities or different parameters, and it is noted that the "first" and "second" are only used for convenience of expression, and should not be construed as limiting the embodiments of the present invention, and the following embodiments are not described one by one.
In one embodiment, referring to fig. 1, the present invention provides a method 100 for generating test cases in real time, specifically, the method for generating test cases in real time includes the following steps:
step 101, establishing a first data structure, a second data structure and a third data structure for respectively describing the type, the requirement description and the content description of the test case, and establishing a fourth data structure, wherein data of brain graph branches are stored in the fourth data structure;
step 102, establishing a first association between the third data structure and the first data structure, and a second association between the third data structure and the second data structure, and establishing a third association for synchronizing data of the brain graph branch between the fourth data structure and the first data structure, the second data structure, and the third data structure, respectively, wherein the first association and the second association are updated based on the synchronized data of the brain graph branch;
Step 103, executing operation on the brain graph branch, inquiring the fourth data structure based on the parameters transferred by the operation to obtain corresponding fields, and updating the fourth data structure based on the corresponding fields and the parameters transferred by the operation;
step 104, synchronizing the updated data in the fourth data structure into the first data structure, the second data structure and the third data structure based on the third association, further updating the first association and the second association, and generating a test case for executing the operation on the brain graph branch in response to the completion of updating.
According to the method for generating the test cases in real time, two documents are not involved in the design and generation process of the test cases, the test cases are generated after the design of the test cases is completed, the generation efficiency of the test cases is improved, further, the data of the test cases are counted in real time, the management is convenient, the transparency is achieved, and the problem that the generated test cases are inaccurate is avoided.
According to several embodiments of the present invention, the step of creating a first data structure, a second data structure, and a third data structure for the test case type description, the requirement description, and the content description, respectively, includes:
Establishing a corresponding first data structure based on a plurality of types of test cases;
establishing a corresponding second data structure based on a plurality of requirements for the test case;
and establishing a third data structure for describing the content of the test case based on the preset condition, the test step and the expected result.
By establishing the first data structure, the second data structure and the third data structure which are correspondingly described with respect to the test cases and the requirements, the back end can directly perform persistence preservation on data based on the brain graph design of the front end, and the transparency and the searchability of the test cases are ensured.
According to several embodiments of the present invention, the step of establishing the corresponding first data structure based on several types of test cases includes:
a first data structure including a parent class type and a child class type is established based on several types of test cases.
The type of the test case is nested and expanded based on the parent type and the subtype type.
According to several embodiments of the present invention, the step of creating a corresponding second data structure based on several requirements for the test case includes:
a second data structure including parent and child requirements is established based on the number of requirements for the test case.
The corresponding requirements of the test cases are nested and expanded based on parent class requirements and subclass requirements.
According to several embodiments of the present invention, the step of establishing a first association between the third data structure and the first data structure comprises:
and adding an identifier of a type corresponding to the test case in the third data structure, and matching one corresponding type in the first data structure based on the identifier of the type to establish a first association between the third data structure and the first data structure.
And establishing a first association between the third data structure and the first data structure based on the type identifier, so that only one corresponding type is associated with one test case.
According to several embodiments of the present invention, the step of establishing a second association between the third data structure and the second data structure comprises:
and associating the test case with a plurality of requirements based on the identification of the test case in the third data structure and the identification of the requirements in the second data structure to establish a second association between the third data structure and the second data structure.
A second association between the third data structure and the second data structure is established based on the identification of the requirements, so that a test case can associate a plurality of requirements.
According to several embodiments of the present invention, the step of creating a fourth data structure includes:
and establishing a fourth data structure based on the labels respectively corresponding to the test cases, preset conditions, test steps, expected results, requirements and types in the first data structure, the second data structure and the third data structure, and the corresponding identification, content and data of the branches in the brain graph branches.
In some embodiments, corresponding labels are set on all branches in a brain graph designed at the front end, such as a test case branch adding label "test case", a preset condition branch adding label "preset condition", a test step branch adding label "test step", an expected result branch adding label "expected result", a demand branch adding label "demand" to which an example belongs, a label "module" is added to a module "to which each branch has a corresponding label for distinguishing, so that the rear end can receive and process data conveniently.
The correspondence between the front-end brain diagram branch design and the back-end data structure is established in a label mode, and the test cases are designed through the brain diagram, so that repeated work is avoided, and the real-time generation efficiency of the test cases is improved.
According to several embodiments of the present invention, the step of establishing a third association for synchronizing data of the brain map branches between the fourth data structure and the first, second and third data structures, respectively, comprises:
a third association of data for synchronizing the brain map branches between the fourth data structure and the first, second and third data structures, respectively, is established based on the corresponding tag.
The third association correspondence between the fourth data structure and the first data structure, between the second data structure and the third data structure is established in a label mode, and the test cases are designed through the brain diagram, so that repeated work is avoided, and the efficiency of real-time generation of the test cases is improved.
According to several embodiments of the present invention, the performing an operation on the brain map branch includes:
and executing an adding operation, a deleting operation and a modifying operation on the brain graph branch.
According to several embodiments of the present invention, the step of updating the fourth data structure based on the corresponding field and the parameters passed by the operation comprises:
In response to executing the adding operation on the brain graph branch, querying a first field in the fourth data structure and storing, adding an identification corresponding to the branch to be added to the corresponding identification of the branch in the fourth data structure, and adding parameters transferred by the adding operation to data of the branch in the fourth data structure.
For the newly added branches, the data of the added branches can be stored in the fourth data structure based on the fourth data structure and the data transmitted from the front end, so that the situation that the statistics of the test cases needs to be manually performed is avoided, and the data accuracy and the real-time generation efficiency of the test cases are improved.
According to several embodiments of the present invention, the step of updating the fourth data structure based on the corresponding field and the parameters transferred by the operation further comprises:
responding to the execution of modification operation on the brain graph branches, inquiring a second field in the fourth data structure and storing the second field, and inquiring whether data of branches to be modified in the fourth data structure are persistent data or not;
and in response to the data of the branch to be modified being persistent data, updating the data of the branch to be modified based on the input parameters.
For the modified branches, whether the data of the branches to be modified in the fourth data structure are persistent data or not can be queried based on the fourth data structure, and the corresponding modification is carried out on the persistent data and the non-persistent data respectively, so that the modification can be carried out even if the data which are not subjected to the persistence preservation at the back end is ensured.
According to several embodiments of the present invention, the step of updating the fourth data structure based on the corresponding field and the parameters transferred by the operation further comprises:
and updating the data of the branch to be modified in the fourth data structure based on the first field and the input parameters in the fourth data structure in response to the data of the branch to be modified being non-persistent data.
According to several embodiments of the present invention, the step of updating the fourth data structure based on the corresponding field and the parameters transferred by the operation further comprises:
responding to the execution of deleting operation on the brain graph branches, inquiring a third field in the fourth data structure and storing the third field, and inquiring whether data of the branches to be deleted in the fourth data structure are persistent data or not;
deleting the data of the branch to be deleted in response to the data of the branch to be deleted being persistent data;
And deleting the data of the branch to be deleted in the fourth data structure based on the first field in the fourth data structure in response to the data of the branch to be deleted being non-persistent data.
For the branches to be deleted, whether the data of the branches to be deleted in the fourth data structure is the persistent data or not can be queried based on the fourth data structure, and the corresponding deletion of the persistent data and the non-persistent data is respectively carried out, so that the deletion of the data which is not stored in a persistence mode at the rear end is ensured.
In order to further understand the method for generating the test cases in real time, in a specific embodiment, a VUE and an element UI architecture are adopted at the front end, a SpringBoot framework is adopted at the rear end, and meanwhile, the test cases are generated in real time through brain diagrams by using an open source plug-in module K-minder-editor. The test case is transmitted between the front end and the back end through an http service, and the back end server receives data and carries out corresponding processing, and finally persists into a database.
Establishing a first data structure, a second data structure and a third data structure for respectively describing the type, the requirement description and the content description of the test case, and establishing a fourth data structure, wherein data of brain graph branches are stored in the fourth data structure, specifically, the first data structure represents the classification type of the test case and can be shown in a module, and the multi-layer nested use can be realized through two fields of a parent_id and an id, and the representation of the first data structure (module) is shown in the table 1:
TABLE 1
The second data structure described with respect to demand may be used by multi-layer nesting, and in particular, the representation of the second data structure is as shown in table 2:
TABLE 2
The test cases contain preset conditions, test steps and expected results, and are all contained in one record in the database, and the representation of the third data structure for the description of the content is shown in table 3:
TABLE 3 Table 3
Establishing a first association between the third data structure and the first data structure, wherein the corresponding relationship between the type and the test cases is a one-to-many corresponding relationship, namely, one module associates a plurality of test cases, and establishing a second association between the third data structure and the second data structure, wherein the corresponding relationship between the test cases and the requirements is a many-to-many corresponding relationship, and the data structure corresponding to the second association is shown in a table 4:
TABLE 4 Table 4
Establishing a fourth data structure, wherein the fourth data structure is as shown in table 5:
TABLE 5
Based on the established first data structure, the established second data structure, the established third data structure and the established fourth data structure, the established first association between the third data structure and the first data structure, and the established second association between the third data structure and the second data structure, the established fourth data structure is respectively associated with the first data structure, the second data structure and the third data structure, and the established fourth data structure corresponds to the newly added, modified and deleted branches according to the change of the brain graph branches, so as to perform corresponding operations on the changed branches. As shown in fig. 2, fig. 2 is another flowchart of a method for generating test cases in real time according to an embodiment of the present invention, which specifically includes the following steps:
Firstly, a module to be edited is selected on a front-end page, a brain chart is entered, please refer to fig. 3, fig. 3 shows a schematic diagram of a brain chart branch provided for one embodiment of the present invention, meanwhile, corresponding test case data is queried at a back end and formatted into a brain chart format (the test case is named as a father branch and labeled with a label "test case"), and preset conditions, test steps, expected results and belonging requirements are child branches of the test case and labeled with corresponding labels respectively).
When the brain map branch content changes, the changed data appear in the newly added branch (addNwNodes), the modified branch (modyNodes) and the deleted branch (deleteNodes). And when the brain map is newly added, modified and deleted, processing the three parameters respectively.
When an adding operation is performed on the brain graph branch, a first field in the fourth data structure is queried and saved, an identifier corresponding to the branch to be added is added to a corresponding identifier of the branch in the fourth data structure, and a parameter transferred by the adding operation is added to data of the branch in the fourth data structure, in a specific embodiment, a created field in the fourth data structure is queried, and each branch is added, an id of the branch is inserted into an array parameter addonenodebs at the front end, and data of the branch is inserted into an array parameter addonenodebs.
When the modification operation is executed on the brain graph branch, a second field in the fourth data structure is queried and stored, and whether the data of the branch to be modified in the fourth data structure is persistent data is queried, in a specific embodiment, a modification module or a test case is queried, judgment is carried out according to the content of the modified branch, for the persistent branch, an id field with 19 digits exists in the data of the branch, whether the data is newly added and modified is distinguished according to the field, and if the id is the 19 digits, the branch data is synchronized into modification parameters; if not, synchronously updating the branch into the newly added parameters. And inquiring whether an id field in data of whether branches exist in the array parameter modifyNodes is equal to the id. If the parameters are equal, the latest branch data are replaced by the data in the parameters, and if the parameters are not equal, the branch data are inserted into the modified Nodes; for branches (newly added branches) which are not persistent, a created field in branch data is identified, and whether an id exists in an array parameter addNewNodeIds or not is checked to be equal to the id. If the parameters are equal, the latest branch data id is replaced by the data in the parameter addNewNodes, the latest branch data is replaced by the data in the parameter addNewNodes, and if the parameters are not equal, the branch data is inserted into the modified Nodes.
When the deletion operation is performed on the brain graph branch, the third field in the fourth data structure is queried and saved, and whether the data of the branch to be deleted in the fourth data structure is persistent data is queried, in a specific embodiment, the deletion test case (the module does not allow deletion) is judged according to the content of the deletion branch. When deleting the durable branches, synchronizing the id fields of the branches into deletion parameters; when deleting the branches which are not durable, deleting the corresponding branch data in the newly added parameters. For the persisted branches, the id field in the data of the branches is inserted into the array parameter deletetnodeids. Simultaneously inquiring whether branches with the id field equal to the id in the branch data exist in the modified Nodes, and deleting corresponding data in the parameters of the modified Nodes if the branches exist; and deleting the corresponding id in the addNewNodeIds parameter for the newly added branch, and deleting the corresponding branch data in the addNewNodes.
Based on the above, the front end passes the parameters addNewNodeIds, addNewNodes, modifyNodes, deleteNodeIds and other parameters to the back end via POST. The test case data is processed and transmitted to the back end for receiving, and the back end is processed and persisted to the database, so that the corresponding test case is generated. Specifically, checking whether id data in the addNewNodes are consistent with id data in the addNewNodes, and after checking that the data are error-free, circulating the addNewNodes, packaging case information (case name, preset condition, test step and expected result) in the data into an object, and storing the case information into a database in a lasting manner; circularly modifying Nodes parameters, carrying out data updating operation through id, and persisting the parameters into a database; and (3) circulating the deletetnodeids parameter, and performing data deletion operation through the id. Finally, the durable test case data is directly obtained from the rear end and converted into a test design format, and the test design format is displayed on a brain chart to realize the design of the case and the design of the case.
According to the method for generating the test cases in real time, two documents are not involved in the design and generation process of the test cases, the test cases are generated after the design of the test cases is completed, the generation efficiency of the test cases is improved, further, the data of the test cases are counted in real time, the management is convenient, the transparency is achieved, and the problem that the generated test cases are inaccurate is avoided.
In some embodiments, referring to fig. 4, the present invention further provides an apparatus 200 for generating test cases in real time, where the apparatus includes:
a first module 201, configured to establish a first data structure, a second data structure, and a third data structure for respectively describing a test case type description, a requirement description, and a content description, and establish a fourth data structure in which data of brain graph branches are stored;
a second module 202 for establishing a first association between the third data structure and the first data structure, and a second association between the third data structure and the second data structure, and for establishing a third association for synchronizing data of the brain graph branch between the fourth data structure and the first data structure, the second data structure, and the third data structure, respectively, wherein the first association and the second association are updated based on the synchronized data of the brain graph branch;
A third module 203, configured to perform an operation on the brain graph branch, query the fourth data structure for a corresponding field based on a parameter transferred by the operation, and update the fourth data structure based on the corresponding field and the parameter transferred by the operation;
a fourth module 204, configured to synchronize the data updated in the fourth data structure to the first data structure, the second data structure, and the third data structure based on the third association, further update the first association and the second association, and generate a test case for performing the operation on the brain graph branch in response to the update being completed.
According to the device for generating the test cases in real time, corresponding fields in the fourth data structure are queried for corresponding operations of the brain graph branches, data of the brain graph branches in the fourth data structure are updated based on the corresponding fields and parameters transferred by the operations, the updated data of the brain graph branches are stored in the first data structure, the second data structure and the third data structure based on the third association, and the first association and the second association are updated to generate the corresponding test cases in real time. The design and the generation process of the test case do not involve two documents, the test case is generated after the design of the test case is completed, the generation efficiency of the test case is improved, further, the data of the test case is counted in real time, the management is convenient, the process is transparent, and the problem that the generated test case is inaccurate is avoided.
It should be noted that, the specific limitation of the device for generating the test case in real time may refer to the limitation of the method for generating the test case in real time in the above description, and will not be repeated here. The modules in the device for generating the test cases in real time can be all or partially realized by software, hardware and a combination thereof. The above modules may be embedded in hardware or independent of a processor in the electronic device, or may be stored in software in a memory in the electronic device, so that the processor may call and execute operations corresponding to the above modules.
According to another aspect of the present invention, there is provided an electronic device, which may be a server, and an internal structure thereof is shown in fig. 5. The electronic device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic device includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the electronic device is for storing data. The network interface of the electronic device is used for communicating with an external terminal through a network connection. The computer program, when executed by the processor, implements the method of real-time generation of test cases described above.
According to still another aspect of the present invention, a computer readable storage medium is provided, as shown in fig. 6, on which a computer program is stored, and the computer program is executed by a processor to implement the method for generating test cases in real time.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (16)

1. The method for generating the test cases in real time is characterized by comprising the following steps of:
establishing a first data structure, a second data structure and a third data structure for respectively describing the type description, the demand description and the content description of the test case, and establishing a fourth data structure, wherein data of brain graph branches are stored in the fourth data structure;
Establishing a first association between the third data structure and the first data structure, and a second association between the third data structure and the second data structure, and establishing a third association for synchronizing data of the brain graph branch between the fourth data structure and the first data structure, the second data structure, and the third data structure, respectively, wherein the first association and the second association are updated based on the synchronized data of the brain graph branch;
executing operation on the brain graph branch, inquiring the fourth data structure based on the parameters transferred by the operation to obtain corresponding fields, and updating the fourth data structure based on the corresponding fields and the parameters transferred by the operation;
and synchronizing the updated data in the fourth data structure into the first data structure, the second data structure and the third data structure based on the third association, further updating the first association and the second association, and generating a test case for executing the operation on the brain graph branch in response to the completion of updating.
2. The method of claim 1, wherein the step of creating the first, second and third data structures for the test case type description, the requirement description and the content description, respectively, comprises:
Establishing a corresponding first data structure based on a plurality of types of test cases;
establishing a corresponding second data structure based on a plurality of requirements for the test case;
and establishing a third data structure for describing the content of the test case based on the preset condition, the test step and the expected result.
3. The method for generating test cases in real time according to claim 2, wherein the step of establishing the corresponding first data structure based on the types of test cases comprises:
a first data structure including a parent class type and a child class type is established based on several types of test cases.
4. The method of claim 2, wherein the step of creating a corresponding second data structure based on the number of requirements for the test case comprises:
a second data structure including parent and child requirements is established based on the number of requirements for the test case.
5. The method of claim 1, wherein the step of establishing a first association between the third data structure and the first data structure comprises:
And adding an identifier of a type corresponding to the test case in the third data structure, and matching one corresponding type in the first data structure based on the identifier of the type to establish a first association between the third data structure and the first data structure.
6. The method of claim 1, wherein the step of establishing a second association between the third data structure and the second data structure comprises:
and associating the test case with a plurality of requirements based on the identification of the test case in the third data structure and the identification of the requirements in the second data structure to establish a second association between the third data structure and the second data structure.
7. The method of claim 1, wherein the step of creating a fourth data structure comprises:
and establishing a fourth data structure based on the labels respectively corresponding to the test cases, preset conditions, test steps, expected results, requirements and types in the first data structure, the second data structure and the third data structure, and the corresponding identification, content and data of the branches in the brain graph branches.
8. The method of claim 7, wherein the step of establishing a third association for synchronizing data of the brain map branch between the fourth data structure and the first data structure, the second data structure, and the third data structure, respectively, comprises:
a third association of data for synchronizing the brain map branches between the fourth data structure and the first, second and third data structures, respectively, is established based on the corresponding tag.
9. The method of claim 8, wherein performing an operation on the brain map branch comprises:
and executing an adding operation, a deleting operation and a modifying operation on the brain graph branch.
10. The method of claim 9, wherein the step of updating the fourth data structure based on the corresponding field and the parameters passed by the operation comprises:
in response to executing the adding operation on the brain graph branch, querying a first field in the fourth data structure and storing, adding an identification corresponding to the branch to be added to the corresponding identification of the branch in the fourth data structure, and adding parameters transferred by the adding operation to data of the branch in the fourth data structure.
11. The method of claim 9, wherein the step of updating the fourth data structure based on the corresponding field and the parameters passed by the operation further comprises:
responding to the execution of modification operation on the brain graph branches, inquiring a second field in the fourth data structure and storing the second field, and inquiring whether data of branches to be modified in the fourth data structure are persistent data or not;
and in response to the data of the branch to be modified being persistent data, updating the data of the branch to be modified based on the input parameters.
12. The method of claim 11, wherein the step of updating the fourth data structure based on the corresponding field and the parameters passed by the operation further comprises:
and updating the data of the branch to be modified in the fourth data structure based on the first field and the input parameters in the fourth data structure in response to the data of the branch to be modified being non-persistent data.
13. The method of claim 9, wherein the step of updating the fourth data structure based on the corresponding field and the parameters passed by the operation further comprises:
Responding to the execution of deleting operation on the brain graph branches, inquiring a third field in the fourth data structure and storing the third field, and inquiring whether data of the branches to be deleted in the fourth data structure are persistent data or not;
deleting the data of the branch to be deleted in response to the data of the branch to be deleted being persistent data;
and deleting the data of the branch to be deleted in the fourth data structure based on the first field in the fourth data structure in response to the data of the branch to be deleted being non-persistent data.
14. An apparatus for real-time generation of test cases, the apparatus comprising:
the first module is used for establishing a first data structure, a second data structure and a third data structure which are used for describing the type, the requirement description and the content description of the test case respectively, and establishing a fourth data structure, wherein the data of the brain graph branch is stored in the fourth data structure;
a second module for establishing a first association between the third data structure and the first data structure, and a second association between the third data structure and the second data structure, and for establishing a third association for synchronizing data of the brain graph branch between the fourth data structure and the first data structure, the second data structure, and the third data structure, respectively, wherein the first association and the second association are updated based on the synchronized data of the brain graph branch;
A third module, configured to perform an operation on the brain graph branch, query the fourth data structure based on a parameter transferred by the operation to obtain a corresponding field, and update the fourth data structure based on the corresponding field and the parameter transferred by the operation;
and a fourth module, configured to synchronize the updated data in the fourth data structure to the first data structure, the second data structure, and the third data structure, further update the first association and the second association, and generate a test case for executing the operation on the brain graph branch in response to the update being completed.
15. An electronic device, comprising:
at least one processor; and
a memory storing a computer program executable in the processor, the processor executing the method of real-time generation of test cases according to any one of claims 1-13 when the program is executed.
16. A computer readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the method of real-time generation of test cases according to any one of claims 1-13.
CN202410101998.8A 2024-01-24 2024-01-24 Method, device, equipment and medium for generating test cases in real time Active CN117632771B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410101998.8A CN117632771B (en) 2024-01-24 2024-01-24 Method, device, equipment and medium for generating test cases in real time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410101998.8A CN117632771B (en) 2024-01-24 2024-01-24 Method, device, equipment and medium for generating test cases in real time

Publications (2)

Publication Number Publication Date
CN117632771A true CN117632771A (en) 2024-03-01
CN117632771B CN117632771B (en) 2024-04-12

Family

ID=90025559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410101998.8A Active CN117632771B (en) 2024-01-24 2024-01-24 Method, device, equipment and medium for generating test cases in real time

Country Status (1)

Country Link
CN (1) CN117632771B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120198280A1 (en) * 2011-01-28 2012-08-02 International Business Machines Corporation Test cases generation for different test types
CN108984208A (en) * 2018-06-26 2018-12-11 中国银行股份有限公司 A kind of function document generating method, apparatus and system
CN111290956A (en) * 2020-02-17 2020-06-16 贵阳货车帮科技有限公司 Brain graph-based testing method and device, electronic equipment and storage medium
CN112148593A (en) * 2020-09-01 2020-12-29 杭州大搜车汽车服务有限公司 Test case management method, device and equipment
CN114510425A (en) * 2022-02-18 2022-05-17 工银科技有限公司 Test case generation method and device
CN114936154A (en) * 2022-05-19 2022-08-23 中国农业银行股份有限公司 Test case and test data generation method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120198280A1 (en) * 2011-01-28 2012-08-02 International Business Machines Corporation Test cases generation for different test types
CN108984208A (en) * 2018-06-26 2018-12-11 中国银行股份有限公司 A kind of function document generating method, apparatus and system
CN111290956A (en) * 2020-02-17 2020-06-16 贵阳货车帮科技有限公司 Brain graph-based testing method and device, electronic equipment and storage medium
CN112148593A (en) * 2020-09-01 2020-12-29 杭州大搜车汽车服务有限公司 Test case management method, device and equipment
CN114510425A (en) * 2022-02-18 2022-05-17 工银科技有限公司 Test case generation method and device
CN114936154A (en) * 2022-05-19 2022-08-23 中国农业银行股份有限公司 Test case and test data generation method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
EMMA DALLAS: "Mind Maps in Software Testing", pages 1 - 6, Retrieved from the Internet <URL:https://blog.qatestlab.com/2019/06/06/mind-maps-testing/> *
ISYLAN215: "用思维导图写测试点的几点说明", pages 1 - 6, Retrieved from the Internet <URL:https://blog.csdn.net/sylan15/article/details/90416440> *

Also Published As

Publication number Publication date
CN117632771B (en) 2024-04-12

Similar Documents

Publication Publication Date Title
CN110908997B (en) Data blood relationship construction method and device, server and readable storage medium
WO2020186786A1 (en) File processing method and apparatus, computer device and storage medium
CN111027295B (en) Data processing method, device, computer equipment and storage medium
US9740698B2 (en) Document merge based on knowledge of document schema
CN112148509A (en) Data processing method, device, server and computer readable storage medium
CN111813799B (en) Database query statement generation method, device, computer equipment and storage medium
CN110990403A (en) Business data storage method, system, computer equipment and storage medium
CN116028653A (en) Method and system for constructing map by visually configuring multi-source heterogeneous data
CN110263104B (en) JSON character string processing method and device
CN114253995A (en) Data tracing method, device, equipment and computer readable storage medium
CN117632771B (en) Method, device, equipment and medium for generating test cases in real time
CN111984659B (en) Data updating method, device, computer equipment and storage medium
CN111026972B (en) Subscription data pushing method, device, equipment and storage medium in Internet of things
CN112817984A (en) Data processing method and device, and data source obtaining method and device
CN109697234B (en) Multi-attribute information query method, device, server and medium for entity
CN111859863A (en) Document structure conversion method and device, storage medium and electronic equipment
CN111753141A (en) Data management method and related equipment
CN113868138A (en) Method, system, equipment and storage medium for acquiring test data
CN110297651B (en) Method and device for updating common variables of protocol interface
CN113626464A (en) Query support method and system based on stored data in ClickHouse database
CN113536762A (en) JSON text comparison method and device
CN110674119A (en) Data processing method, system and computer readable storage medium
CN113792137B (en) Method, system, intelligent terminal and storage medium for searching middle-stage research and development materials
CN116756022A (en) Data preparation method, device, computer equipment and storage medium
CN116680203B (en) Multi-tenant-oriented SaaS platform testing method, device, equipment and 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