UI testing method, device, medium and computer equipment
By sorting the components in the UI test method and analyzing the result matrix, flexible test expressions and scripts are generated, which solves the problem of inefficiency in the existing UI test methods and realizes flexible testing of different interfaces.
Patent Information
- Application Number
- CN202411907999.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-12-24
AI Technical Summary
Existing UI testing methods are difficult to achieve flexible testing of different interfaces, resulting in inefficient testing.
By matching test items to different components, sorting tests in three cases are carried out to build the result matrix, determine flexible testing requirements, form test expressions and generate test scripts to achieve flexible testing of different interfaces.
Improve the flexibility and efficiency of UI testing, ensure the flexibility and adjustment of test scripts, and adapt to the testing needs of different interfaces.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a UI testing method, device, medium and computer equipment, belonging to the technical field of UI testing. Background Art
[0002] Due to the global popularity of websites and applications, user interface testing is more important than ever. If you are launching a new software or web page, getting the user interface (UI) right to balance functionality and aesthetics is crucial.
[0003] There are many things that go into creating a compelling UI, and UI testing acts as a litmus test to determine whether the interface is up to par.
[0004] Common testing methods include manual testing. Since it is ultimately a manual process, manual WebUl testing is prone to human errors. Manual testing may miss errors due to lack of concentration or distraction. In contrast, automated UI testing eliminates the human factor in the process, making it less prone to these types of problems.
[0005] In most cases, the existing tests of different interfaces use fixed test scripts. Due to the fixedness of the scripts, it is impossible to perform good test analysis on the interface and to implement flexible testing of different interfaces, resulting in low test efficiency.
[0006] Therefore, the present invention provides a UI testing method, device, medium and computer equipment. Summary of the invention
[0007] In view of the deficiencies of the above-mentioned prior art, the object of the present invention is to provide a UI testing method, apparatus, medium and computer equipment, which construct a result matrix by matching test items to different components and then performing three-case sorting tests on the items, obtain different flexible testing requirements, and then construct test expressions to obtain test scripts, so as to ensure the flexible adjustability of the scripts, realize flexible testing of different interfaces, and thus improve testing efficiency.
[0008] The present invention provides a UI testing method, comprising:
[0009] Step 1: mining the construction code base of the interface to be tested and the link components and interface components based on the construction code base;
[0010] Step 2: Obtain the first test item matching each link component and the second test item matching each interface component, and sort all the first test items and the second test items to obtain a number of sorting results;
[0011] Step 3: According to each sorting result, the corresponding sorting items are controlled to test the interfaces to be tested in sequence, and the test results under each sorting result are obtained respectively, and a result matrix is constructed;
[0012] Step 4: Analyze the result matrix, determine the flexible test requirements based on each test item, and compose the test expressions of the corresponding components to combine all the test expressions, obtain the test script and store it.
[0013] Preferably, all the first test items and the second test items are sorted to obtain several sorting results, including:
[0014] Obtain the link jump element of each link component and the jump range of each link jump element, and obtain the executable script for the corresponding link component;
[0015] matching a first test item known to the executable script from a script-item database;
[0016] At the same time, the type and quantity of the construction elements of each interface component are determined to obtain the component vector of the corresponding interface component;
[0017] Inputting the component vector into a vector parsing model to obtain a test factor set, and matching a second test item matching the test factor set from a factor-item database;
[0018] Determine respectively the execution time of the link component and the interface component after the software engine corresponding to the interface to be tested is started, and sort the first test items and the second test items involved according to the execution time;
[0019] At the same time, according to the component attributes of each component, a standard response delay time is configured for the corresponding component, and the standard response delay time is added to the execution time of the corresponding component to obtain a first new time, and the first test items and the second test items involved are sorted in order according to the first new time;
[0020] Analyze the mutual influence relationship between each component and all other components according to the construction code library of the interface to be tested, and then assign execution priorities to the corresponding components, and sort the first test items and the second test items involved according to the priority results;
[0021] Among them, all the obtained sequential sorting results are the corresponding several sorting results.
[0022] Preferably, obtaining an executable script for a corresponding link component includes:
[0023] Extracting jump marks from the component construction file of the link component, and counting the number of occurrences of each jump mark and the associated links involved in the corresponding occurrences of the corresponding jump mark, wherein each jump mark corresponds to a link jump element;
[0024] Count the jump range of each jump mark based on all associated links;
[0025] According to each link jump element and jump range, obtain the sub-script corresponding to the link jump element;
[0026] Determine the mapping relationship between the link component and the interface to be tested, and extract the theoretical fitness of the corresponding link component under different test indicators based on the relationship-fitness comparison table;
[0027] According to the layout range of the jump mark in the component construction file and in combination with the theoretical fitness under different test indicators, a first value is assigned to the corresponding link jump element;
[0028] The first value is adjusted according to the number of occurrences of the corresponding jump mark to obtain a second value;
[0029] All second values are sorted by size, and the sub-scripts of the link jump elements are sorted in order according to the size sorting result, and the executable script is obtained by combining them.
[0030] Preferably, the result matrix is analyzed to determine flexible test requirements based on each test item, including:
[0031] Performing result discrete analysis on each column vector in the result matrix to obtain the discreteness of the corresponding column vector;
[0032] Performing a first calibration on columns with a discreteness greater than or equal to a preset degree, and performing a second calibration on columns with a discreteness less than a preset degree;
[0033] Combining the first calibration result and the second calibration result under the same test item, constructing an item vector;
[0034] Inputting the item vector into the requirement analysis vector to obtain the flexible test requirements of the corresponding test items;
[0035] The rows of the result matrix correspond to the test results under the sorting results, and the columns of the result matrix are the test results under the same test parameters.
[0036] Preferably, the test expression of the corresponding component is constructed, including:
[0037] Decomposing the flexible test requirement to obtain a number of requirement parameters;
[0038] Combine the required parameters according to the theoretical execution order to obtain a combined expression;
[0039] According to the mapping comparison relationship between the required parameters and the parameter variables, a calibration mapping result is set for the corresponding required parameters, wherein the calibration mapping result includes: the number of parameter variables of the first calibration, the number of parameter variables of the second calibration, and the parameter variables of the second calibration are used as the non-changeable expression, and the parameter variables of the first calibration are used as the changeable expression;
[0040] The calibration mapping result of each required parameter is merged with the combined expression to obtain the test expression of the corresponding component.
[0041] Preferably,
[0042] The test expression includes the test conditions of the corresponding component and the test editing operation;
[0043] The test editing operation is an operation to change the component evaluation criteria.
[0044] Preferably, all test expressions are combined to obtain and store test scripts, including:
[0045] Extract the expression field for each requirement parameter from each test expression, and perform cluster analysis on all requirement parameters under the corresponding flexible test requirement to obtain the test dimension;
[0046] Combine all expression fields under the same test dimension to obtain the first expression;
[0047] Performing separate similarity calculations on dimension fields under different test dimensions in the first expression, and obtaining the overall similarity of the corresponding first expression;
[0048] Randomly select a field from the dimension fields whose individual similarity is greater than the second preset similarity in the first expression whose overall similarity is greater than the first preset similarity for script matching, and perform script matching on all the dimension fields whose individual similarity is not greater than the second preset similarity;
[0049] Perform script matching on all the dimensional fields in the first expression whose overall similarity is not greater than the first preset similarity;
[0050] The test dimensions involved in each first expression are sorted by the number of dimensions, and the test script is obtained and stored based on the size sorting result and the script matching result of each first expression.
[0051] The present invention provides a UI testing device, comprising:
[0052] A component mining module is used to mine the construction code library of the interface to be tested and the link components and interface components based on the construction code library;
[0053] An item sorting module is used to obtain a first test item matching each link component and a second test item matching each interface component, and sort all the first test items and the second test items to obtain a number of sorting results;
[0054] A matrix construction module, used to control the corresponding sorting items according to each sorting result to test the interfaces to be tested in sequence, and obtain the test results under each sorting result respectively, and construct a result matrix;
[0055] The expression building module is used to analyze the result matrix, determine the flexible test requirements based on each test item, and build the test expressions of the corresponding components to combine all the test expressions to obtain and store the test scripts.
[0056] The present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor is enabled to execute the steps of any one of the methods.
[0057] The present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] By matching test items to different components and then performing three-case sorting tests on the items to build a result matrix, different flexible test requirements are obtained, and then test expressions are constructed to obtain test scripts, which ensures the flexible adjustability of the scripts, realizes flexible testing of different interfaces, and thus improves test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A flowchart of a UI testing method of the present invention;
[0061] Figure 2 This is a structural diagram of a UI testing device of the present invention. DETAILED DESCRIPTION
[0062] In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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 the field without creative work are within the scope of protection of this application.
[0063] It should be noted that when an element is referred to as being "fixed on" or "set on" another component, it can be directly on the other component or indirectly set on the other component; when a component is referred to as being "connected to" another component, it can be directly connected to the other component or indirectly connected to the other component.
[0064] It should be understood that the orientation or position relationship indicated by terms such as "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside" and "outside" are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or component referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0065] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, "multiple" and "several" mean two or more, unless otherwise clearly and specifically defined.
[0066] It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification for people familiar with this technology to understand and read, and are not used to limit the conditions under which this application can be implemented. Therefore, they have no substantive technical significance. Any structural modification, change in proportional relationship or adjustment of size should still fall within the scope of the technical content disclosed in this application without affecting the effects and purposes that can be achieved by this application.
[0067] The present invention provides a UI testing method, such as Figure 1 As shown, including:
[0068] Step 1: mining the construction code base of the interface to be tested and the link components and interface components based on the construction code base;
[0069] Step 2: Obtain the first test item matching each link component and the second test item matching each interface component, and sort all the first test items and the second test items to obtain a number of sorting results;
[0070] Step 3: According to each sorting result, the corresponding sorting items are controlled to test the interfaces to be tested in sequence, and the test results under each sorting result are obtained respectively, and a result matrix is constructed;
[0071] Step 4: Analyze the result matrix, determine the flexible test requirements based on each test item, and compose the test expressions of the corresponding components to combine all the test expressions, obtain the test script and store it.
[0072] In this example, UI testing is a useful way to evaluate how your application handles certain actions, such as interacting with a menu using the keyboard and mouse. It helps check the visual elements of your application to make sure they display correctly. In this example, UI testing is also a good way to measure performance and ensure that your application functions without any bugs or issues.
[0073] In this embodiment, the interface to be tested refers to an interface on which various components have been built, and may be any network interface or display interface.
[0074] In this embodiment, building a code library refers to the building code involved in the process of building the corresponding page, such as the code for HTTP web pages, and the execution and display results of the interface are implemented according to the code logic, that is, it already exists during the building process.
[0075] In this embodiment, the link component refers to the component that jumps between the interface and other interfaces. For example, clicking block 01 on interface A can jump to interface B. The interface component refers to the component that affects the aesthetics of the interface. For example, the term search box component is presented in a rectangular form.
[0076] In this embodiment, the first test item and the second test item are both obtained by matching from a known database, which facilitates targeted testing of the component to ensure the reliability of the component.
[0077] In this embodiment, the plurality of sorting results include three kinds of sorting results, namely: sorting based on the execution time after the software engine corresponding to the interface to be tested is started, sorting based on the standard response delay time, and sorting based on mutual influence relationship.
[0078] In this embodiment, the result matrix = .
[0079] In this embodiment, the flexible test requirement is obtained based on the discreteness of the values involved in each column in the matrix. The larger the discreteness, the more flexible it is, and the smaller the discreteness, the less flexible it is. The more flexible it is, the higher the possibility of the code being changeable.
[0080] In this embodiment, the test expression is obtained based on the analysis of various variable combinations involved in the flexible test requirements.
[0081] In this embodiment, combining refers to grouping the involved expressions together.
[0082] In this embodiment, the test script is closely related to the test item.
[0083] The beneficial effect of the above technical solution is: by matching test items to different components and then performing three-case sorting tests on the items to construct a result matrix, different flexible test requirements are obtained, and then test expressions are constructed to obtain test scripts, which is convenient for ensuring the flexible adjustability of the script to achieve flexible testing of different interfaces, thereby improving test efficiency.
[0084] The present invention provides a UI testing method, which sorts all first test items and second test items to obtain several sorting results, including:
[0085] Obtain the link jump element of each link component and the jump range of each link jump element, and obtain the executable script for the corresponding link component;
[0086] matching a first test item known to the executable script from a script-item database;
[0087] At the same time, the type and quantity of the construction elements of each interface component are determined to obtain the component vector of the corresponding interface component;
[0088] Inputting the component vector into a vector parsing model to obtain a test factor set, and matching a second test item matching the test factor set from a factor-item database;
[0089] Determine respectively the execution time of the link component and the interface component after the software engine corresponding to the interface to be tested is started, and sort the first test items and the second test items involved according to the execution time;
[0090] At the same time, according to the component attributes of each component, a standard response delay time is configured for the corresponding component, and the standard response delay time is added to the execution time of the corresponding component to obtain a first new time, and the first test items and the second test items involved are sorted in order according to the first new time;
[0091] Analyze the mutual influence relationship between each component and all other components according to the construction code library of the interface to be tested, and then assign execution priorities to the corresponding components, and sort the first test items and the second test items involved according to the priority results;
[0092] Among them, all the obtained sequential sorting results are the corresponding several sorting results.
[0093] In this embodiment, the script-project database includes test projects matching the executable scripts and is pre-stored.
[0094] In this embodiment, the construction elements refer to the corresponding interface components involved, such as color elements, frame building elements, layout elements, etc., and the quantity refers to the number of occurrences of each element. For example, the color elements involve presenting position B1 in yellow and position B2 in green, etc. At this time, the number involved is 2.
[0095] In this embodiment, component vector={all building elements-element type-occurrence number}.
[0096] In this embodiment, the vector parsing model is obtained by training the neural network model based on different element combinations and the required test indicators for the combination as samples. Therefore, for example, indicators such as stability and flexibility, the required test indicators here can be regarded as test factors, and multiple test factors constitute a factor set.
[0097] In this embodiment, the factor-item database includes test items that match the test factor set. For example, test factor 1+test factor 2--item 01 can be directly matched.
[0098] In this embodiment, after the interface is built, each interface can rely on its engine to start to determine the execution effect of the interface (the case where all components are executed). During the execution process, the execution time of the link component and the interface component can be determined in turn.
[0099] In this embodiment, the component attribute refers to the function performed by the corresponding component, and then the standard response delay time of each component is obtained by matching according to the function-time comparison table, and the table is pre-set and includes different functions and standard response delay times for the functions.
[0100] In this embodiment, the first new time=execution time+standard response delay time.
[0101] In this embodiment, the mutual influence relationship between components is matched by inputting the execution logic and function of each component determined based on the code library into the relationship analysis data table. For example, component 2 exists only for component 1, which means that component 2 has no value when used alone and needs to rely on component 1 to be used.
[0102] In this embodiment, the execution priority is the final value obtained by accumulating the mutual influence coefficients corresponding to the mutual influence relationship. The larger the final value, the higher the corresponding priority, that is, the higher the ranking.
[0103] In this embodiment, the order of the items is different, and the corresponding overall test conditions are also different.
[0104] The beneficial effects of the above technical solution are: based on the jump elements and jump ranges, the executable script of the link component is determined to obtain the first test item, and based on the type and number of building elements of the interface component, the component vector is determined to match the second test item, and the items are sorted in order in three ways to provide a basis for subsequent testing.
[0105] The present invention provides a UI testing method, which obtains an executable script for a corresponding link component, including:
[0106] Extracting jump marks from the component construction file of the link component, and counting the number of occurrences of each jump mark and the associated links involved in the corresponding occurrences of the corresponding jump mark, wherein each jump mark corresponds to a link jump element;
[0107] Count the jump range of each jump mark based on all associated links;
[0108] According to each link jump element and jump range, obtain the sub-script corresponding to the link jump element;
[0109] Determine the mapping relationship between the link component and the interface to be tested, and extract the theoretical fitness of the corresponding link component under different test indicators based on the relationship-fitness comparison table;
[0110] According to the layout range of the jump mark in the component construction file and in combination with the theoretical fitness under different test indicators, a first value is assigned to the corresponding link jump element;
[0111] The first value is adjusted according to the number of occurrences of the corresponding jump mark to obtain a second value;
[0112] All second values are sorted by size, and the sub-scripts of the link jump elements are sorted in order according to the size sorting result, and the executable script is obtained by combining them.
[0113] In this embodiment, the component construction file refers to the input code for the component, and the jump mark is pre-set, for example, the code mark: location.href (page jump), window.location.href (jump after button event click), window.open() (address jump), etc., so as to count the number of occurrences of each mark respectively.
[0114] In this embodiment, the associated link refers to the associated position to which the corresponding mark finally jumps. It should be noted that the jump mark is a link jump element.
[0115] In this embodiment, the jump range refers to: for example, for location.href (page jump), it involves jumping from interface A to interface B, and from interface A to interface C. At this time, interface B and interface C are the jump range for the jump mark location.href.
[0116] In this embodiment, the sub-script refers to the sub-scripts that are obtained by counting all the situation scripts involved in the jump range together, that is, obtaining the sub-scripts corresponding to the link jump elements.
[0117] In this embodiment, the mapping relationship refers to the importance of the component in the interface to be tested and the component type, that is, the importance and type of each component are pre-planned during the interface layout process. Therefore, the relationship-fitness comparison table includes different mapping relationships and theoretical fitness under different test indicators based on the corresponding component types, which can be directly matched.
[0118] In this embodiment, the layout range refers to the display position of the corresponding link component in the entire interface.
[0119] The first value = the sum of the position weights corresponding to the displayed position × (the theoretical fitness of each test indicator × the sum of the indicator weights).
[0120] In this embodiment, the second value=the first value×ln(e+the number of occurrences of the corresponding jump mark / the total number of occurrences of all jump marks).
[0121] In this embodiment, the second values are sorted by size, and all sub-scripts are sorted by consistency according to the sorting result, and the obtained result is the executable script.
[0122] The beneficial effect of the above technical solution is: by extracting the jump mark to determine the number of occurrences and the associated links, a sub-script based on the jump range is obtained, and the value of each link jump element is obtained by combining the theoretical fitness and the number of occurrences, and then an executable script is obtained, ensuring the rationality of script acquisition, providing a basis for subsequent execution, and also providing a basis for flexible interface testing.
[0123] The present invention provides a UI testing method, which analyzes the result matrix and determines flexible testing requirements based on each test item, including:
[0124] Performing result discrete analysis on each column vector in the result matrix to obtain the discreteness of the corresponding column vector;
[0125] Performing a first calibration on columns with a discreteness greater than or equal to a preset degree, and performing a second calibration on columns with a discreteness less than a preset degree;
[0126] Combining the first calibration result and the second calibration result under the same test item, constructing an item vector;
[0127] Inputting the item vector into the requirement analysis vector to obtain the flexible test requirements of the corresponding test items;
[0128] The rows of the result matrix correspond to the test results under the sorting results, and the columns of the result matrix are the test results under the same test parameters.
[0129] In this embodiment, the test parameters may be response time parameters for each project, operation reliability parameters based on test logic, etc., wherein each column vector contains 3 parameter values, discreteness = (max(3 parameter values)-min(3 parameter values)) / remaining 1 parameter value, and the preset value is 0.5.
[0130] In this embodiment, the first calibration has a large discreteness, which means that the parameter under this item is easy to change, otherwise it is determined that the parameter under this item is not easy to change.
[0131] In this embodiment, the item vector={calibration results of the test parameters involved in the corresponding test item}.
[0132] In this embodiment, flexible test requirements are obtained from a requirement analysis model, and the model is obtained by training a neural network model using different project vectors and requirement setting results for the vectors as samples. Therefore, flexible test requirements can be directly obtained. For example, variables a1 and a2 in project 01 can be changed, and the rest remain unchanged to achieve measurement.
[0133] The beneficial effect of the above technical solution is: the discreteness is determined by discrete analysis of the column vector, and then the item vector is obtained by comparison with the preset degree, and further combined with the model set to effectively obtain flexible test requirements.
[0134] The present invention provides a UI testing method, which constructs a test expression of a corresponding component, including:
[0135] Decomposing the flexible test requirement to obtain a number of requirement parameters;
[0136] Combine the required parameters according to the theoretical execution order to obtain a combined expression;
[0137] According to the mapping comparison relationship between the required parameters and the parameter variables, a calibration mapping result is set for the corresponding required parameters, wherein the calibration mapping result includes: the number of parameter variables of the first calibration, the number of parameter variables of the second calibration, and the parameter variables of the second calibration are used as the non-changeable expression, and the parameter variables of the first calibration are used as the changeable expression;
[0138] The calibration mapping result of each required parameter is merged with the combined expression to obtain the test expression of the corresponding component.
[0139] Preferably,
[0140] The test expression includes the test conditions of the corresponding component and the test editing operation;
[0141] The test editing operation is an operation to change the component evaluation criteria.
[0142] In this embodiment, there are several test parameters under each test item, and each test item corresponds to a flexible test requirement, and each flexible test requirement includes several requirement parameters, wherein each requirement parameter corresponds to at least one test parameter, and is implemented based on the mapping between the test item and the flexible test requirement.
[0143] In this embodiment, the analysis of the requirements is implemented based on an analytical model, which is obtained by training a neural network model based on different test requirements and based on the required parameters as samples. Therefore, the required parameters can be directly decomposed.
[0144] In this embodiment, for example, there are parameters u1, parameter u2, and parameter u3. The theoretical execution order determined according to the flexible testing requirements is: parameter u2, parameter u1, and parameter u3. At this time, the combined expression is: {representative and execution symbol of parameter u2, representative and execution symbol of parameter u1, representative and execution symbol of parameter u3}.
[0145] And it represents the uniqueness of the parameter, and the execution symbol refers to the execution logic symbol referenced by the parameter.
[0146] In this embodiment, the test expression = {there is a combination expression for calibrating the mapping result}.
[0147] In this embodiment, the change operation may be: this part of the test logic may be changed, for example, this part is a test for the third level stability, which may be modified to a test for the first level stability, and so on.
[0148] The beneficial effect of the above technical solution is: by obtaining a number of requirement parameters through requirement analysis, and combining the comparison relationship with the parameter variables involved in the test item to obtain the test expression, it is convenient to obtain the expression result of the test item.
[0149] The present invention provides a UI testing method, which combines all test expressions to obtain and store test scripts, including:
[0150] Extract the expression field for each requirement parameter from each test expression, and perform cluster analysis on all requirement parameters under the corresponding flexible test requirement to obtain the test dimension;
[0151] Combine all expression fields under the same test dimension to obtain the first expression;
[0152] Performing separate similarity calculations on dimension fields under different test dimensions in the first expression, and obtaining the overall similarity of the corresponding first expression;
[0153] Randomly select a field from the dimension fields whose individual similarity is greater than the second preset similarity in the first expression whose overall similarity is greater than the first preset similarity for script matching, and perform script matching on all the dimension fields whose individual similarity is not greater than the second preset similarity;
[0154] Perform script matching on all the dimensional fields in the first expression whose overall similarity is not greater than the first preset similarity;
[0155] The test dimensions involved in each first expression are sorted by the number of dimensions, and the test script is obtained and stored based on the size sorting result and the script matching result of each first expression.
[0156] In this embodiment, each combination of parameter and calibration result in the test expression has its corresponding field representation, mainly to make it unique, for example, ¥#&, and then it clusters the required parameters involved, and there are several dimensions for each clustering result, to combine all the fields under each dimension together, and the parameter variables involved in the clustering result are the basis of the fields that need to be combined together under this dimension.
[0157] In this embodiment, individual similarity=sim (all expression fields under the same test dimension).
[0158] Combined similarity = the average of all individual similarities + the variance of all individual similarities.
[0159] In this embodiment, the first preset similarity is 0.7, and the second preset similarity is 0.6.
[0160] In this embodiment, script matching refers to matching with a corresponding script set in a test project, and the purpose of randomly extracting a field is to reduce the increase in process volume caused by matching all fields.
[0161] In this embodiment, the number of dimensions refers to the number of required parameters included in the test dimension.
[0162] In this embodiment, the test script: the script matching results of the first expression are obtained by sorting them according to the number of dimensions.
[0163] The beneficial effect of the above technical solution is: by extracting the expression fields of the parameters and clustering the required parameters, the first expression under the same test dimension can be obtained, and then the script matching of the fields can be achieved through comparative analysis of similarity, and then the test script can be reasonably obtained by sorting the number of dimensions, which facilitates the subsequent flexible adjustment of the code.
[0164] The present invention provides a UI testing device, such as Figure 2 As shown, including:
[0165] A component mining module is used to mine the construction code library of the interface to be tested and the link components and interface components based on the construction code library;
[0166] An item sorting module is used to obtain a first test item matching each link component and a second test item matching each interface component, and sort all the first test items and the second test items to obtain a number of sorting results;
[0167] A matrix construction module, used to control the corresponding sorting items according to each sorting result to test the interfaces to be tested in sequence, and obtain the test results under each sorting result respectively, and construct a result matrix;
[0168] The expression building module is used to analyze the result matrix, determine the flexible test requirements based on each test item, and build the test expressions of the corresponding components to combine all the test expressions to obtain and store the test scripts.
[0169] The beneficial effect of the above technical solution is: by matching test items to different components and then performing three-case sorting tests on the items to construct a result matrix, different flexible test requirements are obtained, and then test expressions are constructed to obtain test scripts, which is convenient for ensuring the flexible adjustability of the script to achieve flexible testing of different interfaces, thereby improving test efficiency.
[0170] The present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor is enabled to execute the steps of any one of the methods.
[0171] The present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods.
[0172] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. 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 invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A UI testing method, characterized in that: include: Step 1: mining the construction code base of the interface to be tested and the link components and interface components based on the construction code base; Step 2: Obtain the first test item matching each link component and the second test item matching each interface component, and sort all the first test items and the second test items to obtain a number of sorting results; Step 3: According to each sorting result, the corresponding sorting items are controlled to test the interfaces to be tested in sequence, and the test results under each sorting result are obtained respectively, and a result matrix is constructed; Step 4: Analyze the result matrix, determine the flexible test requirements based on each test item, and form test expressions of corresponding components to combine all test expressions to obtain and store test scripts; Among them, all the first test items and the second test items are sorted to obtain several sorting results, including: Obtain the link jump element of each link component and the jump range of each link jump element, and obtain the executable script for the corresponding link component; matching a first test item known to the executable script from a script-item database; At the same time, the type and quantity of the construction elements of each interface component are determined to obtain the component vector of the corresponding interface component; Inputting the component vector into a vector parsing model to obtain a test factor set, and matching a second test item matching the test factor set from a factor-item database; Determine respectively the execution time of the link component and the interface component after the software engine corresponding to the interface to be tested is started, and sort the first test items and the second test items involved according to the execution time; At the same time, according to the component attributes of each component, a standard response delay time is configured for the corresponding component, and the standard response delay time is added to the execution time of the corresponding component to obtain a first new time, and the first test items and the second test items involved are sorted in order according to the first new time; Analyze the mutual influence relationship between each component and all other components according to the construction code library of the interface to be tested, and then assign execution priorities to the corresponding components, and sort the first test items and the second test items involved according to the priority results; Among them, all the obtained sequential sorting results are the corresponding several sorting results.
2. The UI testing method according to claim 1, characterized in that: Get the executable script for the corresponding link component, including: Extracting jump marks from the component construction file of the link component, and counting the number of occurrences of each jump mark and the associated links involved in the corresponding occurrences of the corresponding jump mark, wherein each jump mark corresponds to a link jump element; Count the jump range of each jump mark based on all associated links; According to each link jump element and jump range, obtain the sub-script corresponding to the link jump element; Determine the mapping relationship between the link component and the interface to be tested, and extract the theoretical fitness of the corresponding link component under different test indicators based on the relationship-fitness comparison table; According to the layout range of the jump mark in the component construction file and in combination with the theoretical fitness under different test indicators, a first value is assigned to the corresponding link jump element; The first value is adjusted according to the number of occurrences of the corresponding jump mark to obtain a second value; All second values are sorted by size, and the sub-scripts of the link jump elements are sorted in order according to the size sorting result, and the executable script is obtained by combining them.
3. The UI testing method according to claim 1, characterized in that: The result matrix is analyzed to determine flexible test requirements based on each test item, including: Performing result discrete analysis on each column vector in the result matrix to obtain the discreteness of the corresponding column vector; Performing a first calibration on columns with a discreteness greater than or equal to a preset degree, and performing a second calibration on columns with a discreteness less than a preset degree; Combining the first calibration result and the second calibration result under the same test item, constructing an item vector; Inputting the item vector into the requirement analysis vector to obtain the flexible test requirements of the corresponding test items; The rows of the result matrix correspond to the test results under the sorting results, and the columns of the result matrix are the test results under the same test parameters.
4. The UI testing method according to claim 1, characterized in that: Build the test expressions for the corresponding components, including: Decomposing the flexible test requirement to obtain a number of requirement parameters; Combine the required parameters according to the theoretical execution order to obtain a combined expression; According to the mapping comparison relationship between the required parameters and the parameter variables, a calibration mapping result is set for the corresponding required parameters, wherein the calibration mapping result includes: the number of parameter variables of the first calibration, the number of parameter variables of the second calibration, and the parameter variables of the second calibration are used as the non-changeable expression, and the parameter variables of the first calibration are used as the changeable expression; The calibration mapping result of each required parameter is merged with the combined expression to obtain the test expression of the corresponding component.
5. The UI testing method according to claim 1, characterized in that: The test expression includes the test conditions of the corresponding component and the test editing operation; The test editing operation is an operation to change the component evaluation criteria.
6. The UI testing method according to claim 4, characterized in that: Combine all test expressions to obtain and store test scripts, including: Extract the expression field for each requirement parameter from each test expression, and perform cluster analysis on all requirement parameters under the corresponding flexible test requirement to obtain the test dimension; Combine all expression fields under the same test dimension to obtain the first expression; Performing separate similarity calculations on dimension fields under different test dimensions in the first expression, and obtaining the overall similarity of the corresponding first expression; Randomly select a field from the dimension fields whose individual similarity is greater than the second preset similarity in the first expression whose overall similarity is greater than the first preset similarity for script matching, and perform script matching on all the dimension fields whose individual similarity is not greater than the second preset similarity; Perform script matching on all the dimensional fields in the first expression whose overall similarity is not greater than the first preset similarity; The test dimensions involved in each first expression are sorted by the number of dimensions, and the test script is obtained and stored based on the size sorting result and the script matching result of each first expression.
7. A UI testing device, characterized in that: For applying the UI testing method according to any one of claims 1 to 6, the device comprises: A component mining module is used to mine the construction code library of the interface to be tested and the link components and interface components based on the construction code library; An item sorting module is used to obtain a first test item matching each link component and a second test item matching each interface component, and sort all the first test items and the second test items to obtain a number of sorting results; A matrix construction module, used to control the corresponding sorting items according to each sorting result to test the interfaces to be tested in sequence, and obtain the test results under each sorting result respectively, and construct a result matrix; The expression building module is used to analyze the result matrix, determine the flexible test requirements based on each test item, and build the test expressions of the corresponding components to combine all the test expressions to obtain and store the test scripts.
8. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 6.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
UI automation function testing method, testing device, testing equipment and storage medium
CN109857668A
Interface test method and system, electronic equipment and storage medium
CN111258875A