CN115437962A - Test case generation method, device, equipment and storage medium - Google Patents

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

Info

Publication number
CN115437962A
CN115437962A CN202211286562.8A CN202211286562A CN115437962A CN 115437962 A CN115437962 A CN 115437962A CN 202211286562 A CN202211286562 A CN 202211286562A CN 115437962 A CN115437962 A CN 115437962A
Authority
CN
China
Prior art keywords
test
item
list
rule
tested
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
Application number
CN202211286562.8A
Other languages
Chinese (zh)
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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202211286562.8A priority Critical patent/CN115437962A/en
Publication of CN115437962A publication Critical patent/CN115437962A/en
Pending legal-status Critical Current

Links

Images

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/368Test management for test version control, e.g. updating test cases to a new software version
    • 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/3692Test management for test results 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)

Abstract

The invention discloses a method, a device, equipment and a storage medium for generating a test case, wherein the method comprises the following steps: determining a test item list according to the test requirement, wherein each line of the test item list corresponds to one test record; extracting a to-be-tested item in the test records aiming at each test record in the test item list; searching a given test rule list according to the item to be tested, and determining a target rule in the test rule list; and combining the item to be tested with the target rule to generate a test case. According to the method for generating the test case, the quality variation of the business safety test caused by the subjective ability difference of the testers is avoided by setting the automatic generation mode of the test case, and the test quality is ensured while the test case generation efficiency is improved.

Description

Test case generation method, device, equipment and storage medium
Technical Field
The present invention relates to the field of software technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a test case.
Background
The safety requirement is a target requirement for providing foundation for application safety from different aspects aiming at external supervision and in-line safety specification requirements. Generally, a product manager role needs to develop functional safety requirements according to business characteristics, develop and output a safety requirement checklist, and testers carry out business safety tests according to the safety requirements marked as inclusion requirements in the safety requirement checklist. The test case refers to the description of the test task for the specific software requirement, and comprises the following steps: test case number, test case description, case priority, steps, expected results, and the like.
The existing test case compiling mainly depends on the subjective ability and test experience of testers, so that the quality of test cases compiled by different people is different, and the system quality is difficult to ensure; in addition, a test guidance method is provided for each service safety requirement in the safety requirement inspection sheet in the service safety test guide, testers only need to test the safety requirement for bringing the requirements into the safety requirement inspection sheet, and a guidance method for manually finding the safety requirement for bringing the requirements into the service safety test guide is low in efficiency; thirdly, the service safety test guide is continuously updated, and it is difficult to uniformly notify each tester of updating the documents in hand at the time of updating, so that many testers still hold the old version of the service safety test guide to guide the safety test, and the test quality is difficult to be guaranteed.
Disclosure of Invention
The invention provides a method, a device, equipment and a storage medium for generating a test case, which are used for realizing the automatic generation of the test case.
According to an aspect of the present invention, a method for generating a test case is provided, including:
determining a test item list according to test requirements, wherein each line of the test item list corresponds to one test record;
extracting a to-be-tested item in the test record aiming at each test record in the test item list;
searching a given test rule list according to the item to be tested, and determining a target rule in the test rule list;
and combining the item to be tested with the target rule to generate the test case.
Further, determining a test item list according to the test requirement includes:
acquiring an original safety requirement inspection list;
and extracting target rows corresponding to the test requirements in the safety requirement checking list, and forming the target rows into the test item list.
Further, the test rule list is continuously updated according to a set frequency.
Further, searching a given test rule list according to the item to be tested, and determining a target rule in the test rule list, wherein the steps of:
performing word segmentation processing on the item to be detected to obtain a word segmentation set;
searching a corresponding rule sentence in the test rule list aiming at each participle in the participle set;
and determining a set of rule sentences corresponding to the participles as the target rules.
Further, performing word segmentation processing on the item to be tested to obtain a word segmentation set, including:
determining a word segmentation dictionary according to the test rule list, wherein the word segmentation dictionary comprises a plurality of entries;
matching the item to be tested in the word segmentation dictionary to obtain a successfully matched entry set;
and denoising the successfully matched entry set to obtain the word segmentation set.
Further, the test item list includes a test requirement sequence and a safety requirement sequence, and correspondingly, the items to be tested in the test record include test requirement items and safety requirement items.
Further, the test rule list includes a test method example sequence and an expected result sequence, the target rule includes at least one row in the test rule list, and the combining the item to be tested and the target rule generates the test case, including:
extracting test method example items and expected result items in the target rule;
taking the safety requirement item as a test case description, taking the test method example item as a test case step, taking the expected result item as a test case expected result, combining the test case description, the test case step and the test case expected result with the corresponding test requirement item, and adding the combination into a blank test case table;
and determining the blank test case table after the addition as the test case.
According to another aspect of the present invention, there is provided a test case generation apparatus, including:
the test item list determining module is used for determining a test item list according to test requirements, wherein each line of the test item list corresponds to one test record;
the to-be-tested item extraction module is used for extracting to-be-tested items in the test records aiming at each test record in the test item list;
the target rule determining module is used for searching a given test rule list according to the item to be tested and determining a target rule in the test rule list;
and the test case generation module is used for combining the item to be tested with the target rule to generate the test case.
Optionally, the test item list determining module is further configured to:
acquiring an original safety requirement inspection list;
and extracting target rows corresponding to the test requirements in the safety requirement checking list, and forming the target rows into the test item list.
Optionally, the test rule list is continuously updated according to a set frequency.
Optionally, the target rule determining module is further configured to:
performing word segmentation processing on the item to be detected to obtain a word segmentation set;
searching a corresponding rule sentence in the test rule list aiming at each participle in the participle set;
and determining a set of rule sentences corresponding to the participles as the target rules.
Optionally, the target rule determining module is further configured to:
determining a word segmentation dictionary according to the test rule list, wherein the word segmentation dictionary comprises a plurality of entries;
matching the item to be tested in the word segmentation dictionary to obtain a successfully matched entry set;
and denoising the successfully matched entry set to obtain the word segmentation set.
Optionally, the test item list includes a test requirement sequence and a safety requirement sequence, and correspondingly, the items to be tested in the test record include test requirement items and safety requirement items.
Optionally, the test rule list includes a test method example sequence and an expected result sequence, the target rule includes at least one row in the test rule list, and the test case generation module is further configured to:
extracting test method example items and expected result items in the target rule;
taking the safety requirement item as a test case description, taking the test method example item as a test case step, taking the expected result item as a test case expected result, combining the test case description, the test case step and the test case expected result with the corresponding test requirement item, and adding the combination into a blank test case table;
and determining the blank test case table after the addition as the test case.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method for generating the test case according to any embodiment of the present invention.
According to another aspect of the present invention, a computer-readable storage medium is provided, where computer instructions are stored, and the computer instructions are used for causing a processor to implement the method for generating a test case according to any embodiment of the present invention when executed.
The embodiment of the invention discloses a method for generating a test case, which comprises the steps of firstly determining a test item list according to test requirements, wherein each line of the test item list corresponds to one test record; then, aiming at each test record in the test item list, extracting the item to be tested in the test record; searching a given test rule list according to the items to be tested, and determining a target rule in the test rule list; and finally, combining the item to be tested with the target rule to generate a test case. According to the method for generating the test case, the quality variation of the business safety test caused by the subjective ability difference of the testers is avoided by setting the automatic generation mode of the test case, and the test quality is ensured while the test case generation efficiency is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart of a method for generating a test case according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for generating a test case according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a test case generating device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device that implements the test case generation method according to the fourth embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of a method for generating a test case according to an embodiment of the present invention, where the method is applicable to a case where a test case is generated according to business security requirements, and the method may be executed by a test case generation device, where the test case generation device may be implemented in a form of hardware and/or software, and the test case generation device may be configured in an electronic device. As shown in fig. 1, the method includes:
and S110, determining a test item list according to the test requirement.
Wherein, each line of the test item list corresponds to a test record.
In the business safety test, the test requirement mainly solves the problem of 'what is tested', namely, the fact that what needs to be tested in the tested object is indicated. In this embodiment, the test item list is a list formed by items to be tested, which is determined according to the test requirements, each row in the list corresponds to one test record, and each test record may include contents such as an item number, a test requirement, and a security requirement.
In this embodiment, according to a test target of a specific software to be tested, a security requirement example, and the like corresponding to each test requirement may be determined and correspondingly filled in the test item list. Preferably, the column names of the columns in the test item list may include: serial number, test requirements, security requirement examples, and the like.
And S120, aiming at each test record in the test item list, extracting the item to be tested in the test record.
The items to be tested are each specific test item category and corresponding requirements. Preferably, test requirements and safety requirements may be included. The test requirement indicates a specific test item category of the test, and may be, for example, "user data security (network transmission)", "user data security (client presentation)", or the like; the security requirement may be "encrypted transmission of authentication information" or the like.
In this embodiment, in order to test each item to be tested, a mode of traversing the test item list may be adopted to extract the content of the item to be tested in each row in the test item list, that is, each test record.
S130, searching a given test rule list according to the item to be tested, and determining a target rule in the test rule list.
The test rule list is a specification of the test method, and specifically specifies a safety requirement, a test method example, an expected result, and the like corresponding to each item to be tested. The target rule is a record of safety requirements, test method examples, expected results and the like corresponding to the extracted items to be tested in the test rule list.
In this embodiment, after the item to be tested in each test record is extracted, the record related to the item to be tested can be searched in the test rule list correspondingly, and the set of records is used as the target rule.
And S140, combining the item to be tested with the target rule to generate a test case.
In this embodiment, after determining the target rule corresponding to each item to be tested, the item to be tested and the corresponding target rule may be combined in a set manner to serve as one record in the test case. And sequentially determining the combination of the item to be tested corresponding to each test record and the target rule in a mode of traversing the test item list until the traversal of the test item list is completed, wherein the set of all the combinations is the final test case.
The embodiment of the invention discloses a method for generating a test case, which comprises the steps of firstly determining a test item list according to test requirements, wherein each line of the test item list corresponds to one test record; then, aiming at each test record in the test item list, extracting the item to be tested in the test record; searching a given test rule list according to the items to be tested, and determining a target rule in the test rule list; and finally, combining the item to be tested with the target rule to generate a test case. According to the method for generating the test case, the quality variation of the business safety test caused by the subjective ability difference of the testers is avoided by setting the automatic generation mode of the test case, and the test quality is ensured while the test case generation efficiency is improved.
Example two
Fig. 2 is a flowchart of a method for generating a test case according to a second embodiment of the present invention, which is a refinement of the above embodiments. As shown in fig. 2, the method includes:
s210, obtaining an original safety requirement checking list.
The safety requirement checking sheet is a template for safety requirement development and evaluation in service safety test, and is updated once every half year in principle along with external supervision requirements and changes of actual current situation in line.
In this embodiment, to obtain the test item list, an original safety requirement checklist may be obtained first, and the test item list may be formed from contents required by the original safety requirement checklist.
S220, extracting target rows corresponding to the test requirements in the safety requirement checking list, and forming a test item list by the target rows.
Each line of the test item list corresponds to one test record.
In this embodiment, the original safety requirement checklist includes test requirements, and according to the test requirements, target rows corresponding to the test requirements can be extracted from the original safety requirement checklist and form a test item list. The test item list comprises a test requirement sequence and a safety requirement sequence, and correspondingly, the items to be tested in the test records comprise test requirement items and safety requirement items.
Optionally, the safety requirement inspection sheet corresponding to the test may be uploaded to a set website by a tester, and the safety requirement inspection sheet is downloaded and analyzed by acquiring the website. Through analysis, the rows meeting the test requirements can be extracted and stored in the test item list. Let the test item list be denoted by secure _ list, then the structure of secure _ list is as follows:
secure_list
column names Column name corresponding to safety requirement examination sheet
Id Serial number
Check_Category Test requirements
Check_Safety_requirement Safety requirements
Check_Saftey_need Example Security requirements
And S230, aiming at each test record in the test item list, extracting the item to be tested in the test record.
In this embodiment, the list of test items may include a plurality of rows, one test record per row. If a test record in the test item list is represented by record a, the record a includes [ Id, check _ Category, check _ Safety _ requiremen, and Check _ Safety _ needed ], and items to be tested, i.e., check _ Category and Check _ Safety _ requiremen, in the record a are extracted.
The same is performed for the remaining test records in the test item list.
S240, performing word segmentation processing on the item to be detected to obtain a word segmentation set.
For Chinese, chinese word segmentation, also called Chinese word segmentation, refers to segmenting a Chinese character sequence into a single word.
In this embodiment, the extracted item to be tested in the test record may be a sentence or a phrase formed by a sequence of chinese characters, and in order to more accurately find out the target rule corresponding to the item to be tested from the test rule list, the item to be tested may be first segmented into one or more segments, and then the corresponding target rule may be found according to the segments.
Optionally, the word segmentation processing is performed on the item to be detected, and the manner of obtaining the word segmentation set may be: determining a word segmentation dictionary according to the test rule list, wherein the word segmentation dictionary comprises a plurality of entries; matching the items to be tested in the word segmentation dictionary to obtain a successfully matched entry set; and denoising the successfully matched entry set to obtain a word segmentation set.
The method can adopt a word segmentation method based on a dictionary to perform word segmentation, and has the important idea that a character string to be segmented is matched with an entry in a large dictionary according to a certain strategy, and if the character string exists in the dictionary, the matching is successful, and then the guess of the next word string is performed.
Specifically, the dictionary can be determined according to the test rule list, and the Check _ Safety _ requirement in the item to be tested is subjected to word segmentation, and the word segmentation result is stored in the entry set. The word segmentation method based on the dictionary is used for analyzing and determining the safety requirement checking order, the safety requirement checking order is described according to the requirements of the safety field, the professional performance of the appeared words is strong, and the accuracy of the word segmentation result can be improved by using the word segmentation method based on the dictionary.
And further, denoising the entry set, and removing some high-frequency nonsense words such as pronouns, conjunctions, prepositions and the like in the word segmentation result to finally obtain a word segmentation set.
And S250, searching a corresponding rule sentence in the test rule list aiming at each participle in the participle set.
The test rule list is a rule set that specifies the test requirements and methods for each test requirement.
In this embodiment, the list of test rules may be determined according to a service security test guide. The service safety test guide provides a test guidance method aiming at each test requirement in the safety requirement inspection list, comprises a test method case example, an expected result example, a test-free condition and the like, and is used for guiding the development of test work of service safety requirements (comprising functional and non-functional safety requirements).
Specifically, each rule may be imported into the test rule list by analyzing the "service safety test guide". The test rule list is denoted by secure _ rule, and the structure of secure _ rule is as follows:
secure_rule
Figure BDA0003899699440000101
Figure BDA0003899699440000111
optionally, the test rule list is continuously updated according to the set frequency.
For example, the website of the service safety test guide may be accessed once every 4 hours, the latest service safety test guide may be downloaded, and then the test rule list may be generated by parsing, so as to update the test rule list.
In this embodiment, after the word segmentation set is obtained, the test rule list may be searched in sequence according to each word in the word segmentation set, and a corresponding rule statement is determined.
Optionally, the set M represents a participle set, where the element is each participle. For an element M in the set M, the element M is derived from a security requirement Check _ security _ requirement, and according to a corresponding test requirement Check _ Category, a corresponding record b is found in a table secure _ rule according to a column name, and the record b is a rule statement corresponding to the element M. And traversing the set M to determine each element, namely the rule sentence corresponding to each participle.
And S260, determining a set of rule sentences corresponding to the participles as target rules.
In this embodiment, after determining the rule statement corresponding to each participle, a set of the rule statements may be determined as a target rule.
S270, extracting test method example items and expected result items in the target rule.
The test rule list includes a test method example sequence and an expected result sequence, the target rule includes at least one row in the test rule list, and the target rule includes a test method example item and an expected result item.
In this embodiment, the record b corresponding to the element m to the table secure _ rule is a corresponding rule statement, and the record b is at least one row in the secure _ rule, which includes a test method example item and an expected result item. The target rule is a set of rule statements (denoted by a set B), and the set B includes a test method sample item (Saftey _ test _ example) and an expected result item (Saftey _ result). The values of the Saftey _ test _ example column and the Saftey _ result column of all records in the set B can be extracted.
S280, taking the safety requirement item as a test case description, taking the test method example item as a test case step, taking an expected result item as a test case expected result, combining the test case description, the test case step and the test case expected result with corresponding test requirement items, and adding the combined test case description, the test case step and the test case expected result into a blank test case table.
In this embodiment, after the target rule corresponding to each item to be tested is obtained, since the item to be tested includes the test requirement item and the safety requirement item, and the target rule includes the test method example item and the expected result item, the test requirement item, the safety requirement item, the test method example item, and the expected result item may be combined, and each combination is used as one record in the test case. The combination may be that the Check _ Category column value + cycle self increment (i =1,2,3 \8230;) is used as the test number of the test case, the value of the Check _ Safety _ requirement column is used as the case description of the test case, the value of the Saftey _ test _ example column of the test method can be used as the step of the test case, and the expected result Saftey _ result column value is used as the expected result of the test case. Each combination was added to a blank test case table.
And S290, determining the blank test case table after the adding is finished as a test case.
In this embodiment, the corresponding rules of each item to be tested in the test item list in the test rule list are determined respectively, and the corresponding rules of all items to be tested in the test rule list can be obtained by traversing the test item list. And correspondingly combining the items to be tested with the test rules, and adding the items to be tested and the test rules into the blank test case table in sequence, wherein the set of all combinations is the final case.
The embodiment of the invention discloses a test case generation method, which sets an automatic test case generation mode, improves the generation efficiency of test cases, reduces the dependence on the self level of testers when the test cases are generated manually, and cuts a project to be tested into a plurality of participles and then respectively determines corresponding rule sentences by adopting a word cutting processing mode, so that the determined target rule is more accurate and comprehensive, and the accuracy of the test cases is ensured by keeping the test rule list updated.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a test case generating device according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: the test item list determining module 310, the item to be tested extracting module 320, the target rule determining module 330 and the test case generating module 340.
The test item list determining module 310 is configured to determine a test item list according to the test requirement, where each row of the test item list corresponds to one test record.
Optionally, the test item list determining module 310 is further configured to:
acquiring an original safety requirement inspection list; and extracting target rows corresponding to the test requirements in the safety requirement checking list, and forming a test item list by the target rows.
Optionally, the test rule list is continuously updated according to the set frequency.
The item-to-be-tested extraction module 320 is configured to extract, for each test record in the test item list, an item to be tested in the test record.
And the target rule determining module 330 is configured to search a given test rule list according to the item to be tested, and determine a target rule in the test rule list.
Optionally, the target rule determining module 330 is further configured to:
performing word segmentation processing on the item to be detected to obtain a word segmentation set; searching a corresponding rule sentence in a test rule list aiming at each participle in the participle set; and determining a set of rule sentences corresponding to each participle as a target rule.
Optionally, the target rule determining module 330 is further configured to:
determining a word segmentation dictionary according to the test rule list, wherein the word segmentation dictionary comprises a plurality of entries; matching the items to be tested in the word segmentation dictionary to obtain a successfully matched entry set; and denoising the successfully matched entry set to obtain a word segmentation set.
And the test case generating module 340 is configured to combine the item to be tested with the target rule to generate a test case.
Optionally, the test item list includes a test requirement sequence and a safety requirement sequence, and correspondingly, the items to be tested in the test record include a test requirement item and a safety requirement item.
Optionally, the test rule list includes a test method example sequence and an expected result sequence, the target rule includes at least one row in the test rule list, and the test case generating module 340 is further configured to:
extracting test method example items and expected result items in the target rule; taking the safety requirement item as a test case description, taking the test method example item as a test case step, taking an expected result item as a test case expected result, combining the test case description, the test case step and the test case expected result with a corresponding test requirement item, and adding the combination into a blank test case table; and determining the blank test case table after the addition as the test case.
The test case generation device provided by the embodiment of the invention can execute the test case generation method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example four
FIG. 4 shows a schematic block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 may also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The processor 11 executes the respective methods and processes described above, such as the test case generation method.
In some embodiments, the test case generation method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the generation of test cases described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the test case generation method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user may provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for generating a test case is characterized by comprising the following steps:
determining a test item list according to test requirements, wherein each line of the test item list corresponds to one test record;
extracting a to-be-tested item in the test record aiming at each test record in the test item list;
searching a given test rule list according to the item to be tested, and determining a target rule in the test rule list;
and combining the item to be tested with the target rule to generate the test case.
2. The method of claim 1, wherein determining a list of test items based on the test requirements comprises:
acquiring an original safety requirement inspection list;
and extracting target rows corresponding to the test requirements in the safety requirement checking list, and forming the target rows into the test item list.
3. The method of claim 1, wherein the list of test rules is updated continuously according to a set frequency.
4. The method of claim 1, wherein finding a given test rule list from the item under test, and determining a target rule in the test rule list comprises:
performing word segmentation processing on the item to be detected to obtain a word segmentation set;
searching a corresponding rule sentence in the test rule list aiming at each participle in the participle set;
and determining a set of rule sentences corresponding to each participle as the target rule.
5. The method of claim 4, wherein performing word segmentation on the item to be tested to obtain a word segmentation set comprises:
determining a word segmentation dictionary according to the test rule list, wherein the word segmentation dictionary comprises a plurality of entries;
matching the item to be tested in the word segmentation dictionary to obtain a successfully matched entry set;
and denoising the successfully matched entry set to obtain the word segmentation set.
6. The method of claim 1, wherein the list of test items comprises a sequence of test requirements and a sequence of safety requirements, and correspondingly, the items to be tested in the test record comprise a test requirement item and a safety requirement item.
7. The method of claim 6, wherein the test rule list comprises a test method instance sequence and an expected result sequence, wherein the target rule comprises at least one row in the test rule list, and wherein combining the item to be tested with the target rule to generate the test case comprises:
extracting test method example items and expected result items in the target rule;
taking the safety requirement item as a test case description, taking the test method example item as a test case step, taking the expected result item as a test case expected result, combining the test case description, the test case step and the test case expected result with the corresponding test requirement item, and adding the combination into a blank test case table;
and determining the blank test case table after the addition as the test case.
8. An apparatus for generating a test case, comprising:
the test item list determining module is used for determining a test item list according to test requirements, wherein each line of the test item list corresponds to one test record;
the to-be-tested item extraction module is used for extracting to-be-tested items in the test records aiming at each test record in the test item list;
the target rule determining module is used for searching a given test rule list according to the item to be tested and determining a target rule in the test rule list;
and the test case generation module is used for combining the item to be tested with the target rule to generate the test case.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of test case generation of any one of claims 1-7.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions for causing a processor to implement the method for generating a test case of any one of claims 1-7 when executed.
CN202211286562.8A 2022-10-20 2022-10-20 Test case generation method, device, equipment and storage medium Pending CN115437962A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211286562.8A CN115437962A (en) 2022-10-20 2022-10-20 Test case generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211286562.8A CN115437962A (en) 2022-10-20 2022-10-20 Test case generation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115437962A true CN115437962A (en) 2022-12-06

Family

ID=84252279

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211286562.8A Pending CN115437962A (en) 2022-10-20 2022-10-20 Test case generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115437962A (en)

Similar Documents

Publication Publication Date Title
CN112579727B (en) Document content extraction method and device, electronic equipment and storage medium
CN115168562A (en) Method, device, equipment and medium for constructing intelligent question-answering system
CN115145924A (en) Data processing method, device, equipment and storage medium
CN111492364B (en) Data labeling method and device and storage medium
CN112148841B (en) Object classification and classification model construction method and device
CN114020904A (en) Test question file screening method, model training method, device, equipment and medium
CN113408280A (en) Negative example construction method, device, equipment and storage medium
CN116150394A (en) Knowledge extraction method, device, storage medium and equipment for knowledge graph
CN114201607B (en) Information processing method and device
CN115328736A (en) Probe deployment method, device, equipment and storage medium
CN115510206A (en) Semantic question and answer method and device, electronic equipment and storage medium
CN115600592A (en) Method, device, equipment and medium for extracting key information of text content
CN115437962A (en) Test case generation method, device, equipment and storage medium
CN115328898A (en) Data processing method and device, electronic equipment and medium
CN115659347A (en) Safety testing method and device, electronic equipment and storage medium
CN115470034A (en) Log analysis method, device and storage medium
CN115292506A (en) Knowledge graph ontology construction method and device applied to office field
CN114443802A (en) Interface document processing method and device, electronic equipment and storage medium
CN115309867A (en) Text processing method, device, equipment and medium
KR20220024251A (en) Method and apparatus for building event library, electronic device, and computer-readable medium
CN114722401A (en) Equipment safety testing method, device, equipment and storage medium
CN114443493A (en) Test case generation method and device, electronic equipment and storage medium
CN114328855A (en) Document query method and device, electronic equipment and readable storage medium
CN117271373B (en) Automatic construction method and device for test cases, electronic equipment and storage medium
CN115129816B (en) Question-answer matching model training method and device and electronic equipment

Legal Events

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