CN116662165A - Test case generation method and device - Google Patents
Test case generation method and device Download PDFInfo
- Publication number
- CN116662165A CN116662165A CN202310557984.2A CN202310557984A CN116662165A CN 116662165 A CN116662165 A CN 116662165A CN 202310557984 A CN202310557984 A CN 202310557984A CN 116662165 A CN116662165 A CN 116662165A
- Authority
- CN
- China
- Prior art keywords
- input
- test
- test case
- classification column
- generating
- 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.)
- Pending
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 257
- 238000000034 method Methods 0.000 title claims abstract description 60
- 238000010586 diagram Methods 0.000 claims abstract description 24
- 238000013507 mapping Methods 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 7
- 230000006870 function Effects 0.000 abstract description 56
- 238000000605 extraction Methods 0.000 abstract 1
- 238000004891 communication Methods 0.000 description 5
- 238000013461 design Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000004044 response Effects 0.000 description 3
- 230000007547 defect Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000009825 accumulation Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012812 general test Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000013515 script Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000009469 supplementation Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Stored Programmes (AREA)
Abstract
The application relates to the field of code testing, in particular to a test case generation method and a device, wherein the method comprises the following steps: dividing according to the function category of the test case to obtain a function label; for each function label, dividing the type of the content to be input into a plurality of first-level classification columns; presetting an input mode of the content to be input, and dividing the input mode into two-stage classification columns; setting input attributes for each secondary classification column respectively, and generating test case key points; generating a generation specification form of the test case, generating a test key point mind map, extracting the mind map and generating test requirement key points in the specification form, and generating the test case. The application classifies the test functions into different categories, and inducts the corresponding test case generation specifications, thereby avoiding missing points when different test person cases are designed; automatically generating a test key point thinking guide graph template, so as to be convenient for carrying out to-be-tested demand analysis and key point extraction; and generating a standard according to the thinking guide diagram and the test case, automatically generating the test case, and improving the test efficiency.
Description
Technical Field
The present application relates to the field of code testing, and in particular, to a method and apparatus for generating test cases.
Background
With the continuous development of internet technology, the software is larger and larger in scale and complex in structure in the software development process, and the field of software application is continuously expanded, so that the test of a software system is more difficult and complex. To test for repeated single operations in some software in batches and to reduce human error due to the tedious repeated work in manual testing, automated testing is often employed. The Test Case refers to the description of a specific software product for testing tasks, and the Test scheme, method, technology and strategy are embodied. The content of the test case comprises a test target, a test environment, input data, test steps, expected results, test scripts and the like, and finally a document is formed. Briefly, a test case is a set of test inputs, execution conditions, and expected results tailored for a particular goal to verify that a particular software requirement is met.
At present, the general test case generation method is to directly write an excel version test case manually, or write test points by using a mind map, and then expand and generate the test case in the excel based on the mind map, which has the following defects:
1) The test cases are designed and written manually, so that the workload is high and the time consumption is long;
2) Different testers have different habits and emphasis on designing test cases, and the problem that the coverage of the written cases is incomplete exists;
3) The efficiency of writing test cases is low, and the test cases which meet the requirements and are fully covered are difficult to generate in batches.
Disclosure of Invention
The application provides a test case generation method and device, which are used for solving the defects of large workload and long time consumption in the manual design and writing of test cases in the prior art, improving the efficiency of writing the test cases, and generating the test cases which meet the requirements and are comprehensive in coverage in batches.
The test case generation method provided by the application comprises the following steps:
dividing according to the function category of the test case to obtain a plurality of function labels;
for each function label, dividing the type of the content to be input into a plurality of first-level classification columns;
defining different mouse click events for each first-level classification column, presetting an input mode of the content to be input, and dividing each different input mode into second-level classification columns;
setting input attributes for each secondary classification column respectively, and generating corresponding test case points based on the input attributes;
generating a generation specification form of the test case based on the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point;
based on the generated specification form, sequentially establishing a step-by-step mapping relation of the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point, and generating a test key point thinking guide diagram;
and extracting the test essential thinking guide diagram and the test requirement essential in the generated specification form to generate a test case.
According to the test case generation method provided by the application, the function label comprises the steps of adding, editing, inquiring and uploading.
According to the test case generation method provided by the application, the input mode of the secondary classification column comprises an input box, a drop-down box, a radio selection box, a check box and a button.
According to the test case generation method provided by the application, if the input mode of the secondary classification column is an input box, the input attribute comprises a non-null input format and an input character type, the content input in the input box is extracted, and whether the input requirement of the input attribute is met is judged;
if the input mode of the secondary classification column is a drop-down box, the input attribute comprises empty set judgment, default values, a plurality of options, whether multiple options are selected or not, whether a typing event is established or not, and a mouse clicking event of the drop-down box is established based on the input attribute;
if the input mode of the secondary classification column is a single selection box, the input attribute comprises empty set judgment, a default value and a plurality of options;
if the input mode of the secondary classification column is a check box, the input attribute comprises empty set judgment, number selection and a plurality of options;
and if the input mode of the secondary classification column is button, the input attribute is click, and a mouse click event is established based on the input attribute.
According to the test case generation method provided by the application, the generation specification form sequentially comprises five columns of elements: the function label, the primary classification column, the secondary classification column, the input attribute and the test case point;
wherein each functional label corresponds to at least one first-level classification column, and each first-level classification column is positioned in a different row; each primary classification column corresponds to at least one secondary classification column, and each secondary classification column is located in a different row; each secondary classification column corresponds to at least one input attribute column, and each input attribute column is positioned in a different row;
each input attribute column corresponds to one test case point.
According to the test case generation method provided by the application, based on the generation specification form, step-by-step mapping relations among the function label, the primary classification column, the secondary classification column, the input attribute and the test case point are sequentially established, and a test point thinking diagram is generated, and the method comprises the following steps:
the test key point thinking guide graph sequentially comprises a first-level node, a second-level node, a third-level node, a fourth-level node, a fifth-level node, a sixth-level node and a seventh-level node;
the method comprises the steps of extracting a test requirement name of an item to be tested as the primary node;
extracting functional points to be tested in the items to be tested according to the functional labels in the generated specification form, classifying the functional points, taking the functional labels corresponding to the classified functional points as the secondary nodes, and taking the functional names corresponding to the functional labels as the tertiary nodes;
according to the secondary classification column in the generation specification form, extracting each input mode of a corresponding secondary node in the item to be tested as the four-level node;
the five-level node is an input element name corresponding to the input mode selected based on the four-level node;
extracting the input attribute requirement of each functional point in the item to be tested according to the input attribute in the generated specification form, and taking the input attribute requirement as the six-level node;
and respectively filling the attribute requirements and the limiting conditions corresponding to the input elements of each functional point in the item to be tested into the seven-level nodes.
According to the test case generation method provided by the application, the test essential thinking guide graph and the test requirement essential in the generation specification form are extracted to generate the test case, and the test case generation method comprises the following steps:
extracting the demand name of a primary node in the test key point thinking guide graph;
writing the content of the test case, including case numbers, function modules, sub-function points, case titles, case types, preconditions, test steps and expected results;
and circularly writing the content of the test case, wherein the content comprises:
circularly traversing the function names of all three-level nodes in the test key point thinking guide graph;
for each functional point, circularly traversing the input element names of all five-level nodes of the corresponding functional point in the test key point thinking guide graph;
for each input element, acquiring a four-level node corresponding to the input element in the test point thinking guide graph, acquiring a secondary classification column corresponding to the generation specification form, and circularly traversing all input attributes of the secondary classification column in the generation specification form;
and circularly traversing the test case points in the generated standard form, and dividing the test case points through separators.
According to the test case generation method provided by the application, if any test case point comprises a variable, elements in seven-level nodes in the test point thinking guide graph are circularly traversed, the extracted elements are segmented through separators, the value corresponding to each element is obtained, and each element is traversed and the corresponding variable is replaced.
On the other hand, the application also provides a test case generating device which comprises a rule input module, a template generating module and a case generating module;
the rule input module is used for acquiring and generating a standard form; the generating step of the generation specification form comprises the following steps:
dividing according to the function category of the test case to obtain a plurality of function labels;
for each function label, dividing the type of the content to be input into a plurality of first-level classification columns;
defining different mouse click events for each first-level classification column, presetting an input mode of the content to be input, and dividing each different input mode into second-level classification columns;
setting input attributes for each secondary classification column respectively, and generating corresponding test case points based on the input attributes;
generating a generation specification form of the test case based on the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point;
the template generation module is used for sequentially establishing a step-by-step mapping relation among the function label, the primary classification column, the secondary classification column, the input attribute and the test case point based on the generation specification form to generate a test point thinking guide diagram;
the use case generation module is used for extracting the test essential thinking guide graph and the test requirement essential in the generation specification form to generate a test use case.
The present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the test case generating method as described in any of the above.
The test case generation method and device provided by the application have at least the following technical effects:
(1) According to the application, all test functions are divided into different categories, corresponding test case generation specifications are summarized according to the function categories and the characteristics thereof, and the accumulation is continuously optimized, so that the missing of key points in the process of designing different test person cases is avoided.
(2) According to the application, the test key point mind map template can be automatically generated according to the test case generation specification, and according to the mind map template, a tester can conveniently and rapidly analyze the requirement to be tested and extract the key points.
(3) According to the application, the test cases are automatically generated according to the test key point thought map extracted by the tester and the set test case generation specification, so that the test efficiency is improved.
Drawings
In order to more clearly illustrate the application or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a test case generation method provided by the application;
FIG. 2 is a schematic diagram of a test gist mind map of the test case generating method provided by the application;
FIG. 3 is a diagram showing the schematic diagram of the test point mind map of the test case generating method according to the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms "comprising" and "having" and any variations thereof in the description and claims of the application and in the foregoing drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or modules is not limited to only those steps or modules but may include other steps or modules not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the term "first/second" related to the present application is merely to distinguish similar objects, and does not represent a specific order for the objects, and it should be understood that "first/second" may interchange a specific order or precedence where allowed. It is to be understood that the "first\second" distinguishing aspects may be interchanged where appropriate to enable embodiments of the application described herein to be implemented in sequences other than those described or illustrated herein.
It should be noted that the test case mainly includes four contents: the purposes of setting the test cases are to make the implementation focus of the software test outstanding and the purpose clear, and the test cases are designed before the implementation of the test is started, so that blind test can be avoided and the test efficiency can be improved.
As shown in fig. 1, a test case generating method according to the present application includes:
dividing according to the function category of the test case to obtain a plurality of function labels;
for each function label, dividing the type of the content to be input into a plurality of first-level classification columns;
defining different mouse click events for each first-level classification column, presetting an input mode of the content to be input, and dividing each different input mode into second-level classification columns;
setting input attributes for each secondary classification column respectively, and generating corresponding test case points based on the input attributes;
generating a generation specification form of the test case based on the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point;
based on the generated specification form, sequentially establishing a step-by-step mapping relation of the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point, and generating a test key point thinking guide diagram;
and extracting the test essential thinking guide diagram and the test requirement essential in the generated specification form to generate a test case.
According to the test case generation method provided by the application, the function label comprises the steps of adding, editing, inquiring and uploading.
According to the test case generation method provided by the application, the input mode of the secondary classification column comprises an input box, a drop-down box, a radio selection box, a check box and a button.
According to the test case generation method provided by the application, if the input mode of the secondary classification column is an input box, the input attribute comprises a non-null input format and an input character type, the content input in the input box is extracted, and whether the input requirement of the input attribute is met is judged;
if the input mode of the secondary classification column is a drop-down box, the input attribute comprises empty set judgment, default values, a plurality of options, whether multiple options are selected or not, whether a typing event is established or not, and a mouse clicking event of the drop-down box is established based on the input attribute;
if the input mode of the secondary classification column is a single selection box, the input attribute comprises empty set judgment, a default value and a plurality of options;
if the input mode of the secondary classification column is a check box, the input attribute comprises empty set judgment, number selection and a plurality of options;
and if the input mode of the secondary classification column is button, the input attribute is click, and a mouse click event is established based on the input attribute.
According to the test case generation method provided by the application, the generation specification form sequentially comprises five columns of elements: the function label, the primary classification column, the secondary classification column, the input attribute and the test case point;
wherein each functional label corresponds to at least one first-level classification column, and each first-level classification column is positioned in a different row; each primary classification column corresponds to at least one secondary classification column, and each secondary classification column is located in a different row; each secondary classification column corresponds to at least one input attribute column, and each input attribute column is positioned in a different row;
each input attribute column corresponds to one test case point.
Specifically, in the generation specification form, each function category occupies one form page, the function name is the form name, and each form page comprises a function type, a first-level classification, a second-level classification, an input attribute, and 5 columns of test case points, namely the function label, the first-level classification column, the second-level classification column, the input attribute and the test case point;
the function type is listed as the function type of the current form page;
the first-level classification list is the direction class when the function type designs the test case, and each first-level classification occupies different rows;
the secondary classification column is used for carrying out classification expansion aiming at different primary classifications, and each secondary classification occupies different rows;
the input attribute column is used for aiming at different first-stage and second-stage classifications, and each requirement key point occupies different rows in different design directions when the test case is designed;
the test case main point column is used for listing all test case main points of the input attribute according to the case design methods such as equivalence class, boundary value and the like aiming at different primary and secondary classifications and corresponding input attributes, and all the test case main points corresponding to each input attribute are placed in a cell and separated by Chinese pause numbers or other separators;
taking the function category as "newly added" as an example, generating a name of the form page in the standard form as "newly added", and hereinafter, simply adding the new page, wherein each column of the new page comprises the following contents:
the function type column is 'newly added';
first-order classification column: the method comprises two types of elements and functional classes;
the secondary classification column: when the primary classification is "element", the secondary classification includes "input box", "drop-down box", "radio box", "check box", "button"; when the primary class is classified as a 'functional class', the secondary class is classified as null;
the input attribute column includes: when the secondary classification is an 'input box', the input attributes comprise 'must fill', 'format', 'length', 'size'; when the secondary classification is "drop-down box", the input attribute comprises "must fill", "option", "default", "whether to select more", "whether to input", "drop-down box linkage"; when the secondary classification is "single selection box", the input attribute comprises "necessary filling", "option", "default value"; when the secondary classification is "check box", the input attribute includes "must fill", "option", "select multiple"; when the secondary classification is "button", the input attribute includes "click"; when the primary class is classified as "functional class", the input attributes include "commit parameter", "uniqueness check", "response time".
The test case main point column includes: when the input attribute is 'must fill', the main point content of the test case is 'empty and not empty', namely whether the filled content is an empty set is judged, and if the necessary filling is required, the filled content can be identified to be empty or not empty;
when the input attribute is 'format', the key point content of the test case is 'number, letter, chinese, special character, space and line feed';
when the input attribute is 'length', the main point content of the test case is 'less than min, equal to min, greater than min and less than max, equal to max and greater than max', wherein min represents the minimum value of the variable, and max represents the maximum value of the variable;
when the input attribute is 'size', the key point content of the test case is 'less than min, equal to min, greater than min and less than max, equal to max and greater than max', wherein min represents the minimum value of the variable, and max represents the maximum value of the variable;
when the input attribute is 'option', the content of the test case point is 'select each option value X', wherein X represents each specific option value of the variable;
when the input attribute is 'default', the content of the test case point is 'automatic selection default'
When the input attribute is 'multi-choice', the main point content of the test case is 'choose 2, choose max-1, choose max', wherein max represents the variable option number;
when the input attribute is 'whether the input can be performed', the main point content of the test case is 'automatic association during input, input of a value of compliance and input of a value of non-compliance';
when the input attribute is 'pull-down frame linkage', the key point content of the test case is 'linkage pull-down frame option corresponding change';
when the input attribute is 'click', the main point content of the test case is 'click skip, click button return after skip, click browser/system return after skip';
when the input attribute is 'submit parameter', the key content of the test case is 'submit all necessary filling items, submit all necessary filling items and all unnecessary filling items';
when the input attribute is 'uniqueness check', the main point content of the test case is 'newly-added non-existing data and newly-added existing data';
when the input attribute is 'response time', the key content of the test case is 'within 3 seconds of response time';
the generation specification form taking the function type column as "new" as an example is exemplified by the following table:
the above is a further example of the application and should not be taken as a further limitation of the application;
according to the test case generation method provided by the application, based on the generation specification form, step-by-step mapping relations among the function label, the primary classification column, the secondary classification column, the input attribute and the test case point are sequentially established, and a test point thinking diagram is generated, specifically, the test point thinking diagram is shown in fig. 2-3, and comprises the following steps:
the test key point thinking guide graph sequentially comprises a first-level node, a second-level node, a third-level node, a fourth-level node, a fifth-level node, a sixth-level node and a seventh-level node;
the method comprises the steps of extracting a test requirement name of an item to be tested as the primary node;
extracting functional points to be tested in the items to be tested according to the functional labels in the generated specification form, classifying the functional points, taking the functional labels corresponding to the classified functional points as the secondary nodes, and adding brackets in a Chinese format, wherein the brackets comprise a 'new' type, a 'edit' type, a 'query' type, a 'delete' type and a 'file upload' type; taking the function name corresponding to the function label as the three-level node;
according to the secondary classification column in the generation specification form, extracting each input mode of a corresponding secondary node in the item to be tested as the four-level node; if the second-level node is "[ newly added ]," [ dropdown box ], "[ single selection box ]," [ check box ], "[ button ],", if the second-level node is "input box", "[ drop-down box", "[ single selection box", "[ check box", "[ single button", and if the second-level classification of a certain function class is empty in the generated specification form, the second-level classification is not four-level node in the thinking diagram;
the five-level node is an input element name corresponding to the input mode selected based on the four-level node;
extracting the input attribute requirement of each functional point in the item to be tested according to the input attribute in the generated specification form, and taking the input attribute requirement as the six-level node; if the second-level node is "[ newly increased ] and the fourth-level node is" [ input box ], "[ necessary filling ]," [ format ], "[ length ]," [ size ] ", corresponding six-level nodes are" [ necessary filling ];
based on attribute requirements and limiting conditions corresponding to input elements of each functional point in the item to be tested, respectively filling the attribute requirements and limiting conditions into the seven-level nodes;
according to the test case generation method provided by the application, the test essential thinking guide graph and the test requirement essential in the generation specification form are extracted to generate the test case, and the test case generation method comprises the following steps:
extracting the demand name of a primary node in the test key point thinking guide graph;
writing the content of the test case, including case numbers, function modules, sub-function points, case titles, case types, preconditions, test steps and expected results;
and circularly writing the content of the test case, wherein the content comprises:
circularly traversing the function names of all three-level nodes in the test key point thinking guide graph;
for each functional point, circularly traversing the input element names of all five-level nodes of the corresponding functional point in the test key point thinking guide graph;
for each input element, acquiring a four-level node corresponding to the input element in the test point thinking guide graph, acquiring a secondary classification column corresponding to the generation specification form, and circularly traversing all input attributes of the secondary classification column in the generation specification form;
and circularly traversing the test case points in the generated standard form, and dividing the test case points through separators.
According to the test case generation method provided by the application, if any test case point comprises a variable, circularly traversing elements in seven-level nodes in the test point thinking guide graph, dividing the extracted elements through separators to obtain a value corresponding to each element, traversing each element and replacing the corresponding variable;
by way of example, the step of generating test cases includes:
1. the case number column is automatically generated, the generation format is 01.001, the front 01 represents the sequence number of the function point, the sequence number of the same function point is the same, and each next function point is automatically increased; the rear 001 represents the number of the current function point test case, each time the next case is automatically increased, the number of the previous function point is automatically reset to 001 after the serial number of the previous function point is changed;
2. the functional module is listed as the demand name of the primary node in the test key point thinking guide diagram;
3. the sub-functional point columns are the functional point names of three-level nodes in the test key point thinking guide diagram;
4. the example title is listed as the function point name of the three-level node in the test key point thinking guide diagram, the element name of the five-level node is spliced, the input attribute of the element type in the generated standard form file is spliced, the test key point corresponding to the input attribute is spliced, and the middle is connected by a short horizontal line, such as 'newly added common user-name-necessary filling-not being empty'; in the case title column, if a certain test case main point contains variable names min and max, replacing the variable names with numbers in the extracted main point values in the corresponding seven-level nodes in the test main point thinking guide diagram; if the length of the input frame name is 1-10 in the test key point thinking guide diagram, replacing min with 1 and replacing max with 10;
5. the case types are listed as positive cases or negative cases, and the judgment rule comprises the following points:
1) When the input attribute in the generated standard form file is "must fill", extracting the value of seven-level nodes corresponding to six-level nodes [ must fill ] in the test key point thinking guide diagram, and if the value is "must fill", the value of "not empty" in the test case key point is a positive case, and the value of "empty" is a negative case; if the filling is not necessary, the filling is not empty and the filling is empty;
2) When the input attribute in the generated standard form file contains a format, extracting the value of a seven-level node corresponding to a six-level node in the test key point thinking guide diagram and storing the value as a list, wherein the value in the list in the test case key point is a positive case, and the value in the list is a negative case;
3) When the input attribute in the generated standard form file contains length or size, the test case points are positive cases, and the test case points are opposite cases, wherein the test case points are equal to min, more than min and less than max, and the test case points are opposite cases;
4) Other use cases which are not specially judged are default to positive cases;
6. the precondition is listed as empty, and the precondition is to be supplemented by the subsequent testers;
7. the test step is empty and is to be supplemented by the subsequent test personnel;
8. the expected results are listed as empty for later tester supplementation.
Through the steps, the application can automatically generate the test cases according to the test key point thought map extracted by the tester and the established test case generation specification, and improves the test efficiency.
On the other hand, the application also provides a test case generating device which comprises a rule input module, a template generating module and a case generating module;
the rule input module is used for acquiring and generating a standard form; the generating step of the generation specification form comprises the following steps:
dividing according to the function category of the test case to obtain a plurality of function labels;
for each function label, dividing the type of the content to be input into a plurality of first-level classification columns;
defining different mouse click events for each first-level classification column, presetting an input mode of the content to be input, and dividing each different input mode into second-level classification columns;
setting input attributes for each secondary classification column respectively, and generating corresponding test case points based on the input attributes;
generating a generation specification form of the test case based on the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point;
the template generation module is used for sequentially establishing a step-by-step mapping relation among the function label, the primary classification column, the secondary classification column, the input attribute and the test case point based on the generation specification form to generate a test point thinking guide diagram;
the use case generation module is used for extracting the test essential thinking guide graph and the test requirement essential in the generation specification form to generate a test use case.
The present application also provides an electronic device, which may include: a processor (processor), a communication interface (Communications Interface), a memory (memory) and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The processor may call logic instructions in memory to perform the steps of the test case generation method provided by the methods described above.
Further, the logic instructions in the memory described above may be implemented in the form of software functional units and stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present application also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, are capable of executing the steps of the test case generation method provided by the methods described above.
In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the steps of the test case generation method provided by the methods described above.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present application without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims (10)
1. A test case generation method, comprising:
dividing according to the function category of the test case to obtain a plurality of function labels;
for each function label, dividing the type of the content to be input into a plurality of first-level classification columns;
defining different mouse click events for each first-level classification column, presetting an input mode of the content to be input, and dividing each different input mode into second-level classification columns;
setting input attributes for each secondary classification column respectively, and generating corresponding test case points based on the input attributes;
generating a generation specification form of the test case based on the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point;
based on the generated specification form, sequentially establishing a step-by-step mapping relation of the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point, and generating a test key point thinking guide diagram;
and extracting the test essential thinking guide diagram and the test requirement essential in the generated specification form to generate a test case.
2. The method for generating test cases according to claim 1, wherein the function label comprises adding, editing, inquiring and uploading.
3. The test case generating method according to claim 1, wherein the input mode of the secondary classification column includes an input box, a drop-down box, a radio box, a check box, and a button.
4. The test case generating method according to claim 3, wherein if the input mode of the secondary classification column is an input box, the input attribute includes not null, input format, input character type, the content input in the input box is extracted, and whether the input requirement of the input attribute is met is judged;
if the input mode of the secondary classification column is a drop-down box, the input attribute comprises empty set judgment, default values, a plurality of options, whether multiple options are selected or not, whether a typing event is established or not, and a mouse clicking event of the drop-down box is established based on the input attribute;
if the input mode of the secondary classification column is a single selection box, the input attribute comprises empty set judgment, a default value and a plurality of options;
if the input mode of the secondary classification column is a check box, the input attribute comprises empty set judgment, number selection and a plurality of options;
and if the input mode of the secondary classification column is button, the input attribute is click, and a mouse click event is established based on the input attribute.
5. The test case generating method according to any one of claims 1 to 4, wherein the generating specification form sequentially includes five columns of elements: the function label, the primary classification column, the secondary classification column, the input attribute and the test case point;
wherein each functional label corresponds to at least one first-level classification column, and each first-level classification column is positioned in a different row; each primary classification column corresponds to at least one secondary classification column, and each secondary classification column is located in a different row; each secondary classification column corresponds to at least one input attribute column, and each input attribute column is positioned in a different row;
each input attribute column corresponds to one test case point.
6. The method of claim 5, wherein creating a test point mind map based on the generated specification form sequentially creates a stepwise mapping relationship of the function label, the primary classification column, the secondary classification column, the input attribute, and the test point, comprising:
the test key point thinking guide graph sequentially comprises a first-level node, a second-level node, a third-level node, a fourth-level node, a fifth-level node, a sixth-level node and a seventh-level node;
the method comprises the steps of extracting a test requirement name of an item to be tested as the primary node;
extracting functional points to be tested in the items to be tested according to the functional labels in the generated specification form, classifying the functional points, taking the functional labels corresponding to the classified functional points as the secondary nodes, and taking the functional names corresponding to the functional labels as the tertiary nodes;
according to the secondary classification column in the generation specification form, extracting each input mode of a corresponding secondary node in the item to be tested as the four-level node;
the five-level node is an input element name corresponding to the input mode selected based on the four-level node;
extracting the input attribute requirement of each functional point in the item to be tested according to the input attribute in the generated specification form, and taking the input attribute requirement as the six-level node;
and respectively filling the attribute requirements and the limiting conditions corresponding to the input elements of each functional point in the item to be tested into the seven-level nodes.
7. The test case generation method according to claim 6, wherein the steps of extracting the test gist mind map and the test requirement gist in the generation specification form to generate the test case include:
extracting the demand name of a primary node in the test key point thinking guide graph;
writing the content of the test case, including case numbers, function modules, sub-function points, case titles, case types, preconditions, test steps and expected results;
and circularly writing the content of the test case, wherein the content comprises:
circularly traversing the function names of all three-level nodes in the test key point thinking guide graph;
for each functional point, circularly traversing the input element names of all five-level nodes of the corresponding functional point in the test key point thinking guide graph;
for each input element, acquiring a four-level node corresponding to the input element in the test point thinking guide graph, acquiring a secondary classification column corresponding to the generation specification form, and circularly traversing all input attributes of the secondary classification column in the generation specification form;
and circularly traversing the test case points in the generated standard form, and dividing the test case points through separators.
8. The method for generating test cases according to claim 7, wherein if any of the test case points includes a variable, elements in seven-level nodes in the test point mind map are circularly traversed, the extracted elements are divided by separators to obtain a value corresponding to each element, and each element is traversed and the corresponding variable is replaced.
9. The test case generating device is characterized by comprising a rule input module, a template generating module and a case generating module;
the rule input module is used for acquiring and generating a standard form; the generating step of the generation specification form comprises the following steps:
dividing according to the function category of the test case to obtain a plurality of function labels;
for each function label, dividing the type of the content to be input into a plurality of first-level classification columns;
defining different mouse click events for each first-level classification column, presetting an input mode of the content to be input, and dividing each different input mode into second-level classification columns;
setting input attributes for each secondary classification column respectively, and generating corresponding test case points based on the input attributes;
generating a generation specification form of the test case based on the function label, the primary classification column, the secondary classification column, the input attribute and the test case key point;
the template generation module is used for sequentially establishing a step-by-step mapping relation among the function label, the primary classification column, the secondary classification column, the input attribute and the test case point based on the generation specification form to generate a test point thinking guide diagram;
the use case generation module is used for extracting the test essential thinking guide graph and the test requirement essential in the generation specification form to generate a test use case.
10. A non-transitory computer readable storage medium having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the test case generating method according to any of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310557984.2A CN116662165A (en) | 2023-05-15 | 2023-05-15 | Test case generation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310557984.2A CN116662165A (en) | 2023-05-15 | 2023-05-15 | Test case generation method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116662165A true CN116662165A (en) | 2023-08-29 |
Family
ID=87716342
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310557984.2A Pending CN116662165A (en) | 2023-05-15 | 2023-05-15 | Test case generation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116662165A (en) |
-
2023
- 2023-05-15 CN CN202310557984.2A patent/CN116662165A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107341102B (en) | Test case file generation method and device | |
CN112328489B (en) | Test case generation method and device, terminal equipment and storage medium | |
CN104679658A (en) | Test method and test system for WEB pages | |
CN105095067A (en) | User interface element object identification and automatic test method and apparatus | |
CN105354239A (en) | Configuration data processing model based processing center data stream processing method | |
CN111259627A (en) | Document analysis method and device, computer storage medium and equipment | |
CN110705226A (en) | Spreadsheet creating method and device and computer equipment | |
CN109508448A (en) | Short information method, medium, device are generated based on long article and calculate equipment | |
CN111191429A (en) | System and method for automatic filling of data table | |
CN114818643A (en) | Log template extraction method for reserving specific service information | |
CN115576834A (en) | Software test multiplexing method, system, terminal and medium for supporting fault recovery | |
CN113553268A (en) | AI intelligent software testing method | |
CN117194255A (en) | Test data maintenance method, device, equipment and storage medium | |
CN117216092A (en) | Method, device and equipment for optimizing TDSQL script and readable storage medium | |
CN116662165A (en) | Test case generation method and device | |
CN113628077B (en) | Method, terminal and readable storage medium for generating non-repeated questions | |
CN115774971A (en) | Automatic checking method of terminal row wiring diagram based on CAD (computer-aided design) diagram identification technology | |
CN112783775A (en) | Special character input testing method and device | |
CN113722213A (en) | Automated testing method and computer-readable storage medium | |
CN113515588A (en) | Form data detection method, computer device and storage medium | |
CN114579752B (en) | Feature importance-based long text classification method and device and computer equipment | |
CN117952022B (en) | Yield multi-dimensional interactive system, method, computer equipment and storage medium | |
CN118503715B (en) | Text expansion method, apparatus, storage medium and computer program product | |
CN116757203B (en) | Natural language matching method, device, computer equipment and storage medium | |
CN115544985B (en) | Statistical chart making method, device, equipment and medium based on geographic computing 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 |