CN113377653B - Method and device for generating test cases - Google Patents

Method and device for generating test cases Download PDF

Info

Publication number
CN113377653B
CN113377653B CN202110648223.9A CN202110648223A CN113377653B CN 113377653 B CN113377653 B CN 113377653B CN 202110648223 A CN202110648223 A CN 202110648223A CN 113377653 B CN113377653 B CN 113377653B
Authority
CN
China
Prior art keywords
field
tested
document
text
flow
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
CN202110648223.9A
Other languages
Chinese (zh)
Other versions
CN113377653A (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.)
Beijing Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information 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 Beijing Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202110648223.9A priority Critical patent/CN113377653B/en
Publication of CN113377653A publication Critical patent/CN113377653A/en
Application granted granted Critical
Publication of CN113377653B publication Critical patent/CN113377653B/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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Abstract

The invention discloses a method and a device for generating test cases, and relates to the technical field of computers. One embodiment of the method comprises the following steps: the method comprises the steps of performing recognition processing on a document to be tested through a deep learning network to obtain a text and a judgment symbol included in the document to be tested; matching texts and judgments included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes; extracting field values corresponding to each field from the flow node information according to the fields included in the test case template; the field values are logically processed using a test case writing method to generate test cases. The embodiment can help testers to improve work efficiency and time utilization rate, problems can be found in advance, and the generated test cases are convenient to manage and review.

Description

Method and device for generating test cases
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for generating test cases.
Background
At present, in the process of product testing, in the design stage of test cases, test cases are written and output by hands by testers according to product demand documents and flow charts in the documents. However, by manually writing test cases, the efficiency of manual writing is low, time and labor are consumed, and the written test case documents are scattered and inconvenient to manage and review in a limited time.
Disclosure of Invention
In view of the above, the embodiment of the invention provides a method and a device for generating test cases, which can solve the problem of waste of manpower and time cost caused by manually writing scene test cases after a tester obtains a product demand flow chart, can help the tester to improve the working efficiency and the time utilization rate, discover the problems in advance, and the generated test cases are convenient to manage and review.
To achieve the above object, according to one aspect of the embodiments of the present invention, a method of generating test cases is provided.
A method of generating test cases, comprising:
the method comprises the steps of carrying out recognition processing on a document to be tested through a deep learning network to obtain a text and a judgment symbol included in the document to be tested;
Matching the text and the judgment symbol included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes;
extracting field values corresponding to each field from the flow node information according to the fields included in the test case template;
and logically processing the field values by using a test case writing method to generate a test case.
Optionally, performing recognition processing on the document to be tested through the deep learning network to obtain the text and the judgment symbol included in the document to be tested includes:
performing text-text detection on a document to be tested through a first deep learning network to detect a text box in the document to be tested;
performing text matching and extraction according to the text box;
and inputting the extracted text into a second deep learning network for universal character recognition so as to obtain the text and the judgment symbol included in the document to be tested.
Optionally, before the field values are logically processed by using the test case writing method to generate the test case, the method further includes:
Expanding a field value corresponding to a field extracted from the flow node information into a corresponding value range according to the value range corresponding to a preset field;
and logically processing the field values using a test case writing method to generate a test case includes:
and according to the value range corresponding to the field, respectively carrying out logic processing on each field value in the value range by using a test case writing method to generate a plurality of test cases.
Optionally, the document to be tested comprises a flow chart, the element attributes of the flow nodes are obtained according to the type of flow chart component used by the flow nodes, wherein,
if the flow chart component is a rectangular component, the element attribute of the flow node is a process element;
if the flow chart component is a diamond component, the element attribute of the flow node is a judging element;
if the flow chart component is an elliptic component, the element attribute of the flow node is a starting or ending element;
if the flow chart component is an arrow component, the element attribute of the flow node is a flow direction element.
Optionally, the fields included in the test case template include: a module field, a scenario field, a step description field, and an expected result field;
And extracting field values corresponding to each field from the flow node information according to the fields included in the test case template includes:
the module field is used for directly extracting the field value of the module field from the flow node information;
for a scene field, extracting text information from process elements of the flow node information as a field value of the scene field;
extracting text information from judgment elements of the flow node information as field values of the step description field for the step description field;
and extracting text information from the judging elements of the flow node information for the expected result field, and generating a field value of the expected result field according to the judging words of the flow direction elements corresponding to the judging elements.
According to another aspect of the embodiment of the invention, a device for generating test cases is provided.
An apparatus for generating test cases, comprising:
the recognition processing module is used for carrying out recognition processing on the document to be tested through the deep learning network to obtain a text and a judgment symbol included in the document to be tested;
the matching processing module is used for matching the text and the judgment symbol included in the document to be tested with the document to be tested to obtain the flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes;
The field value extraction module is used for extracting field values corresponding to each field from the flow node information according to the fields included in the test case template;
and the logic processing module is used for logically processing the field values by using a test case writing method to generate test cases.
Optionally, the identification processing module is further configured to:
performing text-text detection on a document to be tested through a first deep learning network to detect a text box in the document to be tested;
performing text matching and extraction according to the text box;
and inputting the extracted text into a second deep learning network for universal character recognition so as to obtain the text and the judgment symbol included in the document to be tested.
Optionally, the apparatus further includes a field value extension module configured to:
before the field values are logically processed by using a test case writing method to generate test cases, expanding the field values corresponding to the fields extracted from the flow node information into corresponding value ranges according to the value ranges corresponding to the preset fields;
and, the logic processing module is further configured to:
and according to the value range corresponding to the field, respectively carrying out logic processing on each field value in the value range by using a test case writing method to generate a plurality of test cases.
Optionally, the document to be tested comprises a flow chart, the element attributes of the flow nodes are obtained according to the type of flow chart component used by the flow nodes, wherein,
if the flow chart component is a rectangular component, the element attribute of the flow node is a process element;
if the flow chart component is a diamond component, the element attribute of the flow node is a judging element;
if the flow chart component is an elliptic component, the element attribute of the flow node is a starting or ending element;
if the flow chart component is an arrow component, the element attribute of the flow node is a flow direction element.
Optionally, the fields included in the test case template include: a module field, a scenario field, a step description field, and an expected result field;
and, the field value extraction module is further configured to:
the module field is used for directly extracting the field value of the module field from the flow node information;
for a scene field, extracting text information from process elements of the flow node information as a field value of the scene field;
extracting text information from judgment elements of the flow node information as field values of the step description field for the step description field;
And extracting text information from the judging elements of the flow node information for the expected result field, and generating a field value of the expected result field according to the judging words of the flow direction elements corresponding to the judging elements.
According to yet another aspect of the embodiment of the present invention, an electronic device for generating test cases is provided.
An electronic device that generates test cases, comprising: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the method for generating the test case provided by the embodiment of the invention.
According to yet another aspect of an embodiment of the present invention, a computer-readable medium is provided.
A computer readable medium having stored thereon a computer program which when executed by a processor implements a method of generating test cases provided by an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of performing recognition processing on a document to be tested through a deep learning network to obtain a text and a judgment symbol included in the document to be tested; matching texts and judgments included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes; extracting field values corresponding to each field from the flow node information according to the fields included in the test case template; the field values are logically processed by using the test case writing method to generate the test cases, the identification and matching processing of the documents to be tested are realized through the deep learning technology, the test cases are automatically generated based on the test case templates, the problem of manpower and time cost waste caused by manually writing the scene test cases after obtaining the product demand flow chart and waiting for the test documents by a tester is solved, the interface test cases can be quickly obtained, the AI intelligent test is used for replacing part of labor cost, meanwhile, the improvement of the working efficiency and the time utilization rate of the tester can be also facilitated, the problem is found in advance, and the generated test cases are convenient to manage and review.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a method of generating test cases according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a generation scenario case according to one embodiment of the present invention;
FIG. 3 is a demand flow diagram illustration of one embodiment of the present invention;
FIG. 4 is a schematic diagram of main modules of an apparatus for generating test cases according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 6 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In order to solve the technical problems in the prior art, the invention provides a method and a device for generating test cases, which can automatically generate the test cases based on a deep learning technology, solve the problem of waste of labor and time cost caused by manually writing scene test cases after obtaining a product demand flow chart and waiting for a test document, can quickly obtain interface test cases, replace part of labor cost by AI intelligent test, and can also help testers to improve the working efficiency and the time utilization rate and discover the problems in advance.
FIG. 1 is a schematic diagram of the main steps of a method of generating test cases according to an embodiment of the present invention. As shown in fig. 1, the method for generating a test case according to the embodiment of the present invention mainly includes the following steps S101 to S104.
Step S101: and carrying out recognition processing on the document to be tested through the deep learning network to obtain a text and a judgment symbol included in the document to be tested.
According to an embodiment of the present invention, when the document to be tested is identified through the deep learning network to obtain the text and the judger included in the document to be tested, step S101 may be specifically performed according to the following steps:
Performing text-text detection on the document to be tested through a first deep learning network to detect a text box in the document to be tested;
performing text matching and extraction according to the text box;
and inputting the extracted text into a second deep learning network for universal character recognition so as to obtain the text and the judgment symbol included in the document to be tested.
According to the embodiment of the invention, the first deep learning network is, for example, a CTPN network, which is a text detection model based on a target detection method, is improved on the Faster RCNN, and is combined with the bidirectional LSTM, so that the CTPN has a very good effect on horizontally arranged text detection. Another highlight of CTPN is the conversion of text detection tasks into a series of small-scale text boxes detection, into finer-grained tasks, which can result in more accurate text boxes. The document to be tested is imported into a first deep learning network CTPN for universal text-to-text detection, so that text boxes in the document to be tested can be detected more accurately.
After the text box is detected, text matching and text extraction are carried out on the text in the document to be tested according to the text box, so that text content included in the text box can be obtained more accurately.
And then, inputting the extracted text into a second deep learning network for universal character recognition. The second deep learning network is, for example, an RCNN network, and is a target detection algorithm for images, and the general word recognition is performed through the RCNN network, so that the word recognition can be performed more accurately. The text, the judgment symbol and the like included in the document to be tested can be more accurately obtained by processing the document to be tested through the second deep learning network, wherein the judgment symbol refers to special characters such as ">", "<", "=", and the like which are commonly appeared in the flow chart.
Step S102: matching texts and judgments included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes.
After obtaining the text and the judgment symbol included in the document to be tested, step S102 may be executed to match the text and the judgment symbol included in the document to be tested with the document to be tested, so as to obtain the flow node information of the document to be tested, where the flow node information includes element attributes and text information of each flow node, and logic sequences and judgment words between the flow nodes. In the embodiment of the invention, the document to be tested comprises a flow chart, and specifically, the text and the judgment symbol included in the document to be tested can be matched with the document to be tested by a regular matching method. According to the document to be tested, the logic relationship among the nodes of the flow chart can be obtained, and the text and the judgment symbol obtained in the step S101 can be matched with the flow chart in the document to be tested by establishing a regular matching expression so as to obtain the information of the flow chart included in the flow chart in the document to be tested, specifically, the flow chart node information comprises the element attribute and the text information of the flow chart nodes, and the logic sequence and the judgment word among the flow chart nodes.
FIG. 3 is a schematic diagram of a demand flow diagram of one embodiment of the present invention. In the embodiment of the invention, the requirement flow chart is included in the document to be tested. As in fig. 3, a partial demand flow diagram is shown. In the demand flow chart, each flow chart component represents a flow chart node, and the element attribute of the flow chart node can be obtained according to the type of the flow chart component used by the flow chart node, wherein if the flow chart component is a rectangular component, the element attribute of the flow chart node is a process element; if the flow chart component is a diamond component, the element attribute of the flow node is a judging element; if the flow chart component is an elliptic component, the element attribute of the flow node is a starting or ending element; if the flow chart component is an arrow component, the element attribute of the flow node is a flow direction element. Specifically, the element attributes corresponding to other flow chart components can be set according to the actual application requirements.
In each flow node, not only its element attribute is included, but also its literal information, i.e. the literal information in the flow diagram component used by each flow node. For example: the diamond-shaped element in fig. 3, the element attribute of the flow node is a judgment element, and the text information is "whether standard single charging succeeds". Logic sequences among the flow nodes can be obtained according to the directions of the arrow components among the flow nodes; and obtaining judgment words among the flow nodes according to the text on the arrow component. For example: the diamond component may execute a flow node whose text content is "charging failure" or a flow node whose text content is "charging success", and according to the text "Y" or "N" on the arrow component, a judgment word corresponding to executing different flow nodes may be obtained.
In addition, in the actual operation process, a complex product may be divided into a plurality of templates for development, and accordingly, the demand flow chart of the product may include a plurality of sub-demand flow charts, and each sub-demand flow chart corresponds to a module for development, so when the flow node information of the demand flow chart is extracted, the extraction module information may also be included.
Step S103: and extracting field values corresponding to the fields from the flow node information according to the fields included in the test case template.
In order to automatically generate the test case, the invention presets a test case template, which is used for extracting and storing useful information in a document to be tested into the test case template, and generating the test case according to the test case template.
According to an embodiment of the present invention, the document to be tested includes a flowchart, and the fields included in the test case template may include, for example: a module field, a scenario field, a step description field, and an expected result field;
and extracting field values corresponding to each field from the flow node information according to the fields included in the test case template includes:
the module field is used for directly extracting the field value of the module field from the flow node information;
For a scene field, extracting text information from process elements of the flow node information as a field value of the scene field;
extracting text information from judgment elements of the flow node information as field values of the step description field for the step description field;
and extracting text information from the judging elements of the flow node information for the expected result field, and generating a field value of the expected result field according to the judging words of the flow direction elements corresponding to the judging elements.
In the embodiment shown in fig. 3, the corresponding flow node information can be obtained after the recognition processing and the matching processing are performed on the demand flow chart of the logistics charging module through the deep learning network and the regular matching. According to the fields included in the test case template, extracting 'logistics charging' from the flow node information as a field value of a module field, and filling the field value into the test case template shown in the following table 1. The number of the test cases can be automatically generated according to the number of the data lines.
Then, according to the element attributes and text of the flow node in the demand flow chart, such as the rectangular component represents the process element, the diamond component represents the judging element, the arrow component represents the flow direction element, and the arrow characters of yes, no, N, Y, success, failure, and the like, the field values of the scene field, the step description field and the expected result field can be extracted from the flow node information. Specifically, for a scene field, extracting text information from process elements of the flow node information as a field value of the scene field; for the step description field, extracting text information from judging elements of the flow node information as a field value of the step description field; and extracting text information from the judging elements of the flow node information for the expected result field, and generating a field value of the expected result field by the judging words of the flow elements corresponding to the judging elements. Specifically, after the field value is generated, sentence complementation and the like may be performed according to the field value to obtain a complete use case template filling value, and the complete use case template filling value is filled in the following table 1.
TABLE 1
Step S104: the field values are logically processed using a test case writing method to generate test cases. According to the embodiment of the invention, the field values are logically processed and designed by using a common test case writing method, so that the test case can be generated, the test case writing method comprises equivalence class division, boundary values, orthogonal methods, error guessing methods and the like, and the field values corresponding to different fields in the test case template are logically processed and combined by using the test case writing method, so that the step description and formatting of the test case can be obtained, and the expected result is generated. In the logic processing, sentence complementation can be performed according to the field value to obtain clearer step description content and expected result.
According to one embodiment of the present invention, before the field values are logically processed by using the test case writing method to generate the test case, the method may further include:
expanding a field value corresponding to a field extracted from the flow node information into a corresponding value range according to the value range corresponding to a preset field;
and logically processing the field values using a test case writing method to generate a test case includes:
And according to the value range corresponding to the field, respectively carrying out logic processing on each field value in the value range by using a test case writing method to generate a plurality of test cases.
For example: assuming that the value range corresponding to a certain field is 1-100 (the field value is limited to a positive integer), and the field value corresponding to the field extracted from the flow node information is 50, the value range corresponding to the field value extension bit corresponding to the field can be 1-100. Then, when the test cases are generated, the logic processing is performed on each field value in the value range, so that 100 test cases can be generated.
Finally, the generated test cases are in butt joint with the case library, fields in each piece of data formed by combination automatically identify case template fields, corresponding information is stored under the fields corresponding to each row of the template, and finally, normal scenes, abnormal scenes and the like of the test cases are formed.
According to the steps S101 to S104, the document to be tested can be subjected to identification and matching treatment through the deep learning technology, and the test case is automatically generated based on the test case template, so that the problems of waste of manpower and time cost and low efficiency caused by manually writing the test case by a tester are solved.
FIG. 2 is a flow diagram of a generation scenario case according to one embodiment of the present invention. In this embodiment, description will be given taking an example of a scenario case generated according to a demand flowchart in a document to be tested. As shown in fig. 2, the flow of generating a scenario case according to the embodiment of the present invention mainly includes:
1. importing the required flow chart into a deep learning network to detect general characters and pictures and texts;
2. matching and extracting the graphics and texts and the effective information in the demand flow chart;
3. inputting the flow chart into a deep learning network to perform general character recognition;
4. combining the universal text detection and identification result to obtain flow node information;
5. performing logic combination processing according to a test case writing method;
6. the test case library receives tasks;
7. automatically filling a test case template;
8. and generating and storing a scene test case.
FIG. 4 is a schematic diagram of main modules of an apparatus for generating test cases according to an embodiment of the present invention. As shown in fig. 4, an apparatus 400 for generating test cases according to an embodiment of the present invention mainly includes an identification processing module 401, a matching processing module 402, a field value extraction module 403, and a logic processing module 404.
The recognition processing module 401 is configured to perform recognition processing on a document to be tested through a deep learning network to obtain a text and a judgment symbol included in the document to be tested;
The matching processing module 402 is configured to match text and a judging symbol included in the document to be tested with the document to be tested to obtain process node information of the document to be tested, where the process node information includes element attribute and text information of each process node, and a logic sequence and a judging word between the process nodes;
a field value extraction module 403, configured to extract, according to a field included in the test case template, a field value corresponding to each field from the flow node information;
and the logic processing module 404 is configured to logically process the field value by using a test case writing method to generate a test case.
According to one embodiment of the invention, the recognition processing module 401 may also be configured to:
performing text-text detection on a document to be tested through a first deep learning network to detect a text box in the document to be tested;
performing text matching and extraction according to the text box;
and inputting the extracted text into a second deep learning network for universal character recognition so as to obtain the text and the judgment symbol included in the document to be tested.
According to another embodiment of the present invention, the apparatus 400 for generating test cases further includes a field value extension module (not shown in the figure) for:
Before the field values are logically processed by using a test case writing method to generate test cases, expanding the field values corresponding to the fields extracted from the flow node information into corresponding value ranges according to the value ranges corresponding to the preset fields;
and, the logic processing module 404 may also be configured to:
and according to the value range corresponding to the field, respectively carrying out logic processing on each field value in the value range by using a test case writing method to generate a plurality of test cases.
According to yet another embodiment of the present invention, the document to be tested includes a flow chart, the element attributes of the flow nodes being obtained according to the type of flow chart component used by the flow nodes, wherein,
if the flow chart component is a rectangular component, the element attribute of the flow node is a process element;
if the flow chart component is a diamond component, the element attribute of the flow node is a judging element;
if the flow chart component is an elliptic component, the element attribute of the flow node is a starting or ending element;
if the flow chart component is an arrow component, the element attribute of the flow node is a flow direction element.
According to yet another embodiment of the present invention, the test case template includes fields including: a module field, a scenario field, a step description field, and an expected result field;
And, the field value extraction module 403 may be further configured to:
the module field is used for directly extracting the field value of the module field from the flow node information;
for a scene field, extracting text information from process elements of the flow node information as a field value of the scene field;
extracting text information from judgment elements of the flow node information as field values of the step description field for the step description field;
and extracting text information from the judging elements of the flow node information for the expected result field, and generating a field value of the expected result field according to the judging words of the flow direction elements corresponding to the judging elements.
According to the technical scheme of the embodiment of the invention, the document to be tested is identified through the deep learning network to obtain the text and the judgment symbol included in the document to be tested; matching texts and judgments included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes; extracting field values corresponding to each field from the flow node information according to the fields included in the test case template; the field values are logically processed by using the test case writing method to generate the test cases, the recognition and matching processing of the requirement flow chart is realized by a deep learning technology, the test cases are automatically generated based on the test case template, the problem of labor and time cost waste caused by manually writing the scene test cases after a tester obtains a document to be tested such as a product requirement flow chart is solved, the interface test cases can be quickly obtained, the AI intelligent test is used for replacing part of labor cost, meanwhile, the tester can be helped to improve the working efficiency and the time utilization rate, the problem is found in advance, and the generated test cases are convenient to manage and review.
FIG. 5 illustrates an exemplary system architecture 500 of a method of generating test cases or an apparatus for generating test cases to which embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various communication client applications, such as a test class application, a web browser application, a software test class application, a test case class editing tool, etc. (by way of example only) may be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (by way of example only) that provides support for test case generation requests sent by users using the terminal devices 501, 502, 503. The background management server can recognize the document to be tested through the deep learning network according to the received data such as the test case generation request and the like to obtain the text and the judgment symbol included in the document to be tested; matching the text and the judgment symbol included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes; extracting field values corresponding to each field from the flow node information according to the fields included in the test case template; the field values are logically processed by using a test case writing method to generate test cases, and processing results (such as the generated test cases-only examples) are fed back to the terminal device.
It should be noted that, the method for generating test cases provided in the embodiment of the present invention is generally executed by the server 505, and accordingly, the device for generating test cases is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing a terminal device or server in accordance with an embodiment of the present invention. The terminal device or server shown in fig. 6 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described units or modules may also be provided in a processor, for example, as: a processor includes an identification processing module, a matching processing module, a field value extraction module, and a logic processing module. The names of these units or modules do not constitute limitations on the unit or module itself in some cases, and for example, the recognition processing module may also be described as "a module for performing recognition processing on a document to be tested through a deep learning network to obtain text and a judgment symbol included in the document to be tested".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include: the method comprises the steps of carrying out recognition processing on a document to be tested through a deep learning network to obtain a text and a judgment symbol included in the document to be tested; matching the text and the judgment symbol included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes; extracting field values corresponding to each field from the flow node information according to the fields included in the test case template; and logically processing the field values by using a test case writing method to generate a test case.
According to the technical scheme of the embodiment of the invention, the document to be tested is identified through the deep learning network to obtain the text and the judgment symbol included in the document to be tested; matching texts and judgments included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes; extracting field values corresponding to each field from the flow node information according to the fields included in the test case template; the field values are logically processed by using the test case writing method to generate the test cases, the identification and matching processing of the documents to be tested are realized through the deep learning technology, the test cases are automatically generated based on the test case templates, the problem of manpower and time cost waste caused by manually writing the scene test cases after obtaining the product demand flow chart and waiting for the test documents by a tester is solved, the interface test cases can be quickly obtained, the AI intelligent test is used for replacing part of labor cost, meanwhile, the improvement of the working efficiency and the time utilization rate of the tester can be also facilitated, the problem is found in advance, and the generated test cases are convenient to manage and review.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. A method of generating test cases, comprising:
the method comprises the steps of carrying out recognition processing on a document to be tested through a deep learning network to obtain a text and a judgment symbol included in the document to be tested;
matching the text and the judgment symbol included in the document to be tested with the document to be tested to obtain flow node information of the document to be tested, wherein the flow node information comprises element attributes and text information of each flow node, and logic sequences and judgment words among the flow nodes;
extracting field values corresponding to each field from the flow node information according to the fields included in the test case template;
performing logic processing on the field values by using a test case writing method to generate test cases;
The document to be tested comprises a flow chart, and the element attribute of the flow chart node is obtained according to the type of a flow chart component used by the flow chart node, wherein if the flow chart component is a rectangular component, the element attribute of the flow chart node is a process element; if the flow chart component is a diamond component, the element attribute of the flow node is a judging element; if the flow chart component is an elliptic component, the element attribute of the flow node is a starting or ending element; if the flow chart component is an arrow component, the element attribute of the flow node is a flow direction element;
the test case template comprises the following fields: a module field, a scenario field, a step description field, and an expected result field; and extracting field values corresponding to each field from the flow node information according to the fields included in the test case template includes:
the module field is used for directly extracting the field value of the module field from the flow node information;
for a scene field, extracting text information from process elements of the flow node information as a field value of the scene field;
extracting text information from judgment elements of the flow node information as field values of the step description field for the step description field;
And extracting text information from the judging elements of the flow node information for the expected result field, and generating a field value of the expected result field according to the judging words of the flow direction elements corresponding to the judging elements.
2. The method according to claim 1, wherein the identifying the document to be tested through the deep learning network to obtain the text and the judger included in the document to be tested includes:
performing text-text detection on a document to be tested through a first deep learning network to detect a text box in the document to be tested;
performing text matching and extraction according to the text box;
and inputting the extracted text into a second deep learning network for universal character recognition so as to obtain the text and the judgment symbol included in the document to be tested.
3. The method of claim 1, wherein prior to logically processing the field values using a test case writing method to generate test cases, further comprising:
expanding a field value corresponding to a field extracted from the flow node information into a corresponding value range according to the value range corresponding to a preset field;
and logically processing the field values using a test case writing method to generate a test case includes:
And according to the value range corresponding to the field, respectively carrying out logic processing on each field value in the value range by using a test case writing method to generate a plurality of test cases.
4. An apparatus for generating test cases, comprising:
the recognition processing module is used for carrying out recognition processing on the document to be tested through the deep learning network to obtain a text and a judgment symbol included in the document to be tested;
the matching processing module is used for matching the text and the judgment symbol included in the document to be tested with the document to be tested to obtain the flow node information of the document to be tested, wherein the flow node information comprises element attribute and text information of each flow node, and logic sequence and judgment words among the flow nodes; the document to be tested comprises a flow chart, and the element attribute of the flow chart node is obtained according to the type of a flow chart component used by the flow chart node, wherein if the flow chart component is a rectangular component, the element attribute of the flow chart node is a process element; if the flow chart component is a diamond component, the element attribute of the flow node is a judging element; if the flow chart component is an elliptic component, the element attribute of the flow node is a starting or ending element; if the flow chart component is an arrow component, the element attribute of the flow node is a flow direction element;
The field value extraction module is used for extracting field values corresponding to each field from the flow node information according to the fields included in the test case template;
the logic processing module is used for logically processing the field values by using a test case writing method to generate test cases;
the test case template comprises the following fields: a module field, a scenario field, a step description field, and an expected result field; and, the field value extraction module is further configured to: the module field is used for directly extracting the field value of the module field from the flow node information; for a scene field, extracting text information from process elements of the flow node information as a field value of the scene field; extracting text information from judgment elements of the flow node information as field values of the step description field for the step description field; and extracting text information from the judging elements of the flow node information for the expected result field, and generating a field value of the expected result field according to the judging words of the flow direction elements corresponding to the judging elements.
5. The apparatus of claim 4, wherein the identification processing module is further configured to:
Performing text-text detection on a document to be tested through a first deep learning network to detect a text box in the document to be tested;
performing text matching and extraction according to the text box;
and inputting the extracted text into a second deep learning network for universal character recognition so as to obtain the text and the judgment symbol included in the document to be tested.
6. The apparatus of claim 4, further comprising a field value extension module configured to:
before the field values are logically processed by using a test case writing method to generate test cases, expanding the field values corresponding to the fields extracted from the flow node information into corresponding value ranges according to the value ranges corresponding to the preset fields;
and, the logic processing module is further configured to:
and according to the value range corresponding to the field, respectively carrying out logic processing on each field value in the value range by using a test case writing method to generate a plurality of test cases.
7. An electronic device for generating test cases, comprising:
one or more processors;
storage means for storing one or more programs,
When executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-3.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-3.
CN202110648223.9A 2021-06-10 2021-06-10 Method and device for generating test cases Active CN113377653B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110648223.9A CN113377653B (en) 2021-06-10 2021-06-10 Method and device for generating test cases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110648223.9A CN113377653B (en) 2021-06-10 2021-06-10 Method and device for generating test cases

Publications (2)

Publication Number Publication Date
CN113377653A CN113377653A (en) 2021-09-10
CN113377653B true CN113377653B (en) 2023-09-26

Family

ID=77573660

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110648223.9A Active CN113377653B (en) 2021-06-10 2021-06-10 Method and device for generating test cases

Country Status (1)

Country Link
CN (1) CN113377653B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116185883A (en) * 2023-04-28 2023-05-30 阿里云计算有限公司 Test case generation method, test system, device, equipment and medium
CN117130946B (en) * 2023-10-27 2024-01-26 北京世冠金洋科技发展有限公司 Test scene generation method and device, electronic equipment and readable storage medium
CN117349188B (en) * 2023-12-05 2024-03-15 摩斯智联科技有限公司 Test case generation method and device based on large model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446099A (en) * 2018-11-09 2019-03-08 贵州医渡云技术有限公司 Automatic test cases generation method, device, medium and electronic equipment
CN110134592A (en) * 2019-04-19 2019-08-16 平安普惠企业管理有限公司 A kind of method and device of supplementary data field, electronic equipment
CN110287104A (en) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 Method for generating test case, device, terminal and computer readable storage medium
CN111506498A (en) * 2020-03-16 2020-08-07 平安科技(深圳)有限公司 Automatic generation method and device of test case, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
SG11201509527TA (en) * 2013-07-23 2015-12-30 Landmark Graphics Corp Automated generation of scripted and manual test cases

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446099A (en) * 2018-11-09 2019-03-08 贵州医渡云技术有限公司 Automatic test cases generation method, device, medium and electronic equipment
CN110134592A (en) * 2019-04-19 2019-08-16 平安普惠企业管理有限公司 A kind of method and device of supplementary data field, electronic equipment
CN110287104A (en) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 Method for generating test case, device, terminal and computer readable storage medium
CN111506498A (en) * 2020-03-16 2020-08-07 平安科技(深圳)有限公司 Automatic generation method and device of test case, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于消息转发软件的自动化测试研究;张鹏;;电子制作(14);全文 *

Also Published As

Publication number Publication date
CN113377653A (en) 2021-09-10

Similar Documents

Publication Publication Date Title
CN113377653B (en) Method and device for generating test cases
CN107886306B (en) File approval method, medium, device and computing equipment
CN109359194B (en) Method and apparatus for predicting information categories
CN109871311B (en) Method and device for recommending test cases
CN106919711B (en) Method and device for labeling information based on artificial intelligence
CN111104479A (en) Data labeling method and device
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN110705271B (en) System and method for providing natural language processing service
CN109710634B (en) Method and device for generating information
CN117171296A (en) Information acquisition method and device and electronic equipment
CN109740130B (en) Method and device for generating file
CN115563942A (en) Contract generation method and device, electronic equipment and computer readable medium
CN113448869B (en) Method and device for generating test case, electronic equipment and computer readable medium
WO2022105120A1 (en) Text detection method and apparatus from image, computer device and storage medium
CN115640279A (en) Method and device for constructing data blood relationship
CN115328736A (en) Probe deployment method, device, equipment and storage medium
CN113656041A (en) Data processing method, device, equipment and storage medium
CN111783572B (en) Text detection method and device
CN113742485A (en) Method and device for processing text
CN112784527A (en) Document merging method and device and electronic equipment
CN114239501A (en) Contract generation method, apparatus, device and medium
CN110796137A (en) Method and device for identifying image
CN112579080A (en) Method and device for generating user interface code
CN110858240A (en) Front-end module loading method and device
CN114968455B (en) Report generation method and device of application interface and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant