CN113282498B - Method, device, equipment and storage medium for generating test cases - Google Patents

Method, device, equipment and storage medium for generating test cases Download PDF

Info

Publication number
CN113282498B
CN113282498B CN202110605313.XA CN202110605313A CN113282498B CN 113282498 B CN113282498 B CN 113282498B CN 202110605313 A CN202110605313 A CN 202110605313A CN 113282498 B CN113282498 B CN 113282498B
Authority
CN
China
Prior art keywords
test
test case
sentences
document
statement
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
CN202110605313.XA
Other languages
Chinese (zh)
Other versions
CN113282498A (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.)
Shenzhen Saiante Technology Service Co Ltd
Original Assignee
Shenzhen Saiante Technology Service 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 Shenzhen Saiante Technology Service Co Ltd filed Critical Shenzhen Saiante Technology Service Co Ltd
Priority to CN202110605313.XA priority Critical patent/CN113282498B/en
Publication of CN113282498A publication Critical patent/CN113282498A/en
Application granted granted Critical
Publication of CN113282498B publication Critical patent/CN113282498B/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

Abstract

The application relates to the technical field of software testing, and discloses a method, a device, a medium and equipment for generating test cases, wherein the method comprises the following steps: acquiring a test case generation instruction; acquiring a demand document according to the demand document pointing information; identifying a plurality of test key sentences from the requirement document according to example test sentences in a test case sentence library; taking each test key statement as a check point and marking a function label of the check point; traversing and extracting the test key sentences corresponding to the target check points through a preset macro script, sequencing the test key sentences, integrating the sequenced test key sentences into a first test case according to a preset display format, and executing test functions corresponding to the test key sentences according to the sequence of the first test case. Therefore, the generation efficiency of the test case is improved, input errors are avoided, and the software testing efficiency and the testing accuracy are improved.

Description

Method, device, equipment and storage medium for generating test cases
Technical Field
The present invention relates to the field of software testing technologies, and in particular, to a method, an apparatus, a medium, and a device for generating a test case.
Background
Software testing is an important ring in software engineering, and the quality of software testing is closely related to the quality of test cases. The design and execution of the test cases are methods for quantifying the test details, and the test cases are used as standards when the test is executed, so that test results are conveniently generated and counted. The test cases are generally designed according to the requirement documents, if a device can automatically generate a test case according to the requirement documents, the requirement is not manually typed any more and converted into the test case, so that time and labor are saved, and the test case can comprehensively cover the requirement points.
The existing test case modes of software test are as follows: the method comprises the steps of directly inputting a required document into a test case management system in a manual typing mode, inputting a test case in an Excel format into the test case management system in a manual typing mode after writing the test case, marking a test result in the thinking guide graph after writing the test case thinking guide graph through software such as xmind and the like, or exporting the thinking guide graph into the Excel document; however, the manual typing method is low in efficiency and long in time consumption, and is easy to cause the conditions of typing errors and the like, so that the efficiency and quality of software testing are reduced.
Disclosure of Invention
The main purpose of the application is to provide a method, a device, a medium and equipment for generating test cases, and aims to solve the technical problems that in the prior art, the generation mode of the test cases is low in efficiency, long in time consumption and easy to cause input errors.
In order to achieve the above object, the present application proposes a method for generating a test case, where the method includes:
acquiring a test case generation instruction, wherein the test case generation instruction comprises required document pointing information and test function information;
acquiring a demand document according to the demand document pointing information;
identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to example test sentences in a test case sentence library, wherein a plurality of different example test sentences are stored in the test case sentence library;
taking each test key statement as a check point, and marking the function label of the check point according to the test function corresponding to the test key statement;
traversing the demand document through a preset macro script, taking a check point corresponding to a function label matched with the test function information as a target check point in the demand document, and extracting the test key statement corresponding to the target check point;
And sequencing the test key sentences, and integrating the sequenced test key sentences into a first test case according to a preset display format so as to sequentially execute the test functions corresponding to the test key sentences according to the first test case.
Further, the step of sorting the test key sentences and integrating the sorted test key sentences into the first test case according to a preset display format includes:
if the test function information comprises at least two function types, configuring the test key sentences corresponding to target checkpoints matched with different function types in different first storage lists respectively;
sorting the test key sentences in the first different first storage lists respectively;
configuring test key sentences in each first storage list according to the preset display format, and taking each configured first storage list as one first test case.
Further, the step of identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to the example test sentences in the test case sentence library includes:
Identifying the same text content in the requirements document as the example test statement;
and taking the text content as a basic point, reading the last period as a starting point, reading the next period as an end point, and intercepting the content between the starting point and the end point as the test key statement.
Further, the step of sorting the test key sentences, integrating the sorted test key sentences into a first test case according to a preset display format, and executing the test functions corresponding to the test key sentences according to the first test case sequence further includes:
and when the missing information of the test case is received, a missing alarm signal is sent, so that a user sends a test case supplementing instruction according to the missing alarm signal.
Further, after the step of sequentially executing the test functions corresponding to the test key sentences according to the first test case, the method further includes:
acquiring a test case supplement instruction, wherein the test case supplement instruction comprises supplement document pointing information and supplement test function information;
acquiring a supplementary document according to the supplementary document pointing information;
identifying a plurality of supplementary test sentences and test functions corresponding to each supplementary test sentence from the supplementary document according to the example test sentences in the test case sentence library;
Taking each supplementary test statement as a check point, and marking the function label of the check point according to the supplementary test function corresponding to the supplementary test statement;
traversing the supplementary document through a preset macro script, taking a check point corresponding to a function label matched with the supplementary test function information as a supplementary check point in the supplementary document, and extracting the supplementary test statement corresponding to the target check point;
forming a second test case according to the supplementary test statement and the first test case;
and executing the test functions corresponding to the test key sentences and the supplementary test sentences according to the sequence of the second test cases.
Further, the step of forming a second test case according to the supplemental test statement and the first test case includes:
identifying the first stored list corresponding to the supplemental checkpoint;
adding the supplementary test statement into the first storage list corresponding to the supplementary check point, and integrating the supplementary test statement and the test key statement in the first test case into a second test case according to a preset display format.
The application also provides a device for generating the test case, which comprises:
the instruction acquisition module is used for acquiring a test case generation instruction, wherein the test case generation instruction comprises required document pointing information and test function information;
the document acquisition module is used for acquiring the required document according to the required document pointing information;
the statement identification module is used for identifying a plurality of test key statements and test functions corresponding to each test key statement from the requirement document according to example test statements in the test case statement library, wherein a plurality of different example test statements are stored in the test case statement library;
the statement marking module is used for respectively taking each test key statement as a check point and marking the function label of the check point according to the test function corresponding to the test key statement;
the statement extraction module is used for traversing the requirement document through a preset macro script, taking a check point corresponding to the function label matched with the test function information as a target check point in the requirement document, and extracting the test key statement corresponding to the target check point;
The test case generation module is used for sequencing the test key sentences and integrating the sequenced test key sentences into a first test case according to a preset display format so as to sequentially execute the test functions corresponding to the test key sentences according to the first test case.
Further, the test case generation module is further configured to:
if the test function information comprises at least two function types, configuring the test key sentences corresponding to target checkpoints matched with different function types in different first storage lists respectively;
sorting the test key sentences in the first storage list respectively;
configuring test key sentences in each first storage list according to the preset display format, and taking each configured first storage list as one first test case.
The present application also proposes a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
The present application also proposes a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method of any of the above.
According to the method, the device, the medium and the equipment for generating the test cases, corresponding test key sentences and test functions are identified in the requirement document through the test case sentence library, and function label marks of check points are carried out on the test key sentences, so that the error or redundancy caused by manually identifying the test key sentences is avoided; the test key sentences corresponding to the target check points can be automatically exported through the preset macro scripts, so that the test key sentences which are in accordance with the test case generation instructions of a large amount of data can be quickly exported, and the problem of low test case generation efficiency caused by manually inputting the content into a test case management system is avoided; by sequencing the test key sentences and generating corresponding test cases according to a preset display format, a user manually or automatically executes test functions according to the test case sequence by a computer, and the test efficiency and accuracy are improved.
Drawings
FIG. 1 is a flow chart of a method for generating test cases according to an embodiment of the present application;
FIG. 2 is a schematic block diagram of a device for generating test cases according to an embodiment of the present application;
fig. 3 is a block diagram schematically illustrating a structure of a computer device according to an embodiment of the present application.
The realization, functional characteristics and advantages of the present application will be further described with reference to the embodiments, referring to the attached drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Referring to fig. 1, in order to achieve the above object, an embodiment of the present application provides a method for generating a test case, where the method includes:
s1: acquiring a test case generation instruction, wherein the test case generation instruction comprises required document pointing information and test function information;
s2, acquiring a demand document according to the demand document pointing information;
s3: identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to example test sentences in a test case sentence library, wherein a plurality of different example test sentences are stored in the test case sentence library;
s4: taking each test key statement as a check point, and marking the function label of the check point according to the test function corresponding to the test key statement;
S5: traversing the demand document through a preset macro script, taking a check point corresponding to a function label matched with the test function information as a target check point in the demand document, and extracting the test key statement corresponding to the target check point;
s6: and sequencing the test key sentences, and integrating the sequenced test key sentences into a first test case according to a preset display format so as to sequentially execute the test functions corresponding to the test key sentences according to the first test case.
In the embodiment, the corresponding test key sentences and test functions are identified in the requirement document through the test case sentence library, and the function labels of check points are marked on the test key sentences, so that the error or redundancy caused by manually identifying the test key sentences is avoided; the test key sentences corresponding to the target check points can be automatically exported through the preset macro scripts, so that the test key sentences which are in accordance with the test case generation instructions of a large amount of data can be quickly exported, and the problem of low test case generation efficiency caused by manually inputting the content into a test case management system is avoided; by sequencing the test key sentences and generating corresponding test cases according to a preset display format, a user manually or automatically executes test functions according to the test case sequence by a computer, and the test efficiency and accuracy are improved.
For step S1, the requirement document generally refers to a requirement document applied to a software test for determining whether a software system to be tested meets a specified requirement by running or measuring the software system. In the application of software testing, a test case refers to a scheme for describing a test task of a software system and embodying a test strategy. Test cases are typically a type of document, typically in Excel format, that includes test targets, test environments, input data, test steps, expected results, test scripts, etc., to verify that the software system meets expected requirements, which are often described by a Word format requirements document and stored in a database or local computer. The test case generation instruction carries the pointing information of the required document, and the test function information is information comprising at least one function type to be tested.
For step S2, when the required document pointing information is identified, the required document stored under the address may be read from the storage address pointed by the required document pointing information, or the required document with the same name may be read according to the file name carried in the required document pointing information.
For step S3, a plurality of common test sentences are recorded in the preset test case sentence library, and the test case sentence library may include different functional sub-libraries, for example, a UI check library or an interface check library, where the UI check library may record common sentences such as "whether lines of an interface are consistent, whether lines of each interface are aligned, whether the lines of the interface are consistent", "whether the interfaces of the whole system are consistent", "whether button patterns on the interface are consistent", "whether all input boxes of the interface are checked" or "whether display formats are consistent", whether colors are unified ", and the interface check library may record common sentences such as" protocol type of an interface "," method of interface request "," whether there is correlation between parameters "or" parameter value range ".
Specifically, the test key sentence may be a sentence having the same or similar meaning as that of a common sentence recorded in the test case sentence library, and when a sentence is recognized as "button style consistency on judgment interface", it is illustratively determined whether the sentence corresponds to the common sentence "button style on interface" in the UI inspection library, and at this time, the sentence is regarded as the test key sentence and the test function thereof is determined as "UI inspection".
For step S4, the test key sentences are respectively used as a component of the test case and used as check points, and the function labels of the check points are respectively marked according to the test functions corresponding to the test key sentences; for example, if the test key sentence is the button style consistency on the judgment interface, the corresponding test function is "UI check", and the function label of the check point of the test key sentence is labeled as a label corresponding to "UI check", for example [ UI001 ]; when the test function of the test key statement is "interface check", the functional label of the check point of the test key statement is marked as a label corresponding to the "interface check", for example [ CO001 ]; the functional label of the checkpoint of the test key statement is marked as a label corresponding to "rule check", for example [ BU001 ].
For step S5, the preset macro script is a preconfigured macro function, and the macro function may be a Word self-contained macro function, where the macro includes a preset running code, and when the running code is executed, the location of the check point is identified in the requirement document through the feature information of the check point, and then each test key sentence corresponding to each check point is extracted, so as to automatically derive the test key sentence corresponding to the check point, and improve efficiency and accuracy of extracting the test key sentence.
The test function information in the test case generation instruction comprises items to be tested of the software system to be tested, when the test function information is UI check, the software system is indicated that the software system only needs to test UI functions currently, at the moment, a function tag [ UI001 ] matched with the UI check is identified in a requirement document, a check point marked as [ UI001 ] is taken as a target check point, and then test key sentences corresponding to all the target check points are obtained.
For step S6, the ranking of the test key sentences may be: and sequencing the test key sentences corresponding to the target checkpoints according to the arrangement sequence of the target checkpoints in the requirement document.
Specifically, the first test case may be a form including a test key sentence, the form may be an Excel format file, and the test key sentence is filled in the form according to a preset display format; the display format may include a table title, a number of rows, a number of columns, a number of rows, a background color, and the like, so that the generated first test case better accords with a test habit of a tester, and the first test case is displayed in a table form, and can be convenient for the tester to check leakage and repair deficiency, for example, when the tester finds that the number of rows generated by the first test case is 15, i.e. the number of items to be tested is 15, when only 14 rows of tables in the first test case are filled with contents, and when the 15 th row is blank, the original requirement document can be considered to leak a test requirement.
Specifically, after the first test case is generated, the test can be manually executed by a tester according to the first test case, or can be automatically executed by a test system. For the over-test system to automatically execute the test, illustratively, the executing verb and the functional noun in the test key statement are identified according to the semantics, for example, when the test key statement is "execute rule check test", the executing verb is "execute", and the functional noun is "rule check", and at this time, the rule check function in the test system is called to complete the test; according to the test functions corresponding to the test key sentences in the first test case are executed sequentially, the test functions can be automatically executed according to the content in the requirement document, and the test efficiency and accuracy are improved.
In one embodiment, the step of sorting the test key sentences and integrating the sorted test key sentences into the first test case according to a preset display format includes:
s61: if the test function information comprises at least two function types, configuring the test key sentences corresponding to target checkpoints matched with different function types in different first storage lists respectively;
S62: sorting the test key sentences in different first storage lists respectively;
s63: configuring test key sentences in each first storage list according to the preset display format, and taking each configured first storage list as one first test case.
According to the embodiment, the test key sentences corresponding to the check points are respectively configured in the corresponding first storage list according to different function types, so that the problem that the test key sentences are wrongly leaked in recognition and the problem that the reading efficiency and the testing efficiency of testers are reduced due to the fact that the test key sentences of different function types are arranged in the same use case or the same page in disorder is avoided.
For step S61, when the test function information includes at least two function types, it indicates that at least two types of tests need to be performed on the software system to be tested, respectively.
For step S62, the ranking of the test key sentences in the different first storage lists may be: and sequencing the test key sentences corresponding to the target checkpoints in different first storage lists according to the arrangement sequence of the target checkpoints in the requirement document.
For step S63, illustratively, if the function types included in the test function information are UI check and rule check, the test key sentence corresponding to the checkpoint labeled [ UI001 ] is configured in the first storage list of the UI check, and the test key sentence corresponding to the checkpoint labeled [ BU001 ] is configured in the first storage list of the rule check, so as to generate the UI check first test case and the rule check test case, respectively.
In one embodiment, the step of identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to the example test sentences in the test case sentence library includes:
s311: identifying the same text content in the requirements document as the example test statement;
s312: and taking the text content as a basic point, reading the last period as a starting point, reading the next period as an end point, and intercepting the content between the starting point and the end point as the test key statement.
According to the embodiment, the text content which is the same as the sample test statement in the requirement document is identified, and the content between the front period and the rear period is intercepted, so that omission of the front step and the rear step is avoided, and the integrity and the accuracy of test case generation are improved.
For step S311, the exemplary test sentence is a common word under test, and the test key sentence may be a sentence containing the common word.
For step S312, when a word identical to a common word recorded in the test case sentence library is recognized in the demand document, the previous period is read forward with the word as a base point, the next period is read backward with the word as an end point, and text contents between the start point and the end point are intercepted as test key sentences of the demand document, illustratively, when a sentence "... It is determined whether the protocol type of the interface is http or https. And judging that the statement corresponds to a common statement of 'protocol type of interface' in the interface checking library, acquiring the statement between the front period and the rear period as a test key statement at the moment, and judging the test function as 'interface checking'.
In one embodiment, the step of sorting the test key sentences, integrating the sorted test key sentences into a first test case according to a preset display format, and executing the test functions corresponding to the test key sentences according to the first test case sequence further includes:
S321: and when the missing information of the test case is received, a missing alarm signal is sent, so that a user sends a test case supplementing instruction according to the missing alarm signal.
According to the embodiment, the missing alarm signal is sent according to the missing information of the test case, so that the user is prompted abnormally, the user can supplement the missing information of the current test case conveniently, the test accuracy is improved, and the problem that the test items are missed due to incomplete recording of the content of the required document is avoided.
For step S321, the missing test case information may be manually sent when the current tester observes that there is a missing test item, so as to remind the generator of the requirement document to send the test case supplement instruction according to the missing alarm signal; the missing information of the test case can also be automatically formed when the computer recognizes that the preset number of the test items is not consistent with the final number of the test items, so that a missing alarm signal is sent to a tester; if the user finds that the reason of the missing test case is that related sentences are missing in the original requirement document, the missing sentences can be integrated into a supplementary document by self, and if the user finds that the reason of the missing test case is that the pointing information of the requirement document carried in the previous test case generation instruction is missed, the correct pointing information is sent through the test case supplementary instruction.
In one embodiment, after the step of sequentially executing the test functions corresponding to the test key statement according to the first test case, the method further includes:
s71: acquiring a test case supplement instruction, wherein the test case supplement instruction comprises supplement document pointing information and supplement test function information;
s72: acquiring a supplementary document according to the supplementary document pointing information;
s73: identifying a plurality of supplementary test sentences and test functions corresponding to each supplementary test sentence from the supplementary document according to the example test sentences in the test case sentence library;
s74: taking each supplementary test statement as a check point, and marking the function label of the check point according to the supplementary test function corresponding to the supplementary test statement;
s75: traversing the supplementary document through a preset macro script, taking a check point corresponding to a function label matched with the supplementary test function information as a supplementary check point in the supplementary document, and extracting the supplementary test statement corresponding to the target check point;
s76: forming a second test case according to the supplementary test statement and the first test case;
S77: and executing the test functions corresponding to the test key sentences and the supplementary test sentences according to the sequence of the second test cases.
According to the embodiment, the existing first test case is updated to obtain the second test case added with the supplementary test statement, so that a tester can conveniently modify the test case in real time, and software test is performed by adopting the newly generated test case, the flexibility and controllability of a test process are improved, the situation that the test case is regenerated once for each modification is avoided, and the problems of efficiency reduction and generation time waste caused by repeated generation of the same content without modification are avoided.
For step S71, the test case supplement instruction is usually a supplement instruction actively issued by a tester, the supplement document is usually a missing or missing test requirement in the first test case recorded in the requirement document in Word format, and when the test case supplement instruction is received, the supplement document is immediately received, so that the tester can actively add the number of test terms according to the requirement or supplement the missing test requirement in the original requirement document, and the flexibility of generating the test document is improved.
For step S72, the supplementary document may be pre-stored in the local computer or pre-stored in the remote database, or may be temporarily generated by the tester according to the test case supplementary instruction, where the temporarily generated supplementary document may be stored in the local computer or the remote database, and the supplementary document pointing information carries a storage address pointing to the supplementary document in the local computer or the remote database; if the supplemental document is not stored in the local computer or remote database, the supplemental document may be sent by the tester along with the test case supplemental instructions.
For step S73, the supplemental test key sentence may be the same sentence as the common sentence described in the test case sentence library; or, sentences containing common words recorded in the test case sentence library may be used, specifically, when the same words as the common words recorded in the test case sentence library are identified in the supplementary document, the previous period is read forward by taking the words as the base point as the starting point, the next period is read backward as the end point, and text contents between the starting point and the end point are intercepted as supplementary test key sentences of the supplementary document.
For step S75, a macro function is applied in the process of deriving the supplemental checkpoints and the corresponding supplemental test sentences, where the macro includes a preset running code, and when the running code is executed, the location of the supplemental checkpoints is identified in the supplemental document through the feature information of the supplemental checkpoints, and then the supplemental test sentences corresponding to each supplemental checkpoint are extracted, so as to implement automatic supplementation of the test key sentences. In an implementation, the feature information of the supplementary check point may be the same as the check point, and at this time, the supplementary document is marked with only the content to be supplemented, and the feature information of the supplementary check point may be different from the check point, and at this time, the supplementary check point and the check point may exist in the supplementary document at the same time, and at this time, the macro only identifies the feature information of the supplementary check point. The characteristic information may be a characteristic that is distinguishable by name, type, color, format, etc. of the checkpoint.
For step S76, after the second test case is generated, the test of the first test case may be interrupted by the tester, and the test may be manually performed according to the second test case, or the test of the second test case may be performed after the test of the first test case is automatically interrupted by the test system. For the over-test system to automatically execute the test, illustratively, the executing verb and the functional noun in the test key statement are identified according to the semantics, for example, when the test key statement is "execute rule check test", the executing verb is "execute", and the functional noun is "rule check", and at this time, the rule check function in the test system is called to complete the test; according to the test functions corresponding to the test key sentences in the first test case are executed sequentially, the test functions can be automatically executed according to the content in the requirement document, and the test efficiency and accuracy are improved. And executing the test functions corresponding to the test key sentences and the supplementary test sentences according to the sequence of the second test cases.
In one embodiment, the step of forming a second test case from the supplemental test statement and the first test case includes:
S761: identifying, in the different first stored list, a first stored list corresponding to the supplemental checkpoint;
s762: adding the supplementary test statement into a first storage list corresponding to the supplementary check point, and integrating the supplementary test statement and the test key statement in the first test case into a second test case according to a preset display format.
According to the embodiment, the first storage list corresponding to the supplementary check point is identified, so that supplementary test sentences of different test functions in the supplementary document can be correspondingly supplemented to the first test cases corresponding to the test functions, and the condition that the supplementary document causes disordered test projects is avoided.
For step S761, since the test key sentences corresponding to the target checkpoints matched with different function types are respectively configured in different first storage lists in the embodiment, a first storage list often only corresponds to one function type, namely one function label; if the function label of the supplementary checkpoint is [ UI001 ], the first storage list corresponding to the supplementary checkpoint is the first storage list of the UI check.
For step S762, after identifying the first storage list corresponding to the supplemental checkpoint, adding the supplemental test statement corresponding to the supplemental checkpoint to the first storage list of the UI inspection, thereby generating a second test case on the basis of the first test case.
In one embodiment, the step of obtaining the demand document according to the demand document pointing information includes:
s21: identifying the number of the required document pointing information included in the test case generation instruction;
s22: and if the number of the required document pointing information is not less than 2, respectively acquiring target documents pointed by each required document pointing information, and combining the target documents to form the required document.
According to the embodiment, when the plurality of requirement document pointing information is contained, the target documents pointed by the requirement document pointing information are respectively obtained, and the target documents are combined to form a complete requirement document, so that the test items in different storage addresses and different documents can be automatically integrated, and the problems of low efficiency and high error rate caused by manual editing one by one are avoided.
For step S21, if a test case generation instruction corresponds to two or more required documents, it indicates that the contents in the plurality of target documents need to be integrated into a test case.
For step S22, the target documents pointed by the demand document pointing information in the test case generating instruction may be sequentially obtained according to the arrangement sequence of the demand document pointing information, after the target documents pointed by the demand document pointing information are respectively obtained, the target documents may be sorted according to the sequence of the time of initiating the obtaining, so as to form the demand document, and then through a preset macro script, the target checkpoints in the demand document are respectively traversed, and the test key sentences corresponding to the target checkpoints are extracted; and generating the first test case according to a preset display format, and displaying the test key sentences of the required documents in the first test case, namely simultaneously displaying the test key sentences of each target document in the first test case.
Referring to fig. 2, the present application further provides a device for generating a test case, including: the method comprises the steps of carrying out a first treatment on the surface of the
The instruction acquisition module 100 is configured to acquire a test case generation instruction, where the test case generation instruction includes requirement document pointing information and test function information;
a document acquisition module 200, configured to acquire a requirement document according to the requirement document pointing information;
the sentence identifying module 300 is configured to identify a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to an example test sentence in a test case sentence library, where the test case sentence library stores a plurality of different example test sentences;
the statement marking module 400 is configured to respectively take each test key statement as a check point, and mark a function label of the check point according to a test function corresponding to the test key statement;
the sentence extraction module 500 is configured to traverse the requirement document through a preset macro script, take a check point corresponding to a function tag matched with the test function information as a target check point in the requirement document, and extract the test key sentence corresponding to the target check point, where the target check point is a check point corresponding to the function tag matched with the test function information;
The test case generating module 600 is configured to sort the test key sentences, and integrate the sorted test key sentences into a first test case according to a preset display format, so as to sequentially execute test functions corresponding to the test key sentences according to the first test case.
In the embodiment, the corresponding test key sentences and test functions are identified in the requirement document through the test case sentence library, and the function labels of check points are marked on the test key sentences, so that the error or redundancy caused by manually identifying the test key sentences is avoided; the test key sentences corresponding to the target check points can be automatically exported through the preset macro scripts, so that the test key sentences which are in accordance with the test case generation instructions of a large amount of data can be quickly exported, and the problem of low test case generation efficiency caused by manually inputting the content into a test case management system is avoided; by sequencing the test key sentences and generating corresponding test cases according to a preset display format, a user manually or automatically executes test functions according to the test case sequence by a computer, and the test efficiency and accuracy are improved.
In one embodiment, the test case generation module 600 is further configured to:
If the test function information comprises at least two function types, configuring the test key sentences corresponding to target checkpoints matched with different function types in different first storage lists respectively;
sorting the test key sentences in different first storage lists respectively;
configuring test key sentences in each first storage list according to the preset display format, and taking each configured first storage list as one first test case.
In one embodiment, the test case generation module 600 is further configured to:
identifying the same text content in the requirements document as the example test statement;
and taking the text content as a basic point, reading the last period as a starting point, reading the next period as an end point, and intercepting the content between the starting point and the end point as the test key statement.
In one embodiment, the system further comprises a missing alarm module 700 for:
and when the missing information of the test case is received, a missing alarm signal is sent, so that a user sends a test case supplementing instruction according to the missing alarm signal.
In one embodiment, the test case generation module 600 is further configured to:
acquiring a test case supplement instruction, wherein the test case supplement instruction comprises supplement document pointing information and supplement test function information;
acquiring a supplementary document according to the supplementary document pointing information;
identifying a plurality of supplementary test sentences and test functions corresponding to each supplementary test sentence from the supplementary document according to the example test sentences in the test case sentence library;
taking each supplementary test statement as a check point, and marking the function label of the check point according to the supplementary test function corresponding to the supplementary test statement;
traversing the supplementary document through a preset macro script, taking a check point corresponding to the functional label matched with the supplementary test function information as a supplementary check point in the supplementary document, and extracting the supplementary test statement corresponding to the target check point, wherein the supplementary check point is a check point corresponding to the functional label matched with the supplementary function information;
forming a second test case according to the supplementary test statement and the first test case;
and executing the test functions corresponding to the test key sentences and the supplementary test sentences according to the sequence of the second test cases.
In one embodiment, the test case generation module 600 is further configured to:
identifying the first stored list corresponding to the supplemental checkpoint;
adding the supplementary test statement into the first storage list corresponding to the supplementary check point, and integrating the supplementary test statement and the test key statement in the first test case into a second test case according to a preset display format.
In one embodiment, the document acquisition module 200 is further configured to:
identifying the number of the required document pointing information included in the test case generation instruction;
and if the number of the required document pointing information is not less than 2, respectively acquiring target documents pointed by each required document pointing information, and combining the target documents to form the required document.
Referring to fig. 3, a computer device is further provided in the embodiment of the present application, where the computer device may be a server, and the internal structure of the computer device may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as a generating method of the test case. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of generating test cases. The method for generating the test case comprises the following steps: acquiring a test case generation instruction, wherein the test case generation instruction comprises required document pointing information and test function information; acquiring a demand document according to the demand document pointing information; identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to example test sentences in a test case sentence library, wherein a plurality of different example test sentences are stored in the test case sentence library; taking each test key statement as a check point, and marking the function label of the check point according to the test function corresponding to the test key statement; traversing the demand document through a preset macro script, taking a check point corresponding to a function label matched with the test function information as a target check point in the demand document, and extracting the test key statement corresponding to the target check point; and sequencing the test key sentences, and integrating the sequenced test key sentences into a first test case according to a preset display format so as to sequentially execute the test functions corresponding to the test key sentences according to the first test case.
An embodiment of the present application further provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor, implements a method for generating a test case, including the steps of: acquiring a test case generation instruction, wherein the test case generation instruction comprises required document pointing information and test function information; acquiring a demand document according to the demand document pointing information; identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to example test sentences in a test case sentence library, wherein a plurality of different example test sentences are stored in the test case sentence library; taking each test key statement as a check point, and marking the function label of the check point according to the test function corresponding to the test key statement; traversing the demand document through a preset macro script, taking a check point corresponding to a function label matched with the test function information as a target check point in the demand document, and extracting the test key statement corresponding to the target check point; and sequencing the test key sentences, and integrating the sequenced test key sentences into a first test case according to a preset display format so as to sequentially execute the test functions corresponding to the test key sentences according to the first test case.
According to the method for generating the executed test case, the corresponding test key sentences and test functions are identified in the requirement document through the test case sentence library, and the test key sentences are marked with function labels of check points, so that the error or redundancy caused by manually identifying the test key sentences is avoided; the test key sentences corresponding to the target check points can be automatically exported through the preset macro scripts, so that the test key sentences which are in accordance with the test case generation instructions of a large amount of data can be quickly exported, and the problem of low test case generation efficiency caused by manually inputting the content into a test case management system is avoided; by sequencing the test key sentences and generating corresponding test cases according to a preset display format, a user manually or automatically executes test functions according to the test case sequence by a computer, and the test efficiency and accuracy are improved.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (9)

1. A method for generating test cases, the method comprising:
acquiring a test case generation instruction, wherein the test case generation instruction comprises required document pointing information and test function information;
Acquiring a demand document according to the demand document pointing information;
identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to example test sentences in a test case sentence library, wherein a plurality of different example test sentences are stored in the test case sentence library;
taking each test key statement as a check point, and marking the function label of the check point according to the test function corresponding to the test key statement;
traversing the demand document through a preset macro script, taking a check point corresponding to a function label matched with the test function information as a target check point in the demand document, and extracting the test key statement corresponding to the target check point;
sorting the test key sentences, integrating the sorted test key sentences into a first test case according to a preset display format, and executing test functions corresponding to the test key sentences according to the first test case sequence;
the step of sorting the test key sentences and integrating the sorted test key sentences into a first test case according to a preset display format comprises the following steps:
If the test function information comprises at least two function types, configuring the test key sentences corresponding to target checkpoints matched with different function types in different first storage lists respectively;
sorting the test key sentences in the first storage list respectively;
configuring test key sentences in each first storage list according to the preset display format, and taking each configured first storage list as one first test case.
2. The method for generating test cases according to claim 1, wherein the step of identifying a plurality of test key sentences and test functions corresponding to each test key sentence from the requirement document according to the example test sentences in the test case sentence library comprises:
identifying the same text content in the requirements document as the example test statement;
and taking the text content as a basic point, reading the last period as a starting point, reading the next period as an end point, and intercepting the content between the starting point and the end point as the test key statement.
3. The method for generating test cases according to claim 1, wherein after the step of sorting the test key sentences and integrating the sorted test key sentences into a first test case according to a preset display format to sequentially execute the test functions corresponding to the test key sentences according to the first test case, the method further comprises:
And when the missing information of the test case is received, a missing alarm signal is sent, so that a user sends a test case supplementing instruction according to the missing alarm signal.
4. The method for generating test cases according to claim 3, wherein after the step of sequentially executing the test functions corresponding to the test key sentences according to the first test case, further comprises:
acquiring a test case supplement instruction, wherein the test case supplement instruction comprises supplement document pointing information and supplement test function information;
acquiring a supplementary document according to the supplementary document pointing information;
identifying a plurality of supplementary test sentences and test functions corresponding to each supplementary test sentence from the supplementary document according to the example test sentences in the test case sentence library;
taking each supplementary test statement as a check point, and marking the function label of the check point according to the supplementary test function corresponding to the supplementary test statement;
traversing the supplementary document through a preset macro script, taking a check point corresponding to a function label matched with the supplementary test function information as a supplementary check point in the supplementary document, and extracting the supplementary test statement corresponding to the target check point;
Forming a second test case according to the supplementary test statement and the first test case;
and executing the test functions corresponding to the test key sentences and the supplementary test sentences according to the sequence of the second test cases.
5. The method for generating test cases according to claim 4, wherein the step of forming a second test case from the supplemental test statement and the first test case comprises:
identifying the first stored list corresponding to the supplemental checkpoint;
adding the supplementary test statement into the first storage list corresponding to the supplementary check point, and integrating the supplementary test statement and the test key statement in the first test case into a second test case according to a preset display format.
6. The method for generating test cases according to claim 1, wherein the step of acquiring the demand document according to the demand document pointing information comprises:
identifying the number of the required document pointing information included in the test case generation instruction;
and if the number of the required document pointing information is not less than 2, respectively acquiring target documents pointed by each required document pointing information, and combining the target documents to form the required document.
7. A test case generating apparatus, comprising:
the instruction acquisition module is used for acquiring a test case generation instruction, wherein the test case generation instruction comprises required document pointing information and test function information;
the document acquisition module is used for acquiring the required document according to the required document pointing information;
the statement identification module is used for identifying a plurality of test key statements and test functions corresponding to each test key statement from the requirement document according to example test statements in the test case statement library, wherein a plurality of different example test statements are stored in the test case statement library;
the statement marking module is used for respectively taking each test key statement as a check point and marking the function label of the check point according to the test function corresponding to the test key statement;
the statement extraction module is used for traversing the requirement document through a preset macro script, taking a check point corresponding to the function label matched with the test function information as a target check point in the requirement document, and extracting the test key statement corresponding to the target check point;
The test case generation module is used for sequencing the test key sentences and integrating the sequenced test key sentences into a first test case according to a preset display format so as to sequentially execute the test functions corresponding to the test key sentences according to the first test case;
the step of sorting the test key sentences and integrating the sorted test key sentences into a first test case according to a preset display format comprises the following steps:
if the test function information comprises at least two function types, configuring the test key sentences corresponding to target checkpoints matched with different function types in different first storage lists respectively;
sorting the test key sentences in the first storage list respectively;
configuring test key sentences in each first storage list according to the preset display format, and taking each configured first storage list as one first test case.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202110605313.XA 2021-05-31 2021-05-31 Method, device, equipment and storage medium for generating test cases Active CN113282498B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110605313.XA CN113282498B (en) 2021-05-31 2021-05-31 Method, device, equipment and storage medium for generating test cases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110605313.XA CN113282498B (en) 2021-05-31 2021-05-31 Method, device, equipment and storage medium for generating test cases

Publications (2)

Publication Number Publication Date
CN113282498A CN113282498A (en) 2021-08-20
CN113282498B true CN113282498B (en) 2024-04-05

Family

ID=77283041

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110605313.XA Active CN113282498B (en) 2021-05-31 2021-05-31 Method, device, equipment and storage medium for generating test cases

Country Status (1)

Country Link
CN (1) CN113282498B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114238070B (en) * 2021-11-09 2023-08-18 中国电力科学研究院有限公司 Test script generation method and system based on semantic recognition
CN114978973B (en) * 2022-05-18 2023-05-09 宁畅信息产业(北京)有限公司 Communication interface testing method and device, testing machine and storage medium
CN115344504B (en) * 2022-10-19 2023-03-24 广州软件应用技术研究院 Software test case automatic generation method and tool based on requirement specification

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464831A (en) * 2009-01-09 2009-06-24 西安邮电学院 Reduction technology for test use cases
CN103176896A (en) * 2011-12-23 2013-06-26 阿里巴巴集团控股有限公司 Generating method and generating device of test cases
CN103838672A (en) * 2014-03-04 2014-06-04 中国工商银行股份有限公司 Automated testing method and device for all-purpose financial statements
CN105335287A (en) * 2015-10-15 2016-02-17 广东欧珀移动通信有限公司 Automatic test method and device
CN105335291A (en) * 2015-11-12 2016-02-17 浪潮电子信息产业股份有限公司 Software security test case design method
CN110442513A (en) * 2019-07-08 2019-11-12 深圳壹账通智能科技有限公司 Execution method, apparatus, computer equipment and the storage medium of functional test use-case
CN110806977A (en) * 2019-10-30 2020-02-18 泰康保险集团股份有限公司 Test case set generation method and device based on product requirements and electronic equipment
CN111240971A (en) * 2020-01-06 2020-06-05 深圳市卡牛科技有限公司 Method and device for generating wind control rule test case, server and storage medium
CN112328489A (en) * 2020-11-11 2021-02-05 南京领行科技股份有限公司 Test case generation method and device, terminal equipment and storage medium
CN112395188A (en) * 2020-11-06 2021-02-23 武汉木仓科技股份有限公司 Test-oriented software project development method and device, electronic equipment and storage medium
CN112433705A (en) * 2020-11-25 2021-03-02 平安普惠企业管理有限公司 Script generation method and device, electronic equipment and storage medium
CN112579466A (en) * 2020-12-25 2021-03-30 深圳证券交易所 Test case generation method and device and computer readable storage medium
CN112580363A (en) * 2020-12-24 2021-03-30 平安普惠企业管理有限公司 Requirement document processing method and device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100005341A1 (en) * 2008-07-02 2010-01-07 International Business Machines Corporation Automatic detection and notification of test regression with automatic on-demand capture of profiles for regression analysis
US9940222B2 (en) * 2015-11-20 2018-04-10 General Electric Company System and method for safety-critical software automated requirements-based test case generation

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464831A (en) * 2009-01-09 2009-06-24 西安邮电学院 Reduction technology for test use cases
CN103176896A (en) * 2011-12-23 2013-06-26 阿里巴巴集团控股有限公司 Generating method and generating device of test cases
CN103838672A (en) * 2014-03-04 2014-06-04 中国工商银行股份有限公司 Automated testing method and device for all-purpose financial statements
CN105335287A (en) * 2015-10-15 2016-02-17 广东欧珀移动通信有限公司 Automatic test method and device
CN105335291A (en) * 2015-11-12 2016-02-17 浪潮电子信息产业股份有限公司 Software security test case design method
CN110442513A (en) * 2019-07-08 2019-11-12 深圳壹账通智能科技有限公司 Execution method, apparatus, computer equipment and the storage medium of functional test use-case
CN110806977A (en) * 2019-10-30 2020-02-18 泰康保险集团股份有限公司 Test case set generation method and device based on product requirements and electronic equipment
CN111240971A (en) * 2020-01-06 2020-06-05 深圳市卡牛科技有限公司 Method and device for generating wind control rule test case, server and storage medium
CN112395188A (en) * 2020-11-06 2021-02-23 武汉木仓科技股份有限公司 Test-oriented software project development method and device, electronic equipment and storage medium
CN112328489A (en) * 2020-11-11 2021-02-05 南京领行科技股份有限公司 Test case generation method and device, terminal equipment and storage medium
CN112433705A (en) * 2020-11-25 2021-03-02 平安普惠企业管理有限公司 Script generation method and device, electronic equipment and storage medium
CN112580363A (en) * 2020-12-24 2021-03-30 平安普惠企业管理有限公司 Requirement document processing method and device, computer equipment and storage medium
CN112579466A (en) * 2020-12-25 2021-03-30 深圳证券交易所 Test case generation method and device and computer readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Using hypergraph as modeling language for generating test cases on demand;K.R.P.H. Leung;《11th Asia-Pacific Software Engineering Conference》;1-7 *
基于时序图模型的软件测试用例自动生成的研究;黄昇;《中国优秀硕士学位论文全文数据库 (信息科技辑)》;I138-550 *
用WordVBA解决软件测试用例自动生成问题;沈小仑;《电脑知识与应用》;61-62 *

Also Published As

Publication number Publication date
CN113282498A (en) 2021-08-20

Similar Documents

Publication Publication Date Title
CN113282498B (en) Method, device, equipment and storage medium for generating test cases
CN109710508B (en) Test method, test device, test apparatus, and computer-readable storage medium
CN110109897A (en) Database script generation method, device, computer equipment and storage medium
CN113282513B (en) Interface test case generation method and device, computer equipment and storage medium
CN108710571B (en) Method and device for generating automatic test code
CN112328250B (en) User interface generation method and device, computer equipment and storage medium
CN112597028A (en) Method and device for displaying case test result and readable storage medium
CN111522741B (en) Interface test code generation method and device, electronic equipment and readable storage medium
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
WO2021196674A1 (en) System code testing method and apparatus, and computer device and storage medium
CN112597016A (en) Recording method, device and equipment of automatic test script and storage medium
CN113126955A (en) Random data generation method and device, intelligent terminal and storage medium
CN110704252B (en) Automatic testing device and testing method based on cloud dynamic management
CN115563008A (en) Code coverage rate detection system, method, device and storage medium
CN115828856A (en) Test paper generation method, device, equipment and storage medium
CN113177392B (en) Method for synchronizing row segment information in proofreading interface, computing device and storage medium
CN113515443A (en) Multi-language automatic checking method, device, computer equipment and storage medium
US10915682B1 (en) Remodeling testing method for remodeling text-based display design to thereby achieve graphic-based display design and design remodeling testing device using the same
CN113886262A (en) Software automation test method and device, computer equipment and storage medium
CN113792017A (en) Method and system for checking template content imported into excel
CN115017872B (en) Method and device for intelligently labeling table in PDF file and electronic equipment
CN112148581A (en) Code specification checking method, device, system and storage medium
CN111078574A (en) Method and device for generating influence analysis report
CN113033149B (en) User story document quality inspection method, device, equipment and storage medium
CN110795931A (en) Method and terminal for detecting WEB website page language

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
TA01 Transfer of patent application right

Effective date of registration: 20211104

Address after: 518000 1601 (unit 18), Qianhai free trade building, 3048 Xinghai Avenue, Nanshan street, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong Province

Applicant after: Shenzhen saiante Technology Service Co.,Ltd.

Address before: 1-34 / F, Qianhai free trade building, 3048 Xinghai Avenue, Mawan, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong 518000

Applicant before: Ping An International Smart City Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant