CN113392014A - Test case generation method and device, electronic equipment and medium - Google Patents

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

Info

Publication number
CN113392014A
CN113392014A CN202110698169.9A CN202110698169A CN113392014A CN 113392014 A CN113392014 A CN 113392014A CN 202110698169 A CN202110698169 A CN 202110698169A CN 113392014 A CN113392014 A CN 113392014A
Authority
CN
China
Prior art keywords
test case
interface image
operation object
input
case generation
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
CN202110698169.9A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110698169.9A priority Critical patent/CN113392014A/en
Publication of CN113392014A publication Critical patent/CN113392014A/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/3684Test management for test design, e.g. generating new test cases

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 disclosure relates to the technical field of software testing, artificial intelligence and big data, and provides a test case generation method, a test case generation device, electronic equipment and a test case generation medium, which can be applied to the technical field of finance. The test case generation method comprises the following steps: recording multiple device operations of input equipment during testing to obtain an operation log, wherein the operation log comprises operation records of each device operation, and the operation records comprise operation types, input contents, operation positions and operation serial numbers in sequential arrangement; intercepting an interface image after each equipment operation; identifying operation contents of each equipment operation according to the interface image, wherein the operation contents comprise operation objects and mapping relations between the operation objects and input contents; describing operation records and operation contents of each equipment operation to obtain operation steps; and associating the operation steps to generate an initial test case. The method and the device can reduce the compiling workload of business personnel and improve the compiling quality and the compiling efficiency of the test cases.

Description

Test case generation method and device, electronic equipment and medium
Technical Field
The disclosure relates to the technical field of software testing, artificial intelligence and big data, in particular to a test case generation method, a device, electronic equipment and a medium.
Background
Software testing is an important link in the current software research and development process, the working quality and the efficiency are very important, and a test case is used for describing a test task of a specific software product and embodying a test scheme, a method, a technology and a strategy.
In the prior art, service personnel compiling test cases need to describe test operation actions of each step and are limited by manual compiling of the service personnel, workload is very large, and the problems of different granularity for describing operation steps, missing step description and the like often exist in the process of compiling the service personnel, so that the compiling quality and the compiling efficiency of the test cases are lower.
Disclosure of Invention
In view of the above problems, the present disclosure provides a test case generation method, device, electronic device, and medium, which can reduce the writing workload of business personnel and improve the writing quality and writing efficiency of test cases.
According to a first aspect of the present disclosure, a test case generation method is provided, including: recording multiple device operations of input equipment during testing to obtain an operation log, wherein the operation log comprises operation records of each device operation, and the operation records comprise operation types, input contents, operation positions and operation serial numbers in sequential arrangement; intercepting an interface image after each equipment operation; identifying operation contents of each equipment operation according to the interface image, wherein the operation contents comprise operation objects and mapping relations between the operation objects and input contents; describing operation records and operation contents of each equipment operation to obtain operation steps; and associating the operation steps to generate an initial test case.
According to the embodiment of the disclosure, the test case generation method further includes: selecting a plurality of operation records with the same operation object and operation type and continuous operation serial numbers to obtain a first operation record set; and merging the operation records of the first operation record set according to a merging rule to obtain a merged operation record.
According to an embodiment of the present disclosure, the merge rule includes: and when the input content is a text, merging the input content of each operation record of the first operation record set according to the operation sequence number.
According to the embodiment of the disclosure, identifying the operation content of each device operation according to the interface image comprises: positioning an operation position in an interface image aiming at certain equipment operation; an operation object and a name of the operation object within a first threshold range from the operation position are identified.
According to the embodiment of the disclosure, when there are a plurality of operation objects within a first threshold range from an operation position, the plurality of operation objects form an operation object screening set, and the test case generation method further includes: and screening the operation object screening set according to a priority principle to obtain a target operation object and the name of the target operation object.
According to an embodiment of the present disclosure, the precedence principle includes: sequentially judging the operation object screening set: whether an operation object containing an operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be the target operation object: whether an operation object positioned on the left side of the operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be: whether an operation object positioned at the upper side of the operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be: whether an operation object positioned at the right side of the operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be: and whether an operation object positioned at the lower side of the operation position exists or not, and if so, the operation object is a target operation object.
According to an embodiment of the present disclosure, the operation object includes a text block.
According to the embodiment of the disclosure, the operation object and the name of the operation object in the interface image are identified through the open source tool.
According to the embodiment of the disclosure, the test case generation method further includes: recording the secondary voice description of the operational step to obtain a secondary voice recording, wherein the secondary voice recording includes content that describes rules of the operational step.
According to the embodiment of the disclosure, the test case generation method further includes: modifying the initial test case to obtain a final test case, wherein modifying the initial test case at least comprises: one of an add operation step, a modify operation step, and a delete operation step.
According to the embodiment of the disclosure, the test case generation method further includes: recording the modification content of the initial test case; learning features of the modified content; a recommended modification is generated.
According to the embodiment of the disclosure, the test case generation method further includes: saving each operation step and interface image of the initial test case; and saving each operation step and interface image of the final test case.
According to the embodiment of the disclosure, the test case generation method further includes: exporting the final test case into a text format; and uploading the final test case.
According to an embodiment of the present disclosure, the operation types include at least: one of text input, function key input, mouse click, mouse drag, voice input, and mouse scroll.
According to the embodiment of the disclosure, the operation record further includes a screen resolution, and positioning the operation position in the interface image specifically includes: and obtaining the coordinates of the operation position according to the screen resolution to position the operation position in the interface image.
A second aspect of the present disclosure provides a test case generation apparatus, including: the device operation recording module is used for recording each device operation of the input device during testing so as to obtain an operation log, and the operation log comprises operation records of each device operation; the interface image intercepting module is used for intercepting an interface image after each equipment operation; the interface image identification module is used for identifying the operation content of each equipment operation according to the interface image; an operation step obtaining module, configured to describe operation records and operation contents of each device operation and obtain operation steps; and the initial test case generation module is used for associating each operation step and generating an initial test case.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the test case generation method.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the test case generation method described above.
The test case generation method, the test case generation device, the electronic equipment and the test case generation medium can reduce the compiling workload of business personnel and improve the compiling quality and the compiling efficiency of the test cases.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, which proceeds with reference to the accompanying drawings, in which:
fig. 1 schematically illustrates an application scenario diagram of a test case generation method, apparatus, electronic device and computer-readable storage medium according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow diagram of a test case generation method according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow diagram of another test case generation method according to an embodiment of the present disclosure;
fig. 4 schematically shows a flowchart of the merge rule of operation S303;
fig. 5 schematically shows a flowchart of operation S305 for identifying operation contents of respective device operations from an interface image;
fig. 6 schematically shows a flowchart of the prioritization principle of operation S306;
FIG. 7 schematically illustrates a flow diagram of another test case generation method according to an embodiment of the present disclosure;
fig. 8 schematically shows a flowchart of the operation position in the positioning interface image of operation S51 in fig. 5;
fig. 9 is a block diagram schematically illustrating a structure of a test case generation apparatus according to an embodiment of the present disclosure; and
FIG. 10 schematically illustrates a block diagram of an electronic device suitable for implementing a test case generation method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
The test case is used for describing a test task of a specific software product, the workload of writing the test case manually by service personnel in the prior art is very large and is limited by the manual writing of the service personnel, and the written operation steps have the problems of different granularity, missing step description and the like, so that a test execution link cannot be covered according to the original intention of the design of the test case, and risks are generated.
In addition, because the test case is compiled based on the text description, the readability of the test case is relatively poor, the information acquisition efficiency of a test executive or an automatic script writer is low in a test mode of test case design and execution stripping, ambiguity is easy to occur, a large amount of communication cost is needed, and the problems of inconsistent understanding, missing execution process and the like often occur.
The embodiment of the disclosure provides a test case generation method, which includes: recording multiple device operations of input equipment during testing to obtain an operation log, wherein the operation log comprises operation records of each device operation, and the operation records comprise operation types, input contents, operation positions and operation serial numbers in sequential arrangement; intercepting an interface image after each equipment operation; identifying operation contents of each equipment operation according to the interface image, wherein the operation contents comprise operation objects and mapping relations between the operation objects and input contents; describing operation records and operation contents of each equipment operation to obtain operation steps; and associating the operation steps to generate an initial test case.
The test case generation method of the embodiment of the disclosure has at least one of the following advantages:
1) the test case can be automatically generated, so that the compiling workload of test case service personnel can be reduced, and the compiling efficiency of the test case is higher; on the other hand, the problem of semantic ambiguity caused by manual writing is avoided, and the writing quality of the test case is higher.
2) The input operation of each input device is automatically recorded, so that the granularity of the operation steps of the test cases is consistent, each step can be included, and the writing quality of the test cases is higher.
It should be noted that the test case generation method and device disclosed by the present disclosure belong to the technical fields of software testing, artificial intelligence and big data, the test case generation method disclosed by the present disclosure can be used in the financial field, and can also be used in any field except the financial field, and the application fields of the test case generation method and device are not limited by the present disclosure.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the personal information of the related user all accord with the regulations of related laws and regulations, necessary security measures are taken, and the customs of the public order is not violated.
Fig. 1 schematically illustrates an application scenario diagram of a test case generation method, apparatus, electronic device and computer-readable storage medium according to an embodiment of the present disclosure.
As shown in fig. 1, an application scenario 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the test case generation method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the test case generation apparatus provided by the embodiment of the present disclosure may be generally disposed in the server 105. The test case generation method provided by the embodiment of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the test case generation apparatus provided in the embodiment of the present disclosure may also be disposed in a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, and 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The test case generation method of the disclosed embodiment will be described in detail below with reference to fig. 2 to 8 based on the scenario described in fig. 1.
FIG. 2 schematically shows a flowchart of a test case generation method 200 according to an embodiment of the present disclosure.
As shown in fig. 2, the test case generation method 200 of this embodiment includes operations S201 to S205:
in operation S201, recording multiple device operations of an input device during testing to obtain an operation log, where the operation log includes operation records of the device operations of each time;
in operation S202, an interface image after each device operation is intercepted;
in operation S203, identifying operation contents of each device operation according to the interface image;
in operation S204, operation records and operation contents of each device operation are described, resulting in an operation step;
in operation S205, each operation step is associated to generate an initial test case.
The test case is written by a service person writing the test case by using a computer for explanation, and when the service person testing the software tests the software according to the test steps, the test case can be generated according to the test case generation method 200 of the embodiment of the disclosure. Corresponding to writing with a computer, the input devices may include a mouse, a keyboard.
In the technical solution of the embodiment of the present disclosure, in operation S201, the operation record includes an operation type, input content, an operation position, and an operation serial number arranged in sequence, and by recording a device operation of the input device during the test, information related to the test step of the test case may be recorded.
The "operation type" referred to herein means a type input by an input device, for example, a keyboard input, a mouse input, and the keyboard input may be further detailed to a text input, a function key input, and the like; the mouse input can be further refined to mouse click, mouse dragging, mouse rolling and the like, and the mouse click can be further refined to mouse left button click and mouse right button click.
In the above description, the "input content" referred to herein corresponds to the above operation, and may include text and the like.
In the above description, the "operation position" referred to herein corresponds to the above operation, and means a position of operation, for example, a position where a mouse is clicked, and a position where text is input.
In light of the above description, the term "operation number" refers to the operation sequence of each input device, and it should be understood that the embodiment of the present disclosure records each input operation of the input device based on the complete process of the test software, and can completely record the whole test process.
In operation S203, the operation content includes an operation object and a mapping relationship between the operation object and the input content, and the operation object is an object operated by the device. For example, if the text input by the keyboard is in a text block (which can be understood as a collection of texts near the input content), the text block is the operation object of the text; and clicking a certain icon by the mouse, wherein the icon is an operation object clicked by the mouse. The "mapping relationship between the operation object and the input content" referred to herein is a correspondence relationship between the input content and the operation object. For example, if a text block a, a text block B, and a text block C exist and a text "u" is input, it is necessary to identify in which text block the input text "u" is, and when the input text "u" is in the text block a, a mapping relationship exists between "u" and the text block a.
In operation S202, the intercepted interface image after each device operation is obtained, and the operation content can be identified in the interface image to obtain complete information related to the test step of the test case (it should be understood that, in operation S201, obtaining information related to the test step of the test case is limited, and a complete test step cannot be obtained).
The "description" referred to in operation S204 is to form the operation record and the operation content of each device operation as structured information that can clearly indicate the operation step. For example, the operation record and the operation content are integrated in a structure of "operation number-operation type-operation position-operation object-input content", and when the first step is to input "u" character using the text block a of the keyboard at the position (x, y), the formed structured information is "01-keyboard input- (x, y) -a-u".
In step S205, "associating each operation step" means that each operation step is sequentially arranged to generate an initial test case.
It should be understood that the initial test case is automatically generated, so there may be some errors, and the business personnel writing the test case later can check and modify the test case based on the initial test case.
The test case generation method 200 of the present disclosure may obtain complete information related to a test case by recording device operations of an input device and recognizing an interface image after each device operation; the operation steps can be obtained by describing the operation records and the operation contents of each device operation, and the initial test case can be generated by associating each operation step.
The test case generation method disclosed by the invention has at least one of the following advantages:
1) the test case can be automatically generated, so that the compiling workload of test case service personnel can be reduced, and the compiling efficiency of the test case is higher; on the other hand, the problem of semantic ambiguity caused by manual writing is avoided, and the writing quality of the test case is higher.
2) The input operation of each input device is automatically recorded, so that the granularity of the operation steps of the test cases is consistent, each step can be included, and the writing quality of the test cases is higher.
As shown in fig. 3, the test case generating method 300 according to another embodiment of the present disclosure may further include operations S302 to S303:
in operation S302, selecting a plurality of operation records with the same operation object and operation type and consecutive operation serial numbers to obtain a first operation record set;
in operation S303, the operation records of the first operation record set are merged according to the merging rule to obtain a merged operation record.
In the technical scheme of the embodiment of the disclosure, by combining a plurality of operation records with the same operation object and operation type and continuous operation serial numbers, the obtained combined operation records are more intuitive and convenient to understand, and the number of the operation records can be reduced.
It should be understood that, when a plurality of operation records are merged into one merged operation record, the interface image after the operation of the intercepting device is the interface image after the operation record of the intercepting and merging.
As shown in fig. 3 and 4, the merge rule of operation S303 may include operation S31: in operation S31, when the input content is text, the input content of each operation record of the first operation record set is merged according to the operation number.
For example, there are four operation records, namely, "01-keypad input- (x1, y1) -a-u", "02-keypad input- (x2, y2) -a-s", "03-keypad input- (x3, y3) -a-e" and "04-keypad input- (x4, y4) -a-r", and these four operation records have the same operation object and operation type and continuous operation serial numbers, and can be combined into "01-keypad input- (x1, y1) -a-user".
Illustratively, when the operation type is mouse scroll, the merge rule may include: the values scrolled by the mouse are summed. For example, there are two operation records, respectively, "05-mouse scroll- (x1, y1) -a-1" and "06-mouse scroll- (x2, y2) -a-2", which respectively indicate that step 5 is to scroll the a operation object by one unit at the position (x1, y1) by the mouse, and step 6 is to scroll the a operation object by two units at the position (x2, y2) by the mouse, and then the operation records can be merged into "05-mouse scroll- (x1, y1) -a-3".
As shown in fig. 3 and 5, the operation of identifying the operation content of each device operation according to the interface image in operation S305 may include operations S51 to S52:
locating an operation position in the interface image for a certain device operation in operation S51;
in operation S52, an operation object and a name of the operation object within a first threshold range from the operation position are identified.
In the technical scheme of the disclosure, the operation object of the device operation can be determined through operations S51 and S52, and then complete operation step information can be obtained subsequently. In operation S52, a first threshold may be preset, the first threshold providing a distance range for identifying the operation object, facilitating determination of the operation object.
According to the test case generating method 300 of the embodiment of the present disclosure, when there are a plurality of operation objects within a first threshold range from an operation position, the plurality of operation objects may form an operation object screening set, as shown in fig. 3, the test case generating method 300 may further include operation S306:
in operation S306, the operation object filtering set is filtered according to the priority principle to obtain the target operation object and the name of the target operation object.
It should be understood that there is only one operation object for one device operation, and therefore, when there are a plurality of operation objects within the first threshold range, a final operation object, that is, a target operation object, needs to be selected. According to the technical scheme, the target operation object can be reasonably and accurately determined through the optimization principle.
As shown in fig. 3 and 6, the priority rule of operation S306 may include operations S61 to S65: sequentially judging the operation object screening set:
in operation S61, whether or not an operation target including the operation position exists is determined, and if yes, the operation target is the target operation target, and if not, it is determined that:
in operation S62, it is determined whether or not an operation target located on the left side of the operation position exists, and if so, the operation target is the target operation target, and if not:
in operation S63, it is determined whether or not an operation target located above the operation position exists, if so, the operation target is a target operation target, and if not:
in operation S64, it is determined whether or not an operation target located on the right side of the operation position exists, and if so, the operation target is a target operation target, and if not:
in operation S65, whether or not there is an operation target located below the operation position, and if so, the operation target is the target operation target.
According to the technical scheme, the accuracy of identifying the operation object can be improved through a reasonable priority principle, and the compiling quality of the test case is further improved. It should be noted that since the operation target screening set includes a plurality of operation targets, the target operation target can be specified by the priority rule, and if there is no operation target within the first threshold range of the operation position, it is possible to determine that the present device operation is an invalid operation, and it is possible to select not to record the invalid operation.
According to the test case generation method 200/300 of the embodiments of the present disclosure, the operands may include text blocks. The "text block" referred to herein refers to an operation object for text input, and it should be understood that the operation object is not limited to the text block, and for example, when the input device is a mouse, the operation object may include an icon or the like, and specifically, different operation objects are included according to the change of test items.
For example, for the operation type of mouse click, through the operation positions (x0, y0) recorded in the operation steps, text blocks near the operation positions are identified in the interface image corresponding to the operation steps, for example, a plurality of text blocks are found, then according to the coordinate positions ((x1, y1), (x2, y2)) of the text blocks, the text blocks are compared with the click positions, appropriate text blocks are found according to the priority, and the character content in the text blocks is used as the operation object clicked by the click operation type. The priority principle is that a text block containing the clicked operation position is found first, if the text block located on the left side of the clicked operation position is not found, the text block located above the clicked operation position is found again, the text block located on the right side of the clicked operation position is found again, and the text block located below the clicked operation position is found finally, if none of the text blocks exists, the operation is considered to have no corresponding operation object, and the operation may be an invalid operation of the user.
Priority 1: (x1< x0< x2, y1< y0< y2), the operation coordinate position of the click operation is contained in the text block;
priority 2: (x2< x0, y1< y0< y2), the text block is on the left side of the operation coordinate position of the click operation;
priority 3: (x1< x0< x2, y2< y0), the text block is above the operation coordinate position of the click operation
Priority 4: (x1< x0< x2, y0< y1), the text block is right to the operation coordinate position of the click operation
Priority 5: (x0< x1, y1< y0< y2), text block below operation coordinate position of click operation
It should be further noted that the priority principle may be adjusted in different application scenarios.
According to the test case generation method 200/300 of the embodiment of the present disclosure, an operation object and a name of the operation object in an interface image may be recognized by an open source tool.
As shown in fig. 7, the test case generation method 400 according to still another embodiment of the present disclosure may further include operation S401:
in operation S401, an auxiliary voice description of the operation step is recorded to obtain an auxiliary voice recording, wherein the auxiliary voice recording includes content of rules describing the operation step.
It should be noted that, when writing a test case, rules of operation steps may need to be recorded, for example, in the case of condition a, the device operation 1 is performed, in the case of condition B, the device operation 2 is performed, and in the case of performing operation records and operation contents describing each device operation, the rules of corresponding operation steps are not described.
According to the technical scheme, the rules of the operation steps can be recorded by recording the auxiliary voice description of the operation steps, the formed test case is more complete, the workload of service personnel for writing the test case is reduced, and meanwhile the writing quality and writing efficiency of the test case can be improved. By combining the above description, the technical scheme of the present disclosure enriches the information of the test case through the mode of combining the text, the image and the sound, so that the test case design and compilation are more comprehensive, the test omission is avoided, and the efficiency of the test case design, the test case execution and the test case compilation is better improved.
It should be understood that the auxiliary voice description is the voice description content of the rules, etc. made by the business person/test case writer of the test software to the operation steps when testing/writing the cases. The secondary voice recording can likewise form structured information, and as an operation step, for example, an operation recording of "01-keypad input- (x, y) -a-u" is subjected to secondary voice description, an operation recording of "02-voice description-01" can be saved, which indicates that the second step is a voice description, which is a description of the first step.
Besides the description of the rules of the operation steps, the recording of special verification rules, check points and the like can be realized in a voice description mode, the efficiency of the intention information transmission of the test cases is improved, and the communication cost is reduced.
As shown in fig. 7, the test case generation method 400 according to the embodiment of the present disclosure may further include operation S402:
in operation S402, the initial test case is modified to obtain a final test case.
Wherein, modifying the initial test case may at least include: one of an add operation step, a modify operation step, and a delete operation step.
It should be understood that the initial test case is an automatically generated test case, some errors may occur, and in the technical solution of the present disclosure, by modifying the initial case, the errors in the initial test case may be corrected, so as to form a correct final test case for use, thereby improving the writing quality of the test case. In some cases, the automatically generated initial test case is error-free, so the service personnel writing the test case only need to check and check once.
Illustratively, modifying the initial test case may include: the operation steps are added, modified and deleted, and modification is more efficient and flexible.
As shown in fig. 7, the test case generation method 400 according to the embodiment of the present disclosure may further include operations S403 to S405:
in operation S403, recording modified content of the initial test case;
learning features of the modified content in operation S404;
in operation S405, a recommended modification is generated.
More specifically, the modification record of the initial test case can be stored in an operation log, the content described in the operation step can be subjected to clustering analysis to form a corresponding hot word library, the characteristics of the modified content can be learned, when the system generates the operation step subsequently, and when unreasonable words or previously modified words appear in the information of the operation step, the modified recommendation information can be automatically generated, the recommendation degree of the information of the learning library can be gradually established according to the maintenance condition of the recommendation modification, and the modification preference information corresponding to a certain application scene can be formed through a natural language processing K-means clustering algorithm.
According to the technical scheme, the modification content can be effectively recorded and learned, and the initial test case can be efficiently and quickly modified by business personnel who compile the test case. As used herein, "modifying characteristics of content" may include modifying the content itself, modifying the content and associating the content with the modified content.
For example, in the initial test case, there is an error that the "user" error is recognized as a "month user", when the "month user" is modified to the "user" by the service personnel writing the test case, the modified content can be recorded, the characteristics of the modified content can be learned, and when the "month user" appears next time, the recommended modification of the "user" can be generated to be referred to by the service personnel writing the test case. The "feature of the modified content" herein refers to the modified content itself in which "month" is modified to "use", the association between "month" and "user", and the association between "use" and "user".
It should be noted that after the modified content of the initial test case and the characteristics of the learning modified content are recorded, other content with the same error can be directly modified according to the modified content.
As shown in fig. 7, the test case generation method 400 according to the embodiment of the present disclosure may further include operations S406 to S407:
in operation S406, saving each operation step and interface image of the initial test case;
in operation S407, the operation steps and the interface image of the final test case are saved.
According to the technical scheme, the comparison and reference of business personnel compiling the test cases can be facilitated by respectively storing each operation step and interface image of the initial test case and the final test case.
As shown in fig. 7, the test case generating method 400 according to the embodiment of the present disclosure may further include operations S408 to S409:
in operation S408, exporting the final test case into a text format;
in operation S409, the final test case is uploaded.
According to the technical scheme, the final test case can be formed into a text format which is higher in readability and convenient to understand, and the final test case is uploaded to complete a complete test case cycle.
It should be noted that the test cases generally need to be finally saved in, for example, a case library of an enterprise, and therefore the test cases need to be uploaded to the case library for archiving.
Exemplarily, the final test case can be exported to a text format and then uploaded to a corresponding test case for matching, so as to complete the writing of the test case.
According to the test case generation method 200/300/400 of the embodiment of the present disclosure, the operation types may include at least: one of text input, function key input, mouse click, mouse drag, voice input, and mouse scroll.
Exemplary types of operations may include: the method comprises the following steps of text input, function key input, mouse clicking, mouse dragging, voice input and mouse rolling, can comprehensively contain various operations during testing software, correspondingly forms a complete and universal test case, and improves the compiling quality and the compiling efficiency of the test case.
According to the test case generating method 300 of the embodiment of the present disclosure, the operation record further includes a screen resolution, and as shown in fig. 5 and fig. 8, in operation S51, locating the operation position in the interface image may specifically include operation S511:
in operation S511, coordinates of the operation position are obtained according to the screen resolution to locate the operation position in the interface image.
According to the technical scheme, the coordinates of the operation position are obtained through the screen resolution to position the operation position in the interface image, and the operation position can be accurately positioned. For example, for a screen resolution of 1920 x 1080, the operating positions range from (0,0) to (1920,1080).
In the technical solution of the present disclosure, the operation record may further include a test case number, a recording date, an nth record of the date, and the like.
Based on the test case generation method, the disclosure also provides a test case generation device. The apparatus will be described in detail below with reference to fig. 9.
Fig. 9 schematically shows a block diagram of a test case generation apparatus 500 according to an embodiment of the present disclosure.
As shown in fig. 9, the test case generating apparatus 500 of this embodiment includes a device operation recording module 510, an interface image intercepting module 520, an interface image identifying module 530, an operation step obtaining module 540, and an initial test case generating module 550.
The device operation recording module 510 is configured to record each device operation of the input device during testing to obtain an operation log, where the operation log includes operation records of each device operation. In an embodiment, the device operation recording module 510 may be configured to perform the operation S201 described above, which is not described herein again.
The interface image capturing module 520 is configured to capture an interface image after each device operation. In an embodiment, the interface image capturing module 520 may be configured to perform the operation S202 described above, which is not described herein again.
The interface image recognition module 530 is configured to recognize operation contents of each device operation according to an interface image. In an embodiment, the interface image recognition module 530 may be configured to perform the operation S203 described above, which is not described herein again.
The operation step obtaining module 540 is used for describing operation records and operation contents of each device operation and obtaining operation steps. In an embodiment, the operation step obtaining module 540 may be configured to perform the operation S204 described above, which is not described herein again.
The initial test case generation module 550 is configured to associate each operation step and generate an initial test case. In an embodiment, the initial test case generating module 550 may be configured to perform the operation S205 described above, which is not described herein again.
According to the embodiment of the present disclosure, any of the device operation recording module 510, the interface image intercepting module 520, the interface image identifying module 530, the operation step obtaining module 540, and the initial test case generating module 550 may be combined into one module to be implemented, or any one of the modules may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the device operation recording module 510, the interface image intercepting module 520, the interface image recognizing module 530, the operation step obtaining module 540, and the initial test case generating module 550 may be at least partially implemented as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementation manners of software, hardware, and firmware, or by a suitable combination of any several of them. Alternatively, at least one of the device operation recording module 510, the interface image intercepting module 520, the interface image identifying module 530, the operation step obtaining module 540, and the initial test case generating module 550 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be executed.
FIG. 10 schematically illustrates a block diagram of an electronic device suitable for implementing a test case generation method according to an embodiment of the present disclosure.
As shown in fig. 10, an electronic device 600 according to an embodiment of the present disclosure includes a processor 601 which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. Processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 601 may also include onboard memory for caching purposes. Processor 601 may include a single processing unit or multiple processing units for performing different actions of a method flow according to embodiments of the disclosure.
In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or RAM 603. It is to be noted that the programs may also be stored in one or more memories other than the ROM 602 and RAM 603. The processor 601 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 600 may also include input/output (I/O) interface 605, input/output (I/O) interface 605 also connected to bus 604, according to an embodiment of the disclosure. The electronic device 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: 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), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 602 and/or RAM 603 described above and/or one or more memories other than the ROM 602 and RAM 603.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated in the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the item recommendation method provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 601. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, downloaded and installed through the communication section 609, and/or installed from the removable medium 611. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program, when executed by the processor 601, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (16)

1. A test case generation method is characterized by comprising the following steps:
recording multiple device operations of input equipment during testing to obtain an operation log, wherein the operation log comprises operation records of each device operation, and the operation records comprise operation types, input contents, operation positions and operation serial numbers in sequential arrangement;
intercepting an interface image after each equipment operation;
identifying operation content of each equipment operation according to the interface image, wherein the operation content comprises an operation object and a mapping relation between the operation object and the input content;
describing operation records and operation contents of each equipment operation to obtain operation steps;
and associating each operation step to generate an initial test case.
2. The method for generating test cases according to claim 1, further comprising:
selecting a plurality of operation records with the same operation object and operation type and continuous operation serial numbers to obtain a first operation record set;
and merging the operation records of the first operation record set according to a merging rule to obtain a merged operation record.
3. The method according to claim 2, wherein the merge rule comprises:
and when the input content is a text, merging the input content of each operation record of the first operation record set according to an operation sequence number.
4. The test case generation method according to any one of claims 1 to 3, wherein the identifying operation content of each device operation according to the interface image includes:
positioning an operation position in the interface image aiming at certain equipment operation;
identifying an operation object and the name of the operation object within a first threshold range from the operation position.
5. The test case generation method according to claim 4, wherein when there are a plurality of operation objects within a first threshold range from the operation position, the plurality of operation objects form an operation object screening set, and the test case generation method further includes:
and screening the operation object screening set according to a priority principle to obtain a target operation object and the name of the target operation object.
6. The method according to claim 5, wherein the precedence rules include:
sequentially judging the operation object screening sets:
whether an operation object containing an operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be the target operation object:
whether an operation object positioned on the left side of the operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be:
whether an operation object positioned at the upper side of the operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be:
whether an operation object positioned at the right side of the operation position exists or not is judged, if yes, the operation object is a target operation object, and if not, the operation object is judged to be:
and whether an operation object positioned at the lower side of the operation position exists or not, and if so, the operation object is a target operation object.
7. The test case generation method according to any one of claims 1 to 3, further comprising:
recording an auxiliary voice description of the operational step to obtain an auxiliary voice recording, wherein the auxiliary voice recording includes content that describes rules of the operational step.
8. The method for generating test cases according to claim 7, further comprising:
modifying the initial test case to obtain a final test case, wherein the modifying the initial test case at least comprises: one of an add operation step, a modify operation step, and a delete operation step.
9. The method for generating test cases according to claim 8, further comprising:
recording the modification content of the initial test case;
learning features of the modified content;
a recommended modification is generated.
10. The method for generating test cases according to claim 8, further comprising:
saving each operation step and the interface image of the initial test case;
and saving each operation step and the interface image of the final test case.
11. The method for generating test cases according to claim 8, further comprising:
exporting the final test case into a text format;
and uploading the final test case.
12. The method for generating test cases according to any of claims 1 to 3, wherein the operation types at least include: one of text input, function key input, mouse click, mouse drag, voice input, and mouse scroll.
13. The test case generation method of claim 4, wherein the operation record further comprises a screen resolution,
the positioning the operation position in the interface image specifically includes: and obtaining the coordinates of the operation position according to the screen resolution to position the operation position in the interface image.
14. A test case generation apparatus comprising:
the device operation recording module is used for recording each device operation of the input device during testing to obtain an operation log, and the operation log comprises operation records of each device operation;
the interface image intercepting module is used for intercepting an interface image after each equipment operation;
the interface image identification module is used for identifying the operation content of each equipment operation according to the interface image;
an operation step obtaining module, configured to describe operation records and operation contents of each device operation and obtain operation steps; and
and the initial test case generation module is used for associating each operation step to generate an initial test case.
15. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-13.
16. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 13.
CN202110698169.9A 2021-06-23 2021-06-23 Test case generation method and device, electronic equipment and medium Pending CN113392014A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110698169.9A CN113392014A (en) 2021-06-23 2021-06-23 Test case generation method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110698169.9A CN113392014A (en) 2021-06-23 2021-06-23 Test case generation method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN113392014A true CN113392014A (en) 2021-09-14

Family

ID=77623528

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110698169.9A Pending CN113392014A (en) 2021-06-23 2021-06-23 Test case generation method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN113392014A (en)

Similar Documents

Publication Publication Date Title
US11726760B2 (en) Systems and methods for entry point-based code analysis and transformation
US20230244476A1 (en) Systems and methods for code analysis heat map interfaces
US10740075B2 (en) Systems and methods for code clustering analysis and transformation
US20210109722A1 (en) Naming Robotic Process Automation Activities According to Automatically Detected Target Labels
US10127147B2 (en) Automated software compliance analysis
CN105205144A (en) Method and system used for data diagnosis and optimization
JP2023107749A (en) Browser-based robotic process automation (RPA) robot design interface
US20230316792A1 (en) Automated generation of training data comprising document images and associated label data
CN116594683A (en) Code annotation information generation method, device, equipment and storage medium
CN113918864A (en) Website page testing method, testing system, testing device, electronic equipment and medium
US11605012B2 (en) Framework for processing machine learning model metrics
US11736556B1 (en) Systems and methods for using a browser to carry out robotic process automation (RPA)
CN116450723A (en) Data extraction method, device, computer equipment and storage medium
CN115760013A (en) Operation and maintenance model construction method and device, electronic equipment and storage medium
US20220198363A1 (en) Compatibility verification of data standards
CN115080433A (en) Testing method and device based on flow playback
US20220100964A1 (en) Deep learning based document splitter
CN113392014A (en) Test case generation method and device, electronic equipment and medium
US20220092263A1 (en) Self-improving document classification and splitting for document processing in robotic process automation
CN114063868A (en) AI (Artificial intelligence) dragging modeling system and method, computer equipment and application
CN111949259A (en) Risk decision configuration method, system, electronic equipment and storage medium
CN116560819B (en) RPA-based batch automatic operation method, system, equipment and storage medium
US20220245060A1 (en) System and Method for Automated Testing
US20230137566A1 (en) Systems and methods for automated change review for enhanced network and data security
CN114266547A (en) Method, device, equipment, medium and program product for identifying business processing strategy

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