Method and device for generating interface cases, electronic device, and storage medium

By monitoring the interface and using the sorting and combination algorithm to generate interface element combinations, screening effective cases, solving the problem of case missing cases caused by unclear testing requirements, and achieving comprehensive coverage of system functions.

CN113849406BActive Publication Date: 2025-01-10AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111120259.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-24
Publication Date
2025-01-10
Estimated Expiration
2041-09-24

AI Technical Summary

Technical Problem

When generating interface test cases, the prior art can easily lead to the absence of cases when the testing requirements are unclear and cannot fully cover all functions of the system.

Method used

By monitoring the initial interface or new interface, scanning and obtaining information about interface elements, using the sorting and combination algorithm to generate all possible element combinations, filtering out valid and invalid cases, ensuring that all functions are covered.

Benefits of technology

When the testing requirements are unclear, all effective interface cases can be effectively generated, covering all functions of the system, and avoiding the absence of cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113849406B_ABST
    Figure CN113849406B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for generating interface cases, an electronic device, and a storage medium. The method comprises: taking an initial interface as a target interface, or whenever a new interface corresponding to a case is triggered by executing any generated case, determining the new interface as a target interface; scanning each element in the target interface and obtaining information of each element; assigning values ​​to the elements according to the value specification in the element information; combining each element using a sorting and combination algorithm to obtain an element combination corresponding to the target interface; if the target interface is an initial interface, determining each element combination as a case corresponding to the target interface; if the target interface is a new interface, splicing the case that triggers the target interface with each element combination to obtain a case corresponding to the target interface; executing each case and recording the execution result of each case; and screening out valid cases and invalid cases of the target interface according to the execution result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing, and in particular to a method and device for generating an interface case, an electronic device, and a storage medium. Background Art

[0002] After the system is developed, it is usually necessary to test the various functions provided by the system interface before it is put online for users to use. During the testing, it is necessary to generate interface test cases.

[0003] The current test case generation method usually determines the test requirements first, and then generates corresponding test cases that meet the test requirements based on the test requirements to test the required functions.

[0004] However, sometimes the requirements of the test system cannot be well determined, that is, the test requirements are not obvious, and it is impossible to generate interface cases in a targeted manner. It is necessary to generate test cases for each interface function of the system, but the existing methods are mainly suitable for generating cases in a targeted manner. Therefore, using the existing methods at this time is prone to missing cases. Summary of the invention

[0005] Based on the above-mentioned deficiencies of the prior art, the present application provides a method and device for generating an interface case, an electronic device, and a storage medium to solve the problem that missing information is easily generated when generating cases in the existing method.

[0006] In order to achieve the above objectives, this application provides the following technical solutions:

[0007] The first aspect of the present application provides a method for generating an interface case, comprising:

[0008] When it is detected that an initial interface is set, the initial interface is used as the target interface, or whenever the execution of any generated case triggers a new interface corresponding to the case, the new interface corresponding to the case is determined as the target interface;

[0009] Scan each element in the target interface and obtain information of each element in the target interface; wherein the information of the element at least includes a value specification of the element;

[0010] Assigning values ​​to each of the elements in the target interface according to the value specification of each of the elements;

[0011] Using a sorting and combination algorithm to combine the elements in the target interface after the assignment, to obtain a plurality of element combinations corresponding to the target interfaces;

[0012] If the target interface is an initial interface, then determining each element combination corresponding to the target interface as a case corresponding to the target interface;

[0013] If the target interface is a new interface corresponding to any generated case, the case that triggers the target interface is combined and spliced ​​with each element corresponding to the target interface to obtain the case corresponding to the target interface;

[0014] Execute each case corresponding to the target interface respectively, and record the execution result of each case corresponding to the target interface;

[0015] According to the execution results of each case corresponding to the target interface, valid cases and invalid cases of the target interface are screened out from the cases corresponding to the target interface; wherein the valid case is a case that causes interface changes when executed; and the invalid case is a case that does not cause interface changes when executed.

[0016] Optionally, in the above-mentioned method for generating interface cases, respectively executing each case corresponding to the target interface and recording the execution result of each case corresponding to the target interface includes:

[0017] Taking each case corresponding to the target interface as a current target case respectively, and executing the current target case;

[0018] When the execution of the current target case triggers a new interface corresponding to the current target case, the milestone point corresponding to the current target case is increased by one;

[0019] When a duplicate interface appears during the execution of the current target case, the rollback point corresponding to the current target case is recorded; wherein the rollback point corresponding to the current target case is the difference between the interface before the duplicate interface appears and the order in which the duplicate interface first appears during the execution process.

[0020] Optionally, in the above-mentioned method for generating interface cases, the step of screening out valid cases and invalid cases of the target interface from the cases corresponding to the target interface according to the execution results of the cases corresponding to the target interface includes:

[0021] Determine the cases with the milestone points increased by one and the cases with the corresponding rollback points in each case corresponding to the target interface as the valid cases of the target interface;

[0022] The cases that do not belong to the valid cases among the cases corresponding to the target interface are determined as invalid cases of the target interface.

[0023] Optionally, in the method for generating the interface case provided above, it also includes:

[0024] Set the system's logout button as a forbidden point; the elements in the interface that are forbidden points cannot be scanned;

[0025] When all the cases whose generated mileage points are not less than 1 are executed and the corresponding mileage points are not increased by 1, the logout button is activated.

[0026] Optionally, in the above-mentioned method for generating the interface case, assigning a value to each of the elements in the target interface according to a value specification of each of the elements includes:

[0027] According to the value specification of each element in the target interface, the forward data and the reverse data corresponding to the element are determined, and the forward data and the reverse data corresponding to the element are bound to the element respectively.

[0028] A second aspect of the present application provides a device for generating an interface case, comprising:

[0029] A target interface determination unit, for determining the initial interface as the target interface when it is detected that the initial interface is set, or whenever the execution of any generated case triggers a new interface corresponding to the case, determining the new interface corresponding to the case as the target interface;

[0030] A scanning unit, used to scan out each element in the target interface and obtain information of each element in the target interface; wherein the information of each element at least includes a value specification of the element;

[0031] An assignment unit, used for assigning a value to each of the elements in the target interface according to a value specification of each of the elements;

[0032] A sorting unit, used to combine the elements in the target interface after the assignment using a sorting combination algorithm to obtain element combinations corresponding to multiple target interfaces;

[0033] A case determination unit, configured to determine, if the target interface is an initial interface, a combination of elements corresponding to the target interface as a case corresponding to the target interface;

[0034] A splicing unit, for, if the target interface is a new interface corresponding to any generated case, splicing the case that triggers the target interface with each element combination corresponding to the target interface, to obtain the case corresponding to the target interface;

[0035] An execution unit, used to respectively execute each case corresponding to the target interface and record the execution result of each case corresponding to the target interface;

[0036] A screening unit is used to screen out valid cases and invalid cases of the target interface from the cases corresponding to the target interface according to the execution results of the cases corresponding to the target interface; wherein the valid case is a case that causes interface changes when executed; and the invalid case is a case that does not cause interface changes when executed.

[0037] Optionally, in the above-mentioned device for generating interface cases, the execution unit includes:

[0038] An execution subunit, used to take each case corresponding to the target interface as a current target case and execute the current target case;

[0039] A superimposing unit, configured to increase the mileage point corresponding to the current target case by one when the execution of the current target case triggers a new interface corresponding to the current target case;

[0040] A recording unit is used to record the rollback point corresponding to the current target case when a repeated interface appears during the execution of the current target case; wherein the rollback point corresponding to the current target case is the difference between the interface before the repeated interface appears and the order in which the repeated interface first appears during the execution process.

[0041] Optionally, in the device for generating the interface case provided above, the screening unit includes:

[0042] A valid case determination unit, used to determine the cases with a mileage point increased by one and the cases with corresponding rollback points recorded in each case corresponding to the target interface as valid cases of the target interface;

[0043] The invalid case determination unit is used to determine the cases that do not belong to the valid cases among the cases corresponding to the target interface as invalid cases of the target interface.

[0044] Optionally, in the device for generating the interface case provided above, it also includes:

[0045] A setting unit, used to set the logout button of the system as a forbidden point; wherein the elements in the interface that are forbidden points cannot be scanned;

[0046] The starting unit is used to start the logout button when all the cases detected to have generated mileage points not less than 1 have been executed and the corresponding mileage points have not been increased by 1.

[0047] Optionally, in the above-mentioned device for generating interface cases, the value assignment unit includes:

[0048] The assignment subunit is used to determine the forward data and the reverse data corresponding to the element according to the value specification of each element in the target interface, and bind the forward data and the reverse data corresponding to the element to the element respectively.

[0049] A third aspect of the present application provides an electronic device, including:

[0050] Memory and processor;

[0051] Wherein, the memory is used to store programs;

[0052] The processor is used to execute the program, and when the program is executed, it is specifically used to implement the method for generating an interface case as described in any one of the above items.

[0053] A fourth aspect of the present application provides a computer storage medium for storing a computer program, which, when executed, is used to implement a method for generating an interface case as described in any one of the above items.

[0054] The present application provides a method for generating an interface case. When it is detected that an initial interface is set, the initial interface is used as the target interface, or whenever the execution of any generated case triggers a new interface corresponding to the case, the new interface corresponding to the case is determined as the target interface. Then, each element in the target interface is scanned, and the information of each element in the target interface is obtained, so as to assign values ​​to each element according to the value specifications in the information of each element in the target interface, and then, the elements in the assigned target interface are combined using a sorting combination algorithm to obtain element combinations corresponding to multiple target interfaces, thereby effectively obtaining all possible element combinations, so as to further generate a full amount of cases for the current interface. Specifically, if the target interface is the initial interface, each element combination corresponding to the target interface is determined as the case corresponding to the target interface; if the target interface is a new interface corresponding to any generated case, the case that triggers the target interface is spliced ​​with each element combination corresponding to the target interface to obtain the case corresponding to the target interface. Then, each case corresponding to the target interface is executed respectively, and the execution results of each case corresponding to the target interface are recorded. Finally, according to whether the interface changes during execution recorded in the execution results of each case, valid cases and invalid cases of the target interface are screened out from the cases corresponding to the target interface. In this way, even if the system testing requirements are unclear, all valid cases can be effectively obtained to fully cover all functions of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0056] Figure 1 A flowchart of a method for generating an interface case provided in an embodiment of the present application;

[0057] Figure 2 A flowchart of a method for screening cases provided in an embodiment of the present application;

[0058] Figure 3 A schematic diagram of the structure of a device for generating an interface case provided in an embodiment of the present application;

[0059] Figure 4 A schematic diagram of the structure of an execution unit provided in an embodiment of the present application;

[0060] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0061] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0062] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0063] The present application embodiment provides a method for generating an interface case, such as Figure 1 As shown, including:

[0064] S101. When it is detected that an initial interface is set, the initial interface is used as a target interface, or whenever the execution of any generated case triggers a new interface corresponding to the case, the new interface corresponding to the case is determined as a target interface.

[0065] When the interface case needs to be generated, the tester may need to select the initial interface, from which the subsequent interfaces can be jumped. Usually, the system login interface is set as the initial interface. So when the initial interface is set, the initial interface is used as the target interface to process the initial interface.

[0066] Since a case of an interface generated by execution has issued a new interface corresponding to the case, the case can continue. Therefore, the new interface corresponding to the case is determined as the target interface at this time to continue processing the new interface to eventually obtain a more complete case.

[0067] It should be noted that, except for the case of the initial interface, the cases of other interfaces are obtained by combining the case of the previous interface with the elements of this interface. Therefore, the new interface corresponding to a case refers to the case of the previous interface of the case, which has not appeared during execution.

[0068] That is to say, when a case is executed and jumps to a new interface, it means that the case can continue to the new interface to obtain a new case. Therefore, it is necessary to combine the case with the elements of the new interface to obtain a more complete case, that is, to obtain a case that can reach the current interface through one or more jumps from the initial interface when executed.

[0069] S102: Scan each element in the target interface and obtain information of each element in the target interface.

[0070] It should be noted that the elements in the target interface may refer to various controls in object-oriented programming in the interface, such as buttons, text boxes, drop-down boxes, etc., which are a series of objects used to meet user interaction needs.

[0071] The information of an element at least includes the value specification of the element, and may include positioning, attributes, values, specifications, etc.

[0072] Optionally, the information of each element in the target interface can be obtained when scanning the target interface, or can be configured by the tester according to needs. Of course, both methods can be used at the same time to obtain the element information, or other methods can be used to obtain the element information.

[0073] S103, assigning values ​​to each element in the target interface according to the value specification of each element.

[0074] Specifically, for each element with a value specification, the data corresponding to each element is generated based on the value specification of each element, and bound to the element to complete the copy of the element, so that when the case is executed, the element is implemented according to the bound data. For example, the element "user name" requires the user to enter the ID number, so it is necessary to generate an ID number that meets the specification based on the value specification of this element, and bind it to the "user name", so that when the case is executed, the generated ID number is entered in the "user name" element.

[0075] Optionally, in order to effectively and comprehensively cover the forward and reverse test scenarios, in another embodiment of the present application, a specific implementation of step S103 includes:

[0076] According to the value specification of each element in the target interface, the forward data and the reverse data corresponding to the element are determined, and the forward data and the reverse data corresponding to the element are bound to the element respectively.

[0077] For example, if the user name (text box) requires an ID number, then bind it to the correct ID number and the wrong ID number. For another example, if the query condition is the date, bind it to the past date, the current date, and the future date, etc.

[0078] S104: using a sorting and combination algorithm to combine the elements in the target interface after the assignment, to obtain element combinations corresponding to multiple target interfaces.

[0079] For the elements in an interface, the user may operate any one of them, or randomly operate multiple elements in sequence, so the sorting combination algorithm is used to combine the elements in the target interface after the assignment, so as to cover all situations.

[0080] For example, the target interface is a login interface, which includes three elements: user name (text box), password (text box) and login (button), and 15 element combinations as shown in Table 1 below can be generated.

[0081] Table 1

[0082]

[0083]

[0084] Optionally, in order to make the case more complete, the operation corresponding to the element can also be determined according to the type of the element. As shown in Table 1 above, for a text box type element, the operation corresponding to the element is determined to be input string, and for a button type element, the operation corresponding to the element is determined to be click.

[0085] S105: Determine whether the target interface is an initial interface.

[0086] It should be noted that for a new interface corresponding to any previously generated case, when generating its corresponding case, splicing is required, so if it is determined that the target interface does not belong to the initial interface, that is, the target interface is a new interface corresponding to any generated case, step S107 is executed. If it is determined that the target interface is the initial interface, step S106 is executed.

[0087] S106: Determine the combination of elements corresponding to the target interface as a case corresponding to the target interface.

[0088] S107, combining and splicing the cases that trigger the target interface with the elements corresponding to the target interface respectively, to obtain the cases corresponding to the target interface.

[0089] Specifically, the elements corresponding to the target interface are combined and spliced ​​behind the case that triggers the target interface to obtain multiple cases corresponding to the target interface.

[0090] S108. Execute each case corresponding to the target interface respectively, and record the execution result of each case corresponding to the target interface.

[0091] The execution result at least includes information indicating whether an interface change occurs during execution. The interface change may specifically trigger a new interface or trigger the appearance of a duplicate interface, that is, the subsequent interface jumps back to the previous interface.

[0092] It should be noted that each case corresponding to the target interface is executed independently. When a corresponding new interface is triggered during the execution of a case, it is necessary to return to step S101 for the new interface corresponding to the case, that is, to use the new interface corresponding to the case as the target interface to execute the method provided in the embodiment of the present application.

[0093] S109. Filter out valid cases and invalid cases of the target interface from the cases corresponding to the target interface according to the execution results of the cases corresponding to the target interface.

[0094] Among them, valid cases are cases that cause interface changes when executed. Invalid cases are cases that do not cause interface changes when executed. Since all the possibilities of cases are combined through sorting combinations, there are cases that do not comply with the operating rules or meaningless cases. For example, for the examples shown in Table 1, it is meaningless to execute an element alone, or click login after entering the password, and then enter the account name. This is obviously not in compliance with the operating rules and is meaningless. The interface changes when the case is executed, which just shows that the generated case complies with the operating rules of the interface and is meaningful, so it is determined as a valid case. Correspondingly, if there is no interface change when the case is executed, it means that the case is meaningless, so it is determined as an invalid case.

[0095] Optionally, in another embodiment of the present application, a specific implementation of step S108 includes:

[0096] Each case corresponding to the target interface is taken as the current target case, and the current target case is executed.

[0097] When the execution of the current target case triggers a new interface corresponding to the current target case, the mileage point corresponding to the current target case is increased by one.

[0098] When a duplicate interface appears during the execution of the current target case, the rollback point corresponding to the current target case is recorded.

[0099] Among them, the rollback point corresponding to the current target case is the difference between the interface before the repeated interface appears and the order in which the repeated interface first appears during the execution process.

[0100] It should be noted that the corresponding milestone of a case is the order in which the corresponding target interface appears during the execution of the case, that is, when executing the case, the jump from the initial interface to the target interface corresponding to the case begins, so the milestone of the case corresponding to the initial interface is 0. For this reason, when the execution of the current target case triggers a new interface corresponding to the current target case, the current target case will be subsequently combined with the corresponding new interface to obtain a new case, so the milestone will also increase accordingly, so at this time, the milestone corresponding to the current target case is increased by one. The purpose of recording the rollback point is to record the location point where the case rolls back.

[0101] In the embodiment of the present application, the corresponding implementation of step S109 is as follows: Figure 2 As shown, including:

[0102] S201. Determine the cases whose milestone points are increased by one and the cases with corresponding rollback points recorded in the cases corresponding to the target interface as valid cases of the target interface.

[0103] S202: Determine the cases that are not valid cases among the cases corresponding to the target interface as invalid cases of the target interface.

[0104] Optionally, in order to stop the execution process in time and avoid executing unnecessary work, and to avoid ending the case generation process when all cases are not completely generated, in the embodiment of the present application, the following may be further included:

[0105] Set the system's logout button as a forbidden point, and activate the logout button when all cases detected to have generated mileage points not less than 1 have been executed and the corresponding mileage points have not been increased by 1.

[0106] Among them, the elements in the interface that are forbidden points cannot be scanned. In other words, the logout button does not participate in the arrangement and combination of elements, because when the logout button is executed, the system will be exited, thus avoiding the logout button being executed when the case is not fully generated, thus ending the case generation process and making it impossible to obtain the full amount of cases, so it needs to be set as a forbidden point.

[0107] When all cases with milestone points not less than 1 are executed and the corresponding milestone points are not increased by 1, it means that there are no more valid cases, so the logout button is activated at this time to avoid continuing to perform unnecessary work.

[0108] The embodiment of the present application provides a method for generating interface cases. When it is detected that an initial interface is set, the initial interface is used as the target interface, or whenever the execution of any generated case triggers a new interface corresponding to the case, the new interface corresponding to the case is determined as the target interface. Then, each element in the target interface is scanned, and the information of each element in the target interface is obtained, so as to assign values ​​to each element according to the value specifications in the information of each element in the target interface, and then, the elements in the assigned target interface are combined using a sorting combination algorithm to obtain element combinations corresponding to multiple target interfaces, thereby effectively obtaining all possible element combinations, so as to further generate a full range of cases for the current interface. Specifically, if the target interface is the initial interface, each element combination corresponding to the target interface is determined as the case corresponding to the target interface; if the target interface is a new interface corresponding to any generated case, the case that triggers the target interface is spliced ​​with each element combination corresponding to the target interface to obtain the case corresponding to the target interface. Then, each case corresponding to the target interface is executed respectively, and the execution results of each case corresponding to the target interface are recorded. Finally, according to whether the interface changes during execution recorded in the execution results of each case, valid cases and invalid cases of the target interface are screened out from the cases corresponding to the target interface. In this way, even if the system testing requirements are unclear, all valid cases can be effectively obtained to fully cover all functions of the system.

[0109] The present application embodiment provides a device for generating an interface case, such as Figure 3 As shown, it includes the following units:

[0110] The target interface determination unit 301 is used to determine the initial interface as the target interface when it is detected that the initial interface is set, or whenever the execution of any generated case triggers a new interface corresponding to the case, determine the new interface corresponding to the case as the target interface.

[0111] The scanning unit 302 is used to scan each element in the target interface and obtain information of each element in the target interface.

[0112] The information of the element at least includes the value specification of the element.

[0113] The value assignment unit 303 is used to assign a value to each of the elements in the target interface according to the value specification of each of the elements;

[0114] The sorting unit 304 is used to combine the elements in the target interface after the assignment using a sorting combination algorithm to obtain element combinations corresponding to multiple target interfaces.

[0115] The case determination unit 305 is configured to determine, if the target interface is an initial interface, each element combination corresponding to the target interface as a case corresponding to the target interface.

[0116] The splicing unit 306 is used to combine and splice the cases that trigger the target interface with the elements corresponding to the target interface to obtain the cases corresponding to the target interface if the target interface is a new interface corresponding to any generated case.

[0117] The execution unit 307 is used to execute each case corresponding to the target interface respectively, and record the execution result of each case corresponding to the target interface.

[0118] The screening unit 308 is used to screen out valid cases and invalid cases of the target interface from the cases corresponding to the target interface according to the execution results of the cases corresponding to the target interface.

[0119] Among them, the valid case is a case that causes interface changes during execution; the invalid case is a case that does not cause interface changes during execution.

[0120] Optionally, in the device for generating an interface case provided in another embodiment of the present application, the execution unit, such as Figure 4 As shown, including:

[0121] The execution subunit 401 is used to respectively take each case corresponding to the target interface as a current target case and execute the current target case.

[0122] The superimposing unit 402 is used to increase the mileage point corresponding to the current target case by one when the execution of the current target case triggers a new interface corresponding to the current target case.

[0123] The recording unit 403 is used to record the rollback point corresponding to the current target case when a repeated interface appears during the execution of the current target case.

[0124] The rollback point corresponding to the current target case is the difference between the interface before the repeated interface appears and the order in which the repeated interface first appears during the execution process.

[0125] Optionally, in the device for generating interface cases provided in another embodiment of the present application, the screening unit includes:

[0126] A valid case determination unit, used to determine the cases with a mileage point increased by one and the cases with corresponding rollback points recorded in each case corresponding to the target interface as valid cases of the target interface;

[0127] The invalid case determination unit is used to determine the cases that do not belong to the valid cases among the cases corresponding to the target interface as invalid cases of the target interface.

[0128] Optionally, the device for generating an interface case provided in another embodiment of the present application further includes:

[0129] A setting unit is used to set the logout button of the system as a forbidden point.

[0130] Among them, elements in the interface that are forbidden points cannot be scanned.

[0131] The starting unit is used to start the logout button when all the cases detected to have generated mileage points not less than 1 have been executed and the corresponding mileage points have not been increased by 1.

[0132] Optionally, in the device for generating an interface case provided in another embodiment of the present application, the assignment unit includes:

[0133] The assignment subunit is used to determine the forward data and the reverse data corresponding to the element according to the value specification of each element in the target interface, and bind the forward data and the reverse data corresponding to the element to the element respectively.

[0134] It should be noted that the specific working process of each unit provided in the above embodiments of the present application can refer to the corresponding steps in the above method embodiments, and will not be repeated here.

[0135] Another embodiment of the present application provides an electronic device, such as Figure 5 As shown, including:

[0136] Memory 501 and processor 502 .

[0137] The memory 501 is used to store programs.

[0138] The processor 502 is used to execute the program stored in the memory 501, and when the program is executed, it is specifically used to implement the method for generating an interface case provided by any one of the above embodiments.

[0139] Another embodiment of the present application provides a computer storage medium for storing a computer program. When the computer program is executed, it is used to implement a method for generating an interface case as provided in any one of the above embodiments.

[0140] Computer storage media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0141] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0142] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating an interface case, characterized in that: include: When it is detected that an initial interface is set, the initial interface is used as the target interface, or whenever the execution of any generated case triggers a new interface corresponding to the case, the new interface corresponding to the case is determined as the target interface; Scan each element in the target interface and obtain information of each element in the target interface; wherein the information of the element at least includes a value specification of the element; Assigning values ​​to each of the elements in the target interface according to the value specification of each of the elements; Using a sorting and combination algorithm to combine the elements in the target interface after the assignment, to obtain a plurality of element combinations corresponding to the target interfaces; If the target interface is an initial interface, then determining each element combination corresponding to the target interface as a case corresponding to the target interface; If the target interface is a new interface corresponding to any generated case, the case that triggers the target interface is combined and spliced ​​with each element corresponding to the target interface to obtain the case corresponding to the target interface; Execute each case corresponding to the target interface respectively, and record the execution result of each case corresponding to the target interface; According to the execution results of each case corresponding to the target interface, the valid case and the invalid case of the target interface are screened out from each case corresponding to the target interface; wherein the valid case is a case that causes interface changes when executed; and the invalid case is a case that does not cause interface changes when executed; The respectively executing each case corresponding to the target interface and recording the execution result of each case corresponding to the target interface includes: Taking each case corresponding to the target interface as a current target case respectively, and executing the current target case; When the execution of the current target case triggers a new interface corresponding to the current target case, the milestone point corresponding to the current target case is increased by one; When a repeated interface appears during the execution of the current target case, the rollback point corresponding to the current target case is recorded; wherein the rollback point corresponding to the current target case is the difference between the interface before the repeated interface appears and the order in which the repeated interface first appears during the execution process; The step of screening out valid cases and invalid cases of the target interface from the cases corresponding to the target interface according to the execution results of the cases corresponding to the target interface includes: Determine the cases with the milestone points increased by one and the cases with the corresponding rollback points in each case corresponding to the target interface as the valid cases of the target interface; The cases that do not belong to the valid cases among the cases corresponding to the target interface are determined as invalid cases of the target interface.

2. The method according to claim 1, characterized in that Also includes: Set the system's logout button as a forbidden point; the elements in the interface that are forbidden points cannot be scanned; When all the cases whose generated mileage points are not less than 1 are executed and the corresponding mileage points are not increased by 1, the logout button is activated.

3. The method according to claim 1, characterized in that The assigning a value to each of the elements in the target interface according to a value specification of each of the elements includes: According to the value specification of each element in the target interface, the forward data and the reverse data corresponding to the element are determined, and the forward data and the reverse data corresponding to the element are bound to the element respectively.

4. A device for generating an interface case, characterized in that: include: A target interface determination unit, for determining the initial interface as the target interface when it is detected that the initial interface is set, or whenever the execution of any generated case triggers a new interface corresponding to the case, determining the new interface corresponding to the case as the target interface; A scanning unit, used to scan out each element in the target interface and obtain information of each element in the target interface; wherein the information of each element at least includes a value specification of the element; An assignment unit, used for assigning a value to each of the elements in the target interface according to a value specification of each of the elements; A sorting unit, used for combining the elements in the target interface after the assignment using a sorting combination algorithm to obtain element combinations corresponding to a plurality of the target interfaces; A case determination unit, configured to determine, if the target interface is an initial interface, a combination of elements corresponding to the target interface as a case corresponding to the target interface; A splicing unit, for, if the target interface is a new interface corresponding to any generated case, splicing the case that triggers the target interface with each element combination corresponding to the target interface, to obtain the case corresponding to the target interface; An execution unit, used to respectively execute each case corresponding to the target interface and record the execution result of each case corresponding to the target interface; A screening unit, for screening out valid cases and invalid cases of the target interface from the cases corresponding to the target interface according to the execution results of the cases corresponding to the target interface; wherein the valid case is a case that causes interface changes when executed; and the invalid case is a case that does not cause interface changes when executed; The execution unit comprises: An execution subunit, used to take each case corresponding to the target interface as a current target case and execute the current target case; A superimposing unit, configured to increase the mileage point corresponding to the current target case by one when the execution of the current target case triggers a new interface corresponding to the current target case; A recording unit, used for recording a rollback point corresponding to the current target case when a repeated interface appears during the execution of the current target case; wherein the rollback point corresponding to the current target case is the difference between the interface before the repeated interface appears and the order in which the repeated interface first appears during the execution process; The screening unit comprises: A valid case determination unit, used to determine the cases with a mileage point increased by one and the cases with corresponding rollback points recorded in each case corresponding to the target interface as valid cases of the target interface; The invalid case determination unit is used to determine the cases that do not belong to the valid cases among the cases corresponding to the target interface as invalid cases of the target interface.

5. An electronic device, characterized in that: include: Memory and processor; Wherein, the memory is used to store programs; The processor is used to execute the program, and when the program is executed, it is specifically used to implement the method for generating an interface case as described in any one of claims 1 to 3.

6. A computer storage medium, characterized in that: Used to store a computer program, which, when executed, is used to implement the method for generating an interface case as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Demand testability analysis method and system

    CN104281523A

  • Front-end system testing method and device

    CN109800165A