CN110543427B - Test case storage method and device, electronic equipment and storage medium - Google Patents

Test case storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110543427B
CN110543427B CN201910843362.XA CN201910843362A CN110543427B CN 110543427 B CN110543427 B CN 110543427B CN 201910843362 A CN201910843362 A CN 201910843362A CN 110543427 B CN110543427 B CN 110543427B
Authority
CN
China
Prior art keywords
case
nodes
node
database
test
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.)
Active
Application number
CN201910843362.XA
Other languages
Chinese (zh)
Other versions
CN110543427A (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.)
Wuba Co Ltd
Original Assignee
Wuba 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 Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN201910843362.XA priority Critical patent/CN110543427B/en
Publication of CN110543427A publication Critical patent/CN110543427A/en
Application granted granted Critical
Publication of CN110543427B publication Critical patent/CN110543427B/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a test case storage method, a device, an electronic device and a storage medium, wherein when a case is compiled and written, all nodes of a node tree in the case are obtained according to a preset test case rule, when other subsections except a root node are leaf nodes, all nodes on a path from the root node to the leaf node form a complete link, a result corresponding to a step of the case and all method calling relations for executing the step are stored on the complete link, and then the complete links on other leaf nodes are extracted according to the method; and finally, storing all the complete links into a database so as to reuse or modify each link. Therefore, according to the scheme provided by the invention, when the case is compiled and written, a plurality of complete links related to the case are extracted and stored in the database according to the established test case protocol, so that the case is prevented from being repeatedly used, the execution path of the case is re-analyzed and combed, the time is saved, and the case repeated use efficiency is improved.

Description

Test case storage method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of software development technologies, and in particular, to a test case storage method, a device, an electronic apparatus, and a storage medium.
Background
When software testing is performed, test cases need to be written to test the software. A test case, which may also be referred to as a case, is a set of data sets written for a certain purpose with test inputs, test conditions, and test results to test the path of a software program or to verify whether the software program meets a certain specific requirement.
At present, a plurality of different modes can be used for organizing and writing test cases of software, wherein xmind is thinking chart software and is widely applied to writing the test cases in software testing work. Each case written with xmind contains a set of information consisting of case requirement names, case steps and case expected results, and after the case is used, the set of information about the case is packaged and saved in a database. However, when the case is needed to be reused by a technician, the resolved case information cannot be directly used as test information, and the logical relationship of data in the case information needs to be re-carded to obtain a case with a complete execution path, and the complete case is used for testing again.
Therefore, the case written by xmind at present needs to be reused, and the execution path of the case needs to be parsed and carded again when the case is used each time, so that a great amount of time is consumed, and the case reuse efficiency is low.
Disclosure of Invention
The invention provides a test case storage method, a device, electronic equipment and a storage medium, which are used for solving the problem of low reuse efficiency of a case at present.
In a first aspect, the present invention provides a test case storage method, including:
analyzing a case written according to a test case protocol to obtain a root node of a node tree in the case and all child nodes of each level under the root node, wherein the test case protocol is used for prescribing case information stored in each node in the node tree of the written case;
traversing all child nodes of the node tree to obtain leaf nodes, wherein the leaf nodes do not have child nodes of the next level;
forming a plurality of complete links from root nodes, sub-nodes of each level between the root nodes and the leaf nodes according to a level sequence, wherein the root nodes are used for storing case topics, the sub-nodes of each level between the root nodes and the leaf nodes are respectively used for storing case step information and case result information, and each leaf node is used for storing method call relation information of one complete link;
each complete link is saved in turn to the database.
With reference to the first aspect, in an implementation manner of the first aspect, the step of parsing a case written according to a test case protocol to obtain a root node of a node tree in the case and all child nodes of each level under the root node includes:
judging whether file names of the cases exist in a database or not, wherein the file names correspond to the cases with different test functions;
and if the file name of the case does not exist in the database, analyzing the case.
With reference to the first aspect, in an implementation manner of the first aspect, the step of parsing a case written according to a test case protocol to obtain a root node of a node tree in the case and all child nodes of each level under the root node further includes:
if the file name of the case exists in the database, judging whether the version number of the case is updated or not, wherein the version number is used for identifying different versions of the case with the same test function;
if the version number has been updated, the case is parsed.
With reference to the first aspect, in an implementation manner of the first aspect, the step of parsing a case written according to a test case protocol to obtain a root node of a node tree in the case and all child nodes of each level under the root node further includes:
decompressing a case written according to a test case protocol to obtain an extensible markup language file, wherein the case is marked in the extensible markup language file by using an identification, so that the case can be executed by different processors;
and analyzing the extensible markup language file to obtain a root node of the node tree in the case and all child nodes of each level under the root node.
With reference to the first aspect, in an implementation manner of the first aspect, after sequentially saving each complete link to the database, the method includes:
and generating a case name for each complete link respectively, wherein the case names among the complete links are different.
With reference to the first aspect, in an implementation manner of the first aspect, after sequentially saving each complete link to the database, the method further includes:
acquiring a complete link to be modified corresponding to a case name to be modified from a database;
positioning nodes to be modified in a complete link to be modified according to content to be modified, wherein the content to be modified comprises a modification theme, modification step information, modification result information and/or modification method call relation information, and the nodes to be modified comprise a root node and all child nodes of each level under the root node;
and changing the case information of the node to be modified.
In a second aspect, an embodiment of the present invention provides a test case storage device, including:
the analysis module is used for analyzing the case written according to the test case protocol to obtain a root node of the node tree in the case and all child nodes of each level under the root node, wherein the test case protocol is used for prescribing case information stored in each node of the node tree of the written case;
the traversing module is used for traversing all the child nodes of the node tree to obtain leaf nodes, and the leaf nodes do not have child nodes of the next level;
the link generation module is used for forming a plurality of complete links from root nodes, sub-nodes of each level between the root nodes and the leaf nodes according to the level sequence, wherein the root nodes are used for storing case topics, the sub-nodes of each level between the root nodes and the leaf nodes are respectively used for storing case step information and case result information, and each leaf node is used for storing method call relation information of one complete link;
and the link saving module is used for saving each complete link in the database in sequence.
With reference to the second aspect, in an implementation manner of the second aspect, the parsing module includes:
the judging unit is used for judging whether the file names of the cases exist in the database or not, wherein the file names correspond to the cases with different test functions; and if the file name of the case does not exist in the database, analyzing the case.
With reference to the second aspect, in an implementation manner of the second aspect, the determining module is further configured to: if the file name of the case exists in the database, judging whether the version number of the case is updated or not, wherein the version number is used for identifying different versions of the case with the same test function; if the version number has been updated, the case is parsed.
With reference to the second aspect, in an implementation manner of the second aspect, the parsing module further includes:
the decompression unit is used for decompressing the case written according to the test case protocol to obtain an extensible markup language file, and the extensible markup language file is marked with the case by using the mark so that the case can be executed by different processors;
and the child node acquisition unit is used for analyzing the extensible markup language file to obtain a root node of the node tree in the case and all child nodes of each level under the root node.
With reference to the second aspect, in an implementation manner of the second aspect, the apparatus further includes:
the name distribution module is used for generating a case name for each complete link respectively, and the case names among the complete links are different from each other.
With reference to the second aspect, in an implementation manner of the second aspect, the apparatus further includes:
the link acquisition module is used for acquiring a complete link to be modified corresponding to the case name to be modified from the database;
the node positioning module is used for positioning nodes to be modified in the complete link to be modified according to the content to be modified, wherein the content to be modified comprises a modification theme, modification step information, modification result information and/or modification method call relation information, and the nodes to be modified comprise a root node and all child nodes of each level below the root node;
and the information modification module is used for modifying the case information of the node to be modified.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
a memory for storing program instructions;
and the processor is used for calling and executing the program instructions in the memory so as to realize the test case storage method in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a storage medium, where a computer program is stored, and when at least one processor of a test case storage device executes the computer program, the test case storage device executes the test case storage method according to the first aspect.
According to the technical scheme, the test case storage method, the device, the electronic equipment and the storage medium are used for carrying out the case programming according to the preset test case protocol, and different case information is stored in each node in the obtained case node tree; then obtaining all nodes of a node tree in a case, judging whether other child nodes except the root node are leaf nodes, when other child nodes are leaf nodes, forming a complete link from the root node to all nodes on the path from the leaf node, storing a result corresponding to a certain step of the case and executing all method calling relations of the step on the complete link, and extracting the complete links on other leaf nodes according to the method; and finally, storing all the complete links into a database so as to reuse or modify each link. Therefore, according to the scheme provided by the invention, when the case is compiled and written, a plurality of complete links related to the case are extracted and stored in the database according to the established test case protocol, so that the case is prevented from being repeatedly used, the execution path of the case is re-analyzed and combed, the time is saved, and the case repeated use efficiency is improved.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings that are needed in the embodiments will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flowchart of a test case storage method provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram of a node tree according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another node tree according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of case storage in a database according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a case store in another database according to an embodiment of the present invention;
FIG. 6 is a block diagram of a test case storage device according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
At present, each case written by xmind stores information related to the case into a database after the use, however, the information does not have a logic relationship when being stored, when a technician needs to use the case again, the parsed case information cannot be directly used as test information, the logic relationship of data in the case information needs to be re-carded, a case with a complete path is obtained, and the complete case is used for testing again. Therefore, if the case needs to be reused, the data logic of the case needs to be parsed and carded again every time the case is used, which causes the problem of low reuse efficiency of the case. In this regard, the invention provides a test case storage method, in which a case is written according to a test case protocol, then a logical complete execution link in the written case is parsed, the complete link is stored, when the case is used again, the corresponding link can be directly called for use according to different functions, and the case recycling efficiency is improved.
FIG. 1 is a flowchart of a test case storage method according to an embodiment of the present invention. As shown in FIG. 1, the test case storage method provided by the invention specifically comprises the following steps:
s101, analyzing the case written according to the test case protocol to obtain the root node of the node tree in the case and all child nodes of each level below the root node. The test case protocol is used for defining case information stored by each node in the node tree of the written case.
The complete case written by using the xmind tool comprises an execution step and an execution result, wherein the execution step can be divided into a plurality of branches, for example, when logging in a certain software, a user name and password login mode can be selected, and a mobile phone number and password login mode can also be selected. The case is stored in the current mode, namely, step information and execution result information corresponding to the case are all packed and stored in a database, but in the embodiment of the invention, in order to enable the case stored in the database to have complete logic, a test case protocol needs to be formulated when the case is written in the earlier stage, the test case protocol prescribes that the case written by xmind has a structure of a node tree, and fig. 2 is a schematic diagram of the node tree provided by the embodiment of the invention. As shown in fig. 2, the node tree includes a root node and a plurality of hierarchical sub-nodes under the root node, the specific number of the hierarchical levels can be set according to the specific execution steps of the case, the root node and each node store corresponding case information, and when the case is stored by using the hierarchical relationship of the node tree, the case information can have a logical relationship.
If the case only sets one login mode, at this time, each login mode corresponds to an execution result, and the login of the user name and the password is successful, and the login of the mobile phone number and the password is failed; or the user name and the password correspond to failed login, and the mobile phone number and the password correspond to successful login. In the actual functional test, the number of various functions and test modes to be tested is not counted, and the embodiments of the present invention will not be described in detail.
Therefore, the embodiment of the invention aims at the writing stage, and the test case protocol is customized, so that xmind writes cases according to the test case protocol, and a node tree for storing case information is generated, so that case paths with logical relations can be analyzed and then stored.
In the embodiment of the invention, the existence state of the written case is also judged, and for the case existing in the database, the case is not analyzed and stored in the embodiment of the invention. Specifically, the step of analyzing a case written according to a test case protocol to obtain a root node of a node tree in the case and all child nodes of each level under the root node includes:
s201, judging whether the file name of the case exists in a database. The case-saving file in the invention can be called a case file, and each case file has a file name, and the file name corresponds to the cases of different test functions. In general, the file names corresponding to cases for implementing one test function are the same. Taking the case of the test login procedure as an example, the file name may be "login test".
S202, if the file name of the case does not exist in the database, the case is analyzed.
If the file name of the login test is not in the database, the case for describing the login function may be a new test case, and the function test is not performed before, and the new case needs to be saved in the database for subsequent repeated calling; or, the case written by the common method is stored in the database, that is, the case written according to the test case protocol is not written, and then the case written according to the test case protocol is required to be stored in the database at the moment so as to be called repeatedly later.
It should be noted that, unless otherwise specified, cases in the embodiments of the present invention refer to cases written according to test case protocols.
S203, if the file name of the case exists in the database, judging whether the version number of the case is updated, wherein the version number is used for identifying different versions of the case with the same test function.
Applications typically exist in different versions, e.g., iOS systems have versions 12.3.0, 12.3.1, etc., a piece of software has versions 9.3.6, 9.4.0, etc., version numbers are used to distinguish between different versions of a unified system or unified software, there may be functional improvements between different versions or new versions repair some vulnerabilities compared to old versions, etc., as may case versions in embodiments of the present invention. For example, the initial version of a case for testing a function is 1.0.0, but a bug exists, the designer repairs the case, and the case is rewritten, and the version of the case is 1.0.1, and there may be only a small difference between the version 1.0.0 and the version 1.0.1, but all are for the same functional test.
Judging whether the version number of the case is updated or not, namely judging whether the version is the latest version of the case in the database, if not, indicating that the version number is not updated, and if the version number is not updated, the case of the version exists in the database, so that the case does not need to be stored any more, and the waste of storage space is avoided.
S204, if the version number is updated, analyzing the case. If the version number has been updated, indicating that this version does not exist in the case database, this case needs to be stored.
Therefore, the method provided by the embodiment of the invention can also judge the existence state of the case file in advance, and can analyze and store the case with updated version numbers; and the case with the version number not updated is not processed, so that the waste of the storage space of the database is avoided.
In addition, when xmind writes cases, considering the problem of program universality, the written cases need to be processed into extensible markup language files, the specific file suffix is xml, and then the package files are compressed to form a case original file, and the suffix of the original file is xml. Correspondingly, in the case storage process, analyzing the case written according to the test case protocol to obtain the root node of the node tree in the case and all child nodes of each level below the root node, and further comprising the steps of:
s301, decompressing a case written according to a test case protocol to obtain an extensible markup language file, wherein the case is marked by using an identifier in the extensible markup language file, so that the case can be executed by different processors, and the method provided by the embodiment of the invention can be suitable for different processors, terminals or devices.
S302, analyzing the extensible markup language file to obtain a root node of a node tree in a case and all child nodes of each level under the root node.
After the root node and each level child node are acquired, the method further comprises:
s102, traversing all child nodes of the node tree to obtain leaf nodes, wherein the leaf nodes do not have child nodes of the next level. As shown in fig. 2, the root node is the uppermost node 1 in the graph, the root node includes a plurality of sub-nodes 11, 12, … …, 1n of a first level, each sub-node of the first level may further include a plurality of sub-nodes, in the graph, the lowest level of sub-nodes n1, n2, … …, nn belong to the last level of the node tree, and the sub-nodes of the level are called leaf nodes up to this point.
S103, forming a plurality of complete links from the root node, the child nodes of each level between the root node and the leaf nodes according to the level sequence.
The test case protocol in the embodiment of the invention specifically provides that the root node is used for storing a case theme, the child nodes of each level between the root node and the leaf nodes are respectively used for storing case step information and case result information, and each leaf node is used for storing method call relation information of a complete link. Fig. 3 is a schematic diagram of another node tree according to an embodiment of the present invention, where a case of a test login procedure is taken as an example. In fig. 3, the root node stores a case theme named "login test", and two child nodes of the first level store a login step using "user name and password" and a login step using "mobile phone number and password", respectively; the second level is provided with two sub-nodes corresponding to the two sub-nodes of the first level respectively, and the execution results corresponding to the steps in the two sub-nodes of the first level are stored, wherein the execution results corresponding to the login steps by adopting a user name and a password are successful login, and the execution results corresponding to the login steps by adopting a mobile phone number and a password are failed login; the last hierarchy has two leaf nodes, one stores all call relations in the whole step of login success by using a user name and a password, and the other stores all call relations in the whole step of login failure by using a mobile phone number and a password.
Then extracting a 'login test' root node, a 'user name and password' child node, a 'login success' child node and a next-stage 'calling relation' leaf node to form a complete link, and extracting a 'login test' root node, a 'mobile phone number and password' child node, a 'login failure' child node and a next-stage 'calling relation' leaf node to form another complete link, wherein the two links can be respectively expressed as:
link 1: "login test" → "username and password" → "login success" → "call relationship";
link 2: "login test" → "cell phone number and password" → "login failure" → "call relationship".
The method call relationship refers to a code call path corresponding to a step in the link, and the call path generally starts from an interface, for example, an interface URL-WF-SCF-is stored, and refers to a URL interface call WF (workflow) and SCF (Serverless Cloud Function, no server cloud function) to access a storage space of a database. The method call relationship may provide important parameters for the generation of a subsequent regression use case set based on the code path call analysis.
And S104, sequentially storing each complete link into a database.
The links 1 and 2 are stored in the database instead of directly storing the whole node tree, so that when a designer needs to reuse a case, the links can be directly extracted from the database, the logical relationship of the node information is stored in the links, the designer does not need to comb again, a lot of time can be saved, and the testing efficiency is improved.
In the embodiment of the present invention, after each complete link is sequentially stored in the database, the method further includes:
and generating a case name for each complete link respectively, wherein the case names among the complete links are different. As described above, both link 1 and link 2 are complete links stored in the database, which all belong to the same test function, but in order to distinguish different links of the same test function, the case name of link 1 may be named "login test 1", and the case name of link 2 may be named "login test 2".
In addition, for different links belonging to a case, when the links are stored in a database, the links may be stored together in a folder, as shown in fig. 4, which is a schematic diagram of case storage in the database provided in the embodiment of the present invention, where a plurality of different files are stored in the database, each file corresponds to a case of a test function, for example, a "login test" file corresponds to a case of a test login function, and two links related to the case are specifically stored in the file, and are respectively "login test 1" and "login test 2", so that a specific link may be directly called from a corresponding file of the database according to specific content of the test in subsequent call. For different links belonging to a case, when the links are stored in a database, the links can also be directly stored in the database in a link form, as shown in fig. 5, which is a schematic diagram of case storage in another database provided by the embodiment of the invention, links named by different case names are directly stored in the database, and when the links are subsequently called, a certain link can be directly called from the database by the case names according to the specific content of the test.
In the embodiment of the invention, the link stored in the database is reusable, and if a designer needs to modify a certain link or generate a link similar to or similar to the existing link, the link can be directly called from the database to be modified without writing a new case, and the method comprises the following specific steps:
s401, acquiring a complete link to be modified corresponding to the case name to be modified from a database. The complete link to be modified comprises a plurality of nodes, each node stores corresponding information, and if a designer needs to modify certain information, the designer needs to determine which test function the information belongs to, and call a specific link according to the test function.
S402, positioning nodes to be modified in the complete link to be modified according to the content to be modified. The content to be modified comprises a modification theme, modification step information, modification result information and/or modification method call relation information, and the node to be modified comprises a root node and all child nodes of each level under the root node.
Each link comprises a root node in a case node tree and child nodes of each level, wherein a first node in the link is the root node, a case theme is stored in the root node, and step information of the case, result information of the case and method call relation information of the case are respectively stored in the later nodes. Taking the link 1 as an example, if a designer needs to modify the step information in the link 1, calling out the corresponding link, and then finding out a second node in the link; if the designer needs to modify the resulting information in link 1, then a third node in the link is found. The second node and the third node are respectively used as nodes to be modified.
S403, changing case information of the node to be modified. Corresponding information is stored in the nodes to be modified, and after the nodes to be modified are found, the corresponding information can be directly modified. In the embodiment of the invention, for the new link with the case information modified, a designer can name the new link or still use old names according to the needs.
According to the test case storage method provided by the invention, when a case is written, according to a preset test case protocol, each node in the obtained case node tree stores different case information; then obtaining all nodes of a node tree in a case, judging whether other child nodes except the root node are leaf nodes, when other child nodes are leaf nodes, forming a complete link from the root node to all nodes on the path from the leaf node, storing a result corresponding to a certain step of the case and executing all method calling relations of the step on the complete link, and extracting the complete links on other leaf nodes according to the method; and finally, storing all the complete links into a database so as to reuse or modify each link. Therefore, according to the scheme provided by the invention, when the case is compiled and written, a plurality of complete links related to the case are extracted and stored in the database according to the established test case protocol, so that the case is prevented from being repeatedly used, the execution path of the case is re-analyzed and combed, the time is saved, and the case repeated use efficiency is improved.
FIG. 6 is a block diagram of a test case storage device according to an embodiment of the present invention. As shown in fig. 6, the test case storage device provided by the embodiment of the present invention includes: the parsing module 61 is configured to parse a case written according to a test case protocol, so as to obtain a root node of a node tree in the case and all child nodes of each level under the root node, where the test case protocol is used for specifying case information stored in each node in the node tree of the written case; a traversing module 62, configured to traverse all child nodes of the node tree to obtain leaf nodes, where the leaf nodes do not have child nodes of a next level; the link generation module 63 is configured to form a plurality of complete links from a root node, child nodes of each level between the root node and the leaf node, and the leaf node according to a hierarchical order, where the root node is used to store a case theme, the child nodes of each level between the root node and the leaf node are respectively used to store case step information and case result information, and each leaf node is used to store method call relation information of one complete link; the link saving module 64 is configured to save each complete link in turn into the database.
Optionally, the parsing module includes: the judging unit is used for judging whether the file names of the cases exist in the database or not, wherein the file names correspond to the cases with different test functions; and if the file name of the case does not exist in the database, analyzing the case.
Optionally, the judging module is further configured to: if the file name of the case exists in the database, judging whether the version number of the case is updated or not, wherein the version number is used for identifying different versions of the case with the same test function; if the version number has been updated, the case is parsed.
Optionally, the parsing module further includes: the decompression unit is used for decompressing the case written according to the test case protocol to obtain an extensible markup language file, and the extensible markup language file is marked with the case by using the mark so that the case can be executed by different processors; and the child node acquisition unit is used for analyzing the extensible markup language file to obtain a root node of the node tree in the case and all child nodes of each level under the root node.
Optionally, the apparatus further includes: the name distribution module is used for generating a case name for each complete link respectively, and the case names among the complete links are different from each other.
Optionally, the apparatus further includes: the link acquisition module is used for acquiring a complete link to be modified corresponding to the case name to be modified from the database; the node positioning module is used for positioning nodes to be modified in the complete link to be modified according to the content to be modified, wherein the content to be modified comprises a modification theme, modification step information, modification result information and/or modification method call relation information, and the nodes to be modified comprise a root node and all child nodes of each level below the root node; and the information modification module is used for modifying the case information of the node to be modified.
Fig. 7 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. X, an electronic device provided by an embodiment of the present invention includes: a memory 71 for storing program instructions; and a processor 72 for calling and executing program instructions in the memory to implement the test case storage method described in the above embodiment.
In this embodiment, the processor and the memory may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
The embodiment of the invention also provides a storage medium, wherein the storage medium stores a computer program, and when at least one processor of the test case storage device executes the computer program, the test case storage device executes the test case storage method described in the embodiment.
The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (random access memory, RAM), or the like.
It will be apparent to those skilled in the art that the techniques of embodiments of the present invention may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present invention.
The same or similar parts between the various embodiments in this specification are referred to each other. In particular, for the service building apparatus and the service loading apparatus embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description in the method embodiments for the matters.
The embodiments of the present invention described above do not limit the scope of the present invention.

Claims (14)

1. A method for storing test cases, comprising:
analyzing a case written according to a test case protocol to obtain a root node of a node tree in the case and all child nodes of each level under the root node, wherein the test case protocol is used for prescribing case information stored in each node in the node tree of the written case;
traversing all child nodes of the node tree to obtain leaf nodes, wherein the leaf nodes do not have child nodes of the next level;
forming a plurality of complete links from root nodes, child nodes of each level between the root nodes and the leaf nodes according to a level sequence, wherein the root nodes are used for storing case subjects, the child nodes of each level between the root nodes and the leaf nodes are respectively used for storing case step information and case result information, each leaf node is used for storing method call relation information of one complete link, the method call relation refers to a code call path corresponding to steps in the links, the call path starts from an interface and comprises interface URL-WF-SCF-storage, and the interface URL-WF-SCF-storage refers to a URL interface call WF (workflow) and SCF (Serverless Cloud Function, no server cloud function) access to a storage space of a database;
each complete link is saved in turn to the database.
2. The method of claim 1, wherein the step of parsing the case written according to the test case protocol to obtain a root node of the node tree in the case and all child nodes of each level below the root node, comprises:
judging whether file names of the cases exist in a database or not, wherein the file names correspond to the cases with different test functions;
and if the file name of the case does not exist in the database, analyzing the case.
3. The method of claim 2, wherein the step of parsing a case written according to the test case protocol to obtain a root node of a node tree in the case and all child nodes of each level below the root node, further comprises:
if the file name of the case exists in the database, judging whether the version number of the case is updated or not, wherein the version number is used for identifying different versions of the case with the same test function;
if the version number has been updated, the case is parsed.
4. The method of claim 1, wherein the step of parsing a case written according to a test case protocol to obtain a root node of a node tree in the case and all child nodes of each level below the root node, further comprises:
decompressing a case written according to a test case protocol to obtain an extensible markup language file, wherein the case is marked in the extensible markup language file by using an identification, so that the case can be executed by different processors;
and analyzing the extensible markup language file to obtain a root node of the node tree in the case and all child nodes of each level under the root node.
5. The method of claim 1, wherein after each complete link is saved to the database in turn, comprising:
and generating a case name for each complete link respectively, wherein the case names among the complete links are different.
6. The method of claim 5, wherein after each complete link is saved to the database in turn, further comprising:
acquiring a complete link to be modified corresponding to a case name to be modified from a database;
positioning nodes to be modified in a complete link to be modified according to content to be modified, wherein the content to be modified comprises a modification theme, modification step information, modification result information and/or modification method call relation information, and the nodes to be modified comprise a root node and all child nodes of each level under the root node;
and changing the case information of the node to be modified.
7. A test case storage device, comprising:
the analysis module is used for analyzing the case written according to the test case protocol to obtain a root node of the node tree in the case and all child nodes of each level under the root node, wherein the test case protocol is used for prescribing case information stored in each node of the node tree of the written case;
the traversing module is used for traversing all the child nodes of the node tree to obtain leaf nodes, and the leaf nodes do not have child nodes of the next level;
the system comprises a link generation module, a link generation module and a database, wherein the link generation module is used for forming a plurality of complete links from root nodes, sub-nodes of each level between the root nodes and the leaf nodes according to a level sequence, the root nodes are used for storing case topics, the sub-nodes of each level between the root nodes and the leaf nodes are respectively used for storing case step information and case result information, each leaf node is used for storing method call relation information of one complete link, the method call relation refers to a code call path corresponding to a step in the link, the call path starts from an interface and comprises interface URL-WF-SCF-storage, and the interface URL-WF-SCF-storage refers to a URL interface call WF (workflow) and SCF (Serverless Cloud Function, no server cloud function) to access the storage space of the database;
and the link saving module is used for saving each complete link in the database in sequence.
8. The apparatus of claim 7, wherein the parsing module comprises:
the judging unit is used for judging whether the file names of the cases exist in the database or not, wherein the file names correspond to the cases with different test functions; and if the file name of the case does not exist in the database, analyzing the case.
9. The apparatus of claim 8, wherein the determination unit is further configured to: if the file name of the case exists in the database, judging whether the version number of the case is updated or not, wherein the version number is used for identifying different versions of the case with the same test function; if the version number has been updated, the case is parsed.
10. The apparatus of claim 7, wherein the parsing module further comprises:
the decompression unit is used for decompressing the case written according to the test case protocol to obtain an extensible markup language file, and the extensible markup language file is marked with the case by using the mark so that the case can be executed by different processors;
and the child node acquisition unit is used for analyzing the extensible markup language file to obtain a root node of the node tree in the case and all child nodes of each level under the root node.
11. The apparatus of claim 7, wherein the apparatus further comprises:
the name distribution module is used for generating a case name for each complete link respectively, and the case names among the complete links are different from each other.
12. The apparatus of claim 11, wherein the apparatus further comprises:
the link acquisition module is used for acquiring a complete link to be modified corresponding to the case name to be modified from the database;
the node positioning module is used for positioning nodes to be modified in the complete link to be modified according to the content to be modified, wherein the content to be modified comprises a modification theme, modification step information, modification result information and/or modification method call relation information, and the nodes to be modified comprise a root node and all child nodes of each level below the root node;
and the information modification module is used for modifying the case information of the node to be modified.
13. An electronic device, comprising:
a memory for storing program instructions;
a processor for invoking and executing program instructions in said memory to implement the test case storage method of any of claims 1-6.
14. A storage medium having a computer program stored therein, the test case storage device performing the test case storage method of any one of claims 1-6 when executed by at least one processor of the test case storage device.
CN201910843362.XA 2019-09-06 2019-09-06 Test case storage method and device, electronic equipment and storage medium Active CN110543427B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910843362.XA CN110543427B (en) 2019-09-06 2019-09-06 Test case storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910843362.XA CN110543427B (en) 2019-09-06 2019-09-06 Test case storage method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110543427A CN110543427A (en) 2019-12-06
CN110543427B true CN110543427B (en) 2023-07-21

Family

ID=68713050

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910843362.XA Active CN110543427B (en) 2019-09-06 2019-09-06 Test case storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110543427B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111460747B (en) * 2020-04-10 2023-03-31 重庆百瑞互联电子技术有限公司 Standard unit tracking method for integrated circuit design
CN111930624B (en) * 2020-08-12 2024-04-05 中国工商银行股份有限公司 Test link message data processing method and device
CN112559318A (en) * 2020-11-02 2021-03-26 浙江诺诺网络科技有限公司 Test case generation method and device, electronic equipment and storage medium
CN112346986B (en) * 2020-11-25 2022-10-21 武汉光庭信息技术股份有限公司 Test case layered storage method and system, electronic device and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106844201A (en) * 2016-12-30 2017-06-13 北京五八信息技术有限公司 Test environment dispositions method and system
CN107741911A (en) * 2017-11-01 2018-02-27 广州爱九游信息技术有限公司 Interface test method, device, client and computer-readable recording medium

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2001227857A1 (en) * 2000-01-14 2001-07-24 Saba Software, Inc. Method and apparatus for a business applications management system platform
CN101582048A (en) * 2008-05-16 2009-11-18 国际商业机器公司 Method and system for defect management
CN101630285A (en) * 2009-08-07 2010-01-20 华南理工大学 Software performance testing method applied in embedded system
US10223246B2 (en) * 2012-07-30 2019-03-05 Infosys Limited System and method for functional test case generation of end-to-end business process models
CN106547520B (en) * 2015-09-16 2021-05-28 腾讯科技(深圳)有限公司 Code path analysis method and device
CN105389262B (en) * 2015-12-23 2019-02-15 北京奇虎科技有限公司 A kind of method and apparatus generating Test Suggestion for interface detection
CN105893254A (en) * 2016-03-29 2016-08-24 乐视控股(北京)有限公司 Test case input method and device
CN106227573A (en) * 2016-07-11 2016-12-14 北京信息科技大学 Function call path extraction method based on controlling stream graph
CN106649100B (en) * 2016-11-16 2020-08-25 福建天晴数码有限公司 Automatic testing method and system
CN107256148A (en) * 2017-05-24 2017-10-17 龙芯中科技术有限公司 The generation method and system at interface, electronic equipment and storage medium
CN108415831A (en) * 2018-02-05 2018-08-17 五八有限公司 Method for generating test case and device, electronic equipment and readable storage medium storing program for executing
CN108595338A (en) * 2018-05-08 2018-09-28 平安普惠企业管理有限公司 Test case write method, device, computer equipment and storage medium
CN108845942B (en) * 2018-06-20 2024-03-12 上海幻电信息科技有限公司 Product feature management method, device, system and storage medium
CN109086204B (en) * 2018-07-20 2022-03-11 北京小米移动软件有限公司 Node relation tree establishing method, page marking method, page identifying method, page marking device, page identifying device and storage medium
CN109656813A (en) * 2018-11-21 2019-04-19 恒为科技(上海)股份有限公司 A kind of test case operation method and device
CN109740122B (en) * 2018-12-11 2023-08-29 中国联合网络通信集团有限公司 Method and device for converting thinking guide graph use case file

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106844201A (en) * 2016-12-30 2017-06-13 北京五八信息技术有限公司 Test environment dispositions method and system
CN107741911A (en) * 2017-11-01 2018-02-27 广州爱九游信息技术有限公司 Interface test method, device, client and computer-readable recording medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Web系统测试用例自动执行系统;贾丽;许静;金鑫;田禾;;计算机工程与应用(第04期);全文 *
软件内建自测试中的模板库及测试路径分析;李文锋,徐拾义;计算机工程(第14期);全文 *

Also Published As

Publication number Publication date
CN110543427A (en) 2019-12-06

Similar Documents

Publication Publication Date Title
CN110543427B (en) Test case storage method and device, electronic equipment and storage medium
CN106156186B (en) Data model management device, server and data processing method
US8869111B2 (en) Method and system for generating test cases for a software application
CN112394942B (en) Distributed software development compiling method and software development platform based on cloud computing
CN108829584B (en) Service logic interface mock test method and system
CN111158741B (en) Method and device for monitoring dependency relationship change of service module on third party class library
CN111061643A (en) SDK cluster compatibility detection method and device, electronic equipment and storage medium
CN107797823B (en) Business rule management method and device, storage medium and computer equipment
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN104320312A (en) Network application safety test tool and fuzz test case generation method and system
CN111324540B (en) Interface testing method and device
CN112667287A (en) Method, device and equipment for creating rule file and computer readable storage medium
CN113568604B (en) Method and device for updating wind control strategy and computer readable storage medium
CN114201397A (en) Interface test modeling method and device, electronic equipment and storage medium
CN115525534A (en) Test case generation method and platform based on swagger interface test
CN113254350A (en) Flink operation testing method, device, equipment and storage medium
CN112346981A (en) Joint debugging test coverage rate detection method and system
CN114579203B (en) Script file checking method and device, electronic equipment and storage medium
CN113821486B (en) Method and device for determining dependency relationship between pod libraries and electronic equipment
CN115951916A (en) Component processing method and device, electronic equipment and storage medium
CN116185391A (en) Application programming interface generation method, device, equipment and storage medium
CN112463596B (en) Test case data processing method, device and equipment and processing equipment
CN114661298A (en) Automatic public method generation method, system, device and medium
CN114143235A (en) NFV automatic test method, device, equipment and storage medium
CN113377674B (en) Log code adding method and device

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