Test method, system, computer system and medium

By constructing a transition matrix to predict the transition probability of user behavior and generating test cases, it solves the problem of low fit between the test scenario and the user's actual usage scenario caused by artificial determination of test cases based on experience in the existing technology, achieving more efficient and accurate Automated testing.

CN113760713BActive Publication Date: 2024-10-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011167413.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-27
Publication Date
2024-10-18
Estimated Expiration
2040-10-27

AI Technical Summary

Technical Problem

In existing automated testing methods, test cases are manually determined based on experience, resulting in a low fit between the test scenario and the user's actual usage scenario.

Method used

By obtaining the actual operation links of the system under test, a transfer matrix is ​​constructed to predict the transition probability of user behavior, a predicted operation link is generated, and test cases are generated based on the predicted operation link to avoid human subjectivity.

Benefits of technology

It improves the fit between test scenarios and actual usage scenarios, reduces the subjectivity of test case generation, and improves testing efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760713B_ABST
    Figure CN113760713B_ABST
Patent Text Reader

Abstract

The present disclosure provides a testing method, including: in response to a test instruction, obtaining an actual operation link, wherein the actual operation link includes N user behaviors that have actually been operated among M user behaviors of the tested system and the actual operation process of the N user behaviors, M and N are positive integers, and M≥N; based on the actual operation link, determining a predicted operation link, wherein the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the tested system and the predicted operation process of the P user behaviors, P is a positive integer, and M≥P; based on the predicted operation link, generating and executing a test case in response to the test instruction, wherein the test case includes P test sub-cases, and the P test sub-cases correspond to the P user behaviors one by one. In addition, the present disclosure also provides a testing system, a computer system, and a computer-readable medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of automated testing, and more specifically, to a testing method and a system thereof, a computer system, and a medium. Background Art

[0002] Testing is an important means to ensure system quality. Through system testing, system defects can be discovered and modified to improve the system quality level. As the scale of the system continues to expand, the requirements for testing refinement and testing efficiency are also getting higher and higher, so automated testing technology came into being.

[0003] Related technologies provide some automated testing methods, such as Selenium-based Web page automated testing technology, where testers can implement automated testing through script recording and playback. However, test cases are manually determined based on experience, resulting in a low degree of fit between the test scenario and the actual user scenario. Summary of the invention

[0004] In view of this, in order to overcome the problem in the related art that test cases are determined artificially based on experience, resulting in a low fit between the test scenarios and the actual user usage scenarios, the present disclosure provides a testing method and its system, a computer system and a computer-readable medium.

[0005] One aspect of the present disclosure provides a testing method, comprising: in response to a test instruction, obtaining an actual operation link, wherein the actual operation link includes N user behaviors that have actually been operated among M user behaviors of the system under test and the actual operation process of the N user behaviors, M and N are positive integers, and M≥N. Based on the actual operation link, determining a predicted operation link, wherein the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the system under test and the expected operation process of the P user behaviors, P is a positive integer, and M≥P. Based on the predicted operation link, generating and executing a test case in response to the test instruction, wherein the test case includes P test sub-cases, and the P test sub-cases correspond one-to-one to the P user behaviors.

[0006] According to an embodiment of the present disclosure, the above-mentioned test instruction includes user characteristics of a specified user, and the above-mentioned obtaining the actual operation link in response to the test instruction includes: in response to the test instruction, obtaining Q user behaviors that have actually been executed among the M user behaviors of the above-mentioned system under test and the actual operation process of the above-mentioned Q user behaviors, Q is a positive integer, and M≥Q. Based on the user characteristics of the above-mentioned specified user, a reference user is determined, wherein the above-mentioned reference user has the same and / or similar user characteristics as the above-mentioned specified user. From the above-mentioned Q user behaviors that have actually been executed, N user behaviors that have been executed by the above-mentioned reference user are filtered out. From the actual operation process of the above-mentioned Q user behaviors, the actual operation process corresponding to the above-mentioned N user behaviors is filtered out.

[0007] According to an embodiment of the present disclosure, the above-mentioned determination of the predicted operation link based on the above-mentioned actual operation link includes: constructing an initial transfer matrix based on the N user behaviors of the above-mentioned actual operation link, wherein the above-mentioned transfer matrix is ​​used to characterize the transition probability between the initial user behavior and the final user behavior in the above-mentioned N user behaviors. Based on the actual operation process of the above-mentioned actual operation link, the transition probability values ​​between the above-mentioned N user behaviors are counted. The above-mentioned transition probability values ​​are filled into the above-mentioned initial transfer matrix to obtain the final transfer matrix. Based on the above-mentioned final transfer matrix, the predicted operation link is determined.

[0008] According to an embodiment of the present disclosure, the above-mentioned determination of the predicted operation link of the above-mentioned specified user based on the above-mentioned final transfer matrix includes: obtaining a proposed predicted operation link based on the above-mentioned final transfer matrix. Obtaining a preset threshold of the transition probability value. Determining the operation link that meets the above-mentioned preset threshold in the above-mentioned proposed predicted operation link as the above-mentioned predicted operation link.

[0009] According to an embodiment of the present disclosure, the method further includes: for the P user behaviors of the system under test, pre-generating a test sub-case corresponding to each user behavior to obtain P test sub-cases.

[0010] According to an embodiment of the present disclosure, the generation and execution of the test case based on the predicted operation link includes: calling P test sub-cases corresponding to the P user behaviors expected to be operated. Arranging the P test sub-cases according to the expected operation flow of the P user behaviors to generate and execute the test case.

[0011] One aspect of the present disclosure provides a test system, including: an acquisition module, for acquiring an actual operation link in response to a test instruction, wherein the actual operation link includes N user behaviors that have actually been operated among M user behaviors of the system under test and the actual operation process of the N user behaviors, M and N are positive integers, and M≥N. A determination module, for determining a predicted operation link based on the actual operation link, wherein the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the system under test and the expected operation process of the P user behaviors, P is a positive integer, and M≥P. A test module, for generating and executing a test case based on the predicted operation link in response to the test instruction, wherein the test case includes P test sub-cases, and the P test sub-cases correspond one-to-one to the P user behaviors.

[0012] According to an embodiment of the present disclosure, the system further includes: a generation module for pre-generating a test sub-case corresponding to each user behavior for the P user behaviors of the system under test to obtain P test sub-cases.

[0013] Another aspect of the present disclosure provides a computer system, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any of the above methods.

[0014] Another aspect of the present disclosure provides a computer-readable medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement any of the above methods.

[0015] Through the embodiments of the present disclosure, a predicted operation link is determined based on the user behaviors that have actually been operated in the user behaviors of the system under test and the actual operation flow of the user behaviors that have been operated, and based on the user behaviors that are expected to be operated in the user behaviors of the system under test and the expected operation flow of the user behaviors that are expected to be operated. Since the predicted operation link is predicted based on the actual operation link, it is not determined artificially based on experience. Therefore, the test cases generated based on the predicted operation link avoid the subjectivity of the generation of test cases determined artificially, so that the test scenarios and actual usage scenarios have a natural high degree of fit, which can at least partially overcome the technical problem that the generation of test cases in the related art is artificially determined, resulting in a low degree of fit between the test scenarios and the actual usage scenarios of users, and thus can achieve the technical effect of improving the degree of fit between the test scenarios and the actual usage scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0017] Figure 1 An exemplary system architecture of the testing method and system thereof to which the present disclosure embodiments can be applied is schematically shown;

[0018] Figure 2 A flow chart schematically shows a testing method according to an embodiment of the present disclosure;

[0019] Figure 3 A flow chart schematically shows a testing method according to another embodiment of the present disclosure;

[0020] Figure 4 A block diagram schematically shows a test system according to an embodiment of the present disclosure; and

[0021] Figure 5 A block diagram of a computer system suitable for implementing a testing method and a system thereof according to an embodiment of the present disclosure is schematically shown.

[0022] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0023] It should be noted that the drawings are not drawn to scale and that for illustrative purposes, elements of similar structure or function are generally represented by like reference numerals throughout the drawings. DETAILED DESCRIPTION

[0024] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0025] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0026] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.

[0027] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but not be limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but not be limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). Those skilled in the art should also understand that any transitional conjunctions and / or phrases that substantially indicate two or more optional items, whether in the specification, claims, or drawings, should be understood to give the possibility of including one of these items, either of these items, or both of these items. For example, the phrase "A or B" should be understood to include the possibilities of "A" or "B", or "A and B".

[0028] In the automated testing scenario, the quality of the test cases is directly related to the test results. In the related art, the selection of test cases is manually determined based on experience, which often leads to a low fit between the test scenario and the actual user scenario.

[0029] Based on this, the present disclosure provides a testing method, including a test case prediction stage and a test case generation and execution stage. In the test case prediction process, in response to the test instruction, an actual operation link is obtained, and the actual operation link includes N user behaviors that have actually been operated among the M user behaviors of the system under test and the actual operation process of the N user behaviors, M and N are positive integers, and M≥N. Based on the actual operation link, a predicted operation link is determined, wherein the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the system under test and the expected operation process of the P user behaviors, P is a positive integer, and M≥P. In the test case generation and execution stage, based on the obtained predicted operation link, a test case is generated and executed to respond to the test instruction, and the test case includes P test sub-cases, and the P test sub-cases correspond one-to-one to the P user behaviors.

[0030] According to the user behaviors that have actually been operated in the user behaviors of the tested system and the actual operation processes of the user behaviors that have been operated, the predicted operation link is determined based on the user behaviors that are expected to be operated in the user behaviors of the tested system and the expected operation processes of the user behaviors that are expected to be operated. Since the predicted operation link is predicted based on the actual operation link, it is not determined artificially based on experience. Therefore, the test cases generated according to the predicted operation link avoid the subjectivity of the test case generation determined artificially, so that the test scenario and the actual use scenario have a natural high fit, which can at least partially overcome the technical problem that the test case generation in the related technology is artificially determined, resulting in a low fit between the test scenario and the user's actual use scenario, and thus can achieve the technical effect of improving the fit between the test scenario and the actual use scenario.

[0031] Figure 1 The exemplary system architecture 100 to which the test method and system of the embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0032] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0033] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0034] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0035] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0036] It should be noted that the test method provided by the present disclosure can generally be executed by the terminal device 101, 102 or 103. Accordingly, the test system provided by the present disclosure can generally be set in the terminal device 101, 102 or 103. The test method provided by the present disclosure can also be executed by other terminal devices that are different from the terminal device 101, 102 or 103 and can communicate with the terminal device 101, 102, 103 and / or the server 105. Accordingly, the test system provided by the present disclosure can also be set in other terminal devices that are different from the terminal device 101, 102 or 103 and can communicate with the terminal device 101, 102, 103 and / or the server 105.

[0037] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0038] Figure 2 The flowchart of the testing method according to the embodiment of the present disclosure is schematically shown.

[0039] like Figure 2 As shown, the method may include operations S210 to S230.

[0040] In operation S210 , in response to a test instruction, an actual operation link is acquired.

[0041] According to an embodiment of the present disclosure, a test instruction is used to instruct the execution of a test operation on the system under test. The system under test may be a Web application system, and the present disclosure may be software test automation implemented for a Web application. The system under test corresponds to M user behaviors, and the M user behaviors can be obtained by dividing according to the business characteristics of the system under test. It can be understood that M user behaviors matching the system under test can be obtained according to the different business characteristics corresponding to the system under test. The test of the Web application is specifically a test for each Web page, and accordingly, the user behavior refers to the page elements on the Web page that can be clicked and operated by the user, and the user's operation on the page element represents the user behavior.

[0042] In specific implementation, the system under test can be preliminarily divided according to the business modules to obtain multiple business modules, and then for each of the multiple business modules, it can be divided according to the finest granularity of user behavior to obtain the user behavior corresponding to each business module. Optionally, the operation link of the user behavior can also be determined. The operation link is a representation of a link relationship, which is used to characterize the front and back processes between user behaviors, that is, the front and back operation sequence between user behaviors. For example, the system under test is divided into three business modules, namely business module 1, business module 2 and business module 3. For business module 1, according to the finest granularity of user behavior, the user behavior obtained after refinement can include but is not limited to a, b, c, d, e, f, g, and accordingly, the operation link can include but is not limited to acdfg, bcdefg. Referring to the division method of user behavior for business module 1, the division of user behavior for business module 2 and business module 3 can be realized. The user behaviors obtained by dividing the three business modules are collectively the M user behaviors that match the system under test.

[0043] It should be noted that for the convenience of description, the user behaviors are replaced by letters a, b, c, d, e, f, and g. According to the business characteristics of the actual system under test, the user behaviors replaced by letters a, b, c, d, e, f, and g can represent different meanings. For example, a can represent searching for products, b can represent viewing products, c can represent entering the product evaluation page, d can represent adding products to the shopping cart, e can represent canceling an order, f can represent direct purchase, and g can represent submitting an order.

[0044] According to an embodiment of the present disclosure, the actual operation link includes N user behaviors that have actually been operated among the M user behaviors of the tested system and the actual operation process of the N user behaviors, where M and N are positive integers and M ≥ N. In the present disclosure, it can be obtained based on the historical operation behavior data for the tested system. Corresponding to the Web page test, the actual operation link is the page elements that the user has actually clicked, and the order of clicks between the page elements.

[0045] In specific implementation, the actual operation behavior data for the system under test can be obtained by using the method of embedding points of the system under test or by recording online traffic, and then the actual operation behavior data can be converted into a set of operation process links according to the M user behaviors that match the system under test. Optionally, according to the actual needs of the test, the actual operation behavior data for the system under test within a preset time period can be obtained, which can save test resources while meeting the test needs and obtaining the actual operation links in a more targeted manner.

[0046] In operation S220 , a predicted operating link is determined based on the actual operating link.

[0047] According to an embodiment of the present disclosure, the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the tested system and the expected operation flow of the P user behaviors, where P is a positive integer and M ≥ P. For Web page testing, the predicted operation link is the page elements that the user is expected to click, and the order of clicks between the page elements.

[0048] It should be noted that the number of user behaviors obtained by dividing the user behavior granularity of the system under test is M, the number of user behaviors that have actually been operated is N, and the number of user behaviors that are expected to be operated is P. Therefore, N and P are both positive integers not greater than M, but there is no limitation on the size relationship between N and P, that is, N can be greater than P, N can also be equal to P, and N can also be less than or equal to P.

[0049] In operation S230 , a test case is generated and executed based on the predicted operation link in response to the test instruction.

[0050] According to the embodiments of the present disclosure, random generation and automatic execution of test cases can be achieved, that is, test case generation and execution are performed simultaneously. P test sub-cases correspond one-to-one to P user behaviors. Based on the predicted operation link including P user behaviors, a test case including P test sub-cases can be generated, and one user behavior corresponds to one test sub-case. One predicted operation link corresponds to one test case.

[0051] Through the embodiments of the present disclosure, a predicted operation link is determined based on the user behaviors that have actually been operated in the user behaviors of the system under test and the actual operation flow of the user behaviors that have been operated, and based on the user behaviors that are expected to be operated in the user behaviors of the system under test and the expected operation flow of the user behaviors that are expected to be operated. Since the predicted operation link is predicted based on the actual operation link, it is not determined artificially based on experience. Therefore, the test cases generated based on the predicted operation link avoid the subjectivity of the generation of test cases determined artificially, so that the test scenarios and actual usage scenarios have a natural high degree of fit, which can at least partially overcome the technical problem that the generation of test cases in the related art is artificially determined, resulting in a low degree of fit between the test scenarios and the actual usage scenarios of users, and thus can achieve the technical effect of improving the degree of fit between the test scenarios and the actual usage scenarios.

[0052] Considering the huge number of users operating the system under test, and different users have different operation processes for the operation behaviors of the system under test, the operation process directly reflects the multiple user behaviors operated by the user, as well as the operation sequence between multiple user behaviors, that is, the operation process has a certain regularity. For example, women's operation behavior is often manifested in the habit of clicking "Add product to shopping cart" to add multiple products to the shopping cart, and then clicking "Submit order" to complete the entire process of ordering and settlement after comparing multiple products, while men's operation behavior is often manifested in clicking "Submit order" to complete the entire process of ordering and settlement.

[0053] As an optional embodiment, the present disclosure screens the users who have actually performed operations on the system under test according to the user characteristics of the specified users in the test instructions, so that the screened users are more suitable for this test task. It can also achieve comprehensive coverage of test scenarios, predict the predicted operation links of different users, simulate the actual operation scenarios of different user groups, and avoid omissions of test scenarios.

[0054] According to an embodiment of the present disclosure, the test instruction includes the user characteristics of the specified user, and the aforementioned operation S210 (obtaining the actual operation link in response to the test instruction) includes: in response to the test instruction, obtaining Q user behaviors that have actually been executed among the M user behaviors of the system under test and the actual operation process of the Q user behaviors, where Q is a positive integer and M≥Q. Based on the user characteristics of the specified user, a reference user is determined, wherein the reference user has the same and / or similar user characteristics as the specified user. From the Q user behaviors that have actually been executed, N user behaviors that have been executed by the reference user are filtered out. From the actual operation process of the Q user behaviors, the actual operation process corresponding to the N user behaviors is filtered out.

[0055] In this disclosure, the designated user can be determined based on the test requirements, and the user characteristics can include but are not limited to gender, age, region, occupation, interests and hobbies. User characteristics can be determined based on the user's registration information, or based on the user's historical operation behavior, the user can be marked, and then the users with different marks can be classified accordingly. This disclosure does not limit this.

[0056] Through the embodiments of the present disclosure, the actual operation link is obtained according to the user characteristics, so that the predicted operation link is more in line with the actual operation scenario with the user characteristics. At the same time, according to different test instructions, test scenarios with different user characteristics can be simulated to achieve full coverage of scenarios and improve the accuracy and pertinence of the test.

[0057] According to an embodiment of the present disclosure, based on the actual operation link, determining the predicted operation link includes: constructing an initial transfer matrix based on N user behaviors of the actual operation link, wherein the transfer matrix is ​​used to characterize the transition probability between the initial user behavior and the final user behavior in the N user behaviors. Based on the actual operation process of the actual operation link, the transition probability values ​​between the N user behaviors are counted. The transition probability values ​​are filled into the initial transfer matrix to obtain the final transfer matrix. Based on the final transfer matrix, the predicted operation link is determined.

[0058] According to an embodiment of the present disclosure, based on the historical operation data of the extracted reference user, the historical operation data can be encoded according to the user behavior obtained by the above-mentioned division, and the flow order between the user behaviors can be arranged to obtain a user behavior state set, that is, an actual operation link. According to the number of user behaviors included in the actual operation link, a transfer matrix can be constructed, and each element included in the transfer matrix is ​​a transition probability between different user behaviors. The elements in the initialization transfer matrix are all 0, that is, the initial transfer matrix is ​​obtained, and the transition probability between different user behaviors includes the transition probability between two adjacent user behaviors in the entire actual operation link. The transition probabilities between different user behaviors are counted in turn, and filled into the corresponding element positions to replace 0, and the final transfer matrix can be obtained. In the final transfer matrix, the transition probability without a transition relationship is 0, and the transition probability with a transition relationship is not 0. Therefore, according to the final transfer matrix, based on the user behavior with a transition probability not 0, the predicted operation link can be determined.

[0059] As an optional embodiment, according to the final transfer matrix, operation links with different transfer times can be obtained, and different transfer times correspond to different numbers of steps in the operation links. For example, the predicted operation link of the shortest link (the number of steps is S1) and the predicted operation link of the longest link (the number of steps is S2) can be obtained. When the number of transfers is from S1 to S2, the user's initial user behavior, the final transfer matrix, and the number of transfers are known, and the corresponding process link of the user's complete operation can be obtained.

[0060] In the specific implementation, taking the actual operation link acdfg as an example, the five user behaviors are a, c, d, f and g. a represents the initial user behavior, which represents the user behavior that was actually operated by the user first, c, d, and f represent the intermediate user behaviors, which represent the intermediate user behaviors that were actually operated by the user, and g represents the final user behavior, which represents the user behavior that was actually operated by the user last. First, a 5*5 transfer matrix can be constructed, which includes 25 elements. The 25 elements are initialized to all 0 to obtain the initial transfer matrix. The transition probability from the initial user behavior a to the final user behavior g includes the transition probability of the initial user behavior a transferring to the intermediate user behavior c, the transition probability of the intermediate user behavior c transferring to the intermediate user behavior d, the transition probability of the intermediate user behavior d transferring to the intermediate user behavior f, and the transition probability of the intermediate user behavior f transferring to the final user behavior g. The above transition probabilities are counted in sequence, for example, the transition probability of the initial user behavior a transferring to the intermediate user behavior c is counted, that is, the number of times the initial user behavior a transfers to the intermediate user behavior c in the user's historical behavior can be counted to obtain the statistical value. The statistics of other transition probabilities are calculated in the same way, and then the statistical values ​​are filled into the initial transfer matrix to obtain the final transfer matrix. The final transfer matrix includes prediction operation links with 2, 3, and 4 transfer times, namely, the prediction operation link of the shortest link (3 steps) and the prediction operation link of the longest link (5 steps). When the number of transfers increases from 2 to 4, the user's initial user behavior a, the final transfer matrix, and the number of transfers are known, and the prediction operation link acg with 3 steps, the prediction operation link acfg with 4 steps, and the prediction operation link acdfg with 5 steps can be obtained.

[0061] As an optional embodiment, based on the actual operation link, the predicted operation link can be determined according to the Markov Chain. Markov chain is a random process with Markov properties in probability theory and mathematical statistics and exists in discrete exponential sets and state spaces. Markov chain has Markov properties, which means that the current state is known and the future state is independent of the past state. The transfer of each state depends only on the first n states. When n is 1, it is the simplest first-order process, that is, the conversion of each state depends only on the previous state, and the next state of the system under test is only related to the current state, regardless of how the previous software works. Therefore, Markov chain can be used to simulate the user's use scenario of the system under test and build a use model. The Markov chain use model is a modeling method from the start state through many intermediate states to the end state. There can be many links from the start of the test to the end of the test, and a link can represent a test case.

[0062] A first-order Markov process mainly consists of three parts: state, initial vector, and state transfer matrix. The implementation process of these three parts and the specific Markov calculation process will be introduced in detail below.

[0063] (1) Status

[0064] The present disclosure divides the states into N states, where N is consistent with the number of user behaviors in the aforementioned actual operation link.

[0065] (2) Initial vector

[0066] The user behavior data within a preset time period may be obtained, for example, the user behavior data within a few days before and after the current time may be obtained, and the user's initial operation behavior, that is, the initial vector, may be determined according to the business of the current test requirement.

[0067] (3) State transfer matrix

[0068] The steps to calculate the state transfer matrix are as follows:

[0069] (3-1) Extract user historical behaviors, arrange the user historical behaviors according to user behavior codes and flow order, and obtain a user behavior state set.

[0070] (3-2) Count the probabilities of the user's different state transitions in sequence. For example, count the probability of state a transitioning to state b. That is, count the number of times the user transitions from state a to state b in his or her historical behavior.

[0071] (3-3) Confirm the final state g that needs to be covered in this test, obtain the transition probability of state g, and fill it into the state transfer matrix to obtain the final state transfer matrix.

[0072] (4) Markov calculation process

[0073] The calculation steps are as follows:

[0074] (4-1) According to (3-1), (3-2) and (3-3), we can know the state, initial vector and state transfer matrix.

[0075] (4-2) According to the initial operation to the final operation of the test, the number of steps S1 to S2 of the shortest and longest links are obtained.

[0076] (4-3) When the number of conversions changes from S1 to S2, the initial vector, state transfer matrix, and number of conversions are known, and the corresponding process link of the user's complete operation can be obtained.

[0077] According to an embodiment of the present disclosure, determining the predicted operation link of a specified user based on the final transfer matrix includes: obtaining a proposed predicted operation link based on the final transfer matrix, obtaining a preset threshold of a transition probability value, and determining an operation link in the proposed predicted operation link that meets the preset threshold as a predicted operation link.

[0078] As an optional embodiment, in order to improve the rationality of the predicted operation link, the transition probability value can be screened when determining the predicted operation link, and the transitions with a transition probability lower than a preset threshold are eliminated, and the predicted operation link is determined by the user behavior with a high transition probability.

[0079] In specific implementation, the preset threshold of the transition probability value can be set manually or determined based on historical operation data statistics of the system under test. The present disclosure does not limit this, as long as it plays a screening role on the transition probability.

[0080] According to an embodiment of the present disclosure, the testing method may further include: for c user behaviors of the system under test, pre-generating a test sub-case corresponding to each user behavior to obtain c test sub-cases.

[0081] In specific implementation, Selenium can be used to record refined automation scripts to generate test sub-cases. Selenium tools include test recording (Selenium IDE), writing and running (Selenium RemoteControl) and parallel processing of tests (Selenium Grid). For example, an automation script is recorded separately for the user behavior of "adding products to the shopping cart" and numbered. The recording method of other user behaviors is similar. Selenium is a browser automation testing framework and a tool for Web application testing. By simulating various user operations on Web pages, it can accurately reproduce the test case steps written by software testers. Selenium tests run directly in the browser, just like real users are operating. Supported browsers include but are not limited to IE (7, 8, 9, 10, 11), Mozilla FireFox, Safari, Goole, Chrome, Opera. Supports automatic recording of actions and automatic generation of test scripts in different languages ​​such as .Net, Java, Perl, etc.

[0082] According to an embodiment of the present disclosure, based on the predicted operation link, generating and executing a test case includes: calling P test sub-cases corresponding to the P user behaviors that are expected to be operated. Arranging the P test sub-cases according to the expected operation flow of the P user behaviors to generate and execute the test case.

[0083] According to the predicted operation link determined by the prediction, the corresponding refined test script generated in advance can be automatically executed after the process is arranged according to this link, so as to perform automated and precise testing on the system under test. In specific implementation, if the predicted operation link is acg, the three user behaviors expected to be operated include user behaviors a, c and g. According to the embodiment of the present disclosure, the test sub-case corresponding to user behavior a can be arranged in the order of acg, and then the test sub-case corresponding to user behavior c can be arranged, and finally the test sub-case corresponding to user behavior g can be arranged. Finally, a test case is generated and automatically executed, so as to respond to the test instruction and complete the automated testing of the system under test.

[0084] Through the embodiments of the present disclosure, according to the expected operation flow of the user behavior of the predicted operation link, the refined automation script, that is, the test sub-case, is orchestrated, so that reliable, flexible and efficient automated testing can be achieved.

[0085] Figure 3 The flowchart of a testing method according to another embodiment of the present disclosure is schematically shown.

[0086] like Figure 3 As shown, the method may include operations S310 to S360.

[0087] In operation S310, the business modules of the system under test are divided and the business behaviors are refined. The user behaviors of the system under test can be obtained by analyzing the system functions of the system under test and dividing them according to the finest granularity of user behaviors, providing data support for obtaining the operation links.

[0088] In operation S320, a refined step automation script is recorded. Selenium may be used to record the refined automation script to generate test sub-cases, so that the pre-generated test sub-cases can be conveniently and quickly called when the test cases are generated.

[0089] In operation S330, the system under test acquires user operation behavior data by tracking points. The user operation behavior data may be user operation behavior data within a preset time period.

[0090] In operation S340, the user operation behavior is predicted using the Markov model. The operation model is constructed based on the Markov chain to provide a basis for the automatic generation of software test cases.

[0091] In operation S350, a process arrangement configuration of the test script is performed according to the prediction result.

[0092] In operation S360, the refined automated test script is executed according to the process orchestration configuration.

[0093] Through the test method provided by the present disclosure, the Markov chain and the Selenium test tool are combined to simulate the operation process of the specified user in the real system environment under test, and the real automated test of the Web application is realized, that is, the test case is automatically generated and executed. The test script is written based on the Selenium test tool, and the constructed Markov chain model structure is referred to. Each state in the usage model is encapsulated in a module, and then the state trend after the initial state is determined by the transition probability simulation algorithm, that is, the generation of the test case. After the state is determined, the link can be executed, which improves the fit between the test case and the actual user usage scenario. Automatic generation and execution can also save manpower and time to a large extent, provide more reliable test results, and thus improve the efficiency of the test.

[0094] Figure 4 The block diagram of the test system according to the embodiment of the present disclosure is schematically shown. Figure 4 As shown, the system 400 includes an acquisition module 410 , a determination module 420 , and a testing module 430 .

[0095] The acquisition module 410 acquires the actual operation link in response to the test instruction, where the actual operation link includes N user behaviors that have actually been operated among the M user behaviors of the tested system and the actual operation process of the N user behaviors, where M and N are positive integers and M≥N.

[0096] Optionally, the acquisition module 410 may be used to execute Figure 2 The operation S210 described above will not be described in detail here.

[0097] The determination module 420 is used to determine a predicted operation link based on the actual operation link, where the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the tested system and the predicted operation flow of the P user behaviors, where P is a positive integer and M≥P.

[0098] Optionally, the determination module 420 may be used to perform, for example Figure 2 The operation S220 described above will not be described in detail here.

[0099] The test module 430 is used to generate and execute a test case based on the predicted operation link in response to a test instruction. The test case includes P test sub-cases, and the P test sub-cases correspond to the P user behaviors one by one.

[0100] Optionally, the test module 430 may be used to perform, for example Figure 2 The operation S230 described above will not be described in detail here.

[0101] According to an embodiment of the present disclosure, the test instruction includes user characteristics of a specified user. In response to the test instruction, the acquisition module 410 includes: an acquisition submodule, which is used to obtain, in response to the test instruction, Q user behaviors that have actually been executed among the M user behaviors of the system under test and the actual operation process of the Q user behaviors, where Q is a positive integer and M≥Q. A determination submodule, which is used to determine a reference user based on the user characteristics of the specified user, wherein the reference user has the same and / or similar user characteristics as the specified user. A first screening submodule, which is used to screen out N user behaviors that have been executed by the reference user from the Q user behaviors that have actually been executed. A second screening submodule, which is used to screen out the actual operation process corresponding to the N user behaviors from the actual operation process of the Q user behaviors.

[0102] According to an embodiment of the present disclosure, the determination module includes: a construction submodule, which is used to construct an initial transfer matrix based on N user behaviors of the actual operation link, wherein the transfer matrix is ​​used to characterize the transition probability between the initial user behavior and the final user behavior in the N user behaviors. A statistical submodule, which is used to count the transition probability values ​​between the N user behaviors based on the actual operation process of the actual operation link. A filling submodule, which is used to fill the transition probability values ​​into the initial transfer matrix to obtain the final transfer matrix. A determination submodule, which is used to determine the predicted operation link based on the final transfer matrix.

[0103] According to an embodiment of the present disclosure, the determination submodule includes: an acquisition unit, which is used to obtain a proposed predicted operation link based on the final transfer matrix; an acquisition unit, which is used to obtain a preset threshold of the transition probability value; and a determination unit, which is used to determine an operation link that meets the preset threshold in the proposed predicted operation link as a predicted operation link.

[0104] According to an embodiment of the present disclosure, the system further includes: a generation module for pre-generating a test sub-case corresponding to each user behavior for P user behaviors of the system under test to obtain P test sub-cases.

[0105] According to an embodiment of the present disclosure, the test module includes: a calling sub-module, used to call P test sub-cases corresponding to the P user behaviors that are expected to be operated; and a testing sub-module, used to arrange the P test sub-cases according to the expected operation flow of the P user behaviors to generate and execute test cases.

[0106] It should be noted that the implementation methods, technical problems solved, functions realized, and technical effects achieved of each module in the system part embodiments are the same or similar to the implementation methods, technical problems solved, functions realized, and technical effects achieved of each corresponding step in the method part embodiments, and will not be repeated here.

[0107] According to the embodiments of the present invention, any one or more of the modules, submodules, and units, or at least part of the functions of any one of them, can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, and units can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, and units can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FNGA), programmable logic arrays (NLA), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, and units can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.

[0108] For example, the acquisition module, the determination module, the test module, the acquisition submodule, the determination submodule, the first screening submodule, the second screening submodule, the construction submodule, the statistics submodule, the filling submodule, the determination submodule, the acquisition unit, the acquisition unit, the determination unit, the generation module, the calling submodule and the test submodule can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the acquisition module, the determination module, the test module, the acquisition sub-module, the determination sub-module, the first screening sub-module, the second screening sub-module, the construction sub-module, the statistics sub-module, the filling sub-module, the determination sub-module, the acquisition unit, the acquisition unit, the determination unit, the generation module, the calling sub-module and the testing sub-module can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FNGA), a programmable logic array (NLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or can be implemented in any one of the three implementation methods of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of the acquisition module, determination module, test module, acquisition sub-module, determination sub-module, first screening sub-module, second screening sub-module, construction sub-module, statistics sub-module, filling sub-module, determination sub-module, acquisition unit, acquisition unit, determination unit, generation module, calling sub-module and testing sub-module can be at least partially implemented as a computer program module, which can perform corresponding functions when the computer program module is executed.

[0109] Figure 5 A block diagram of a computer system suitable for implementing a testing method and a system thereof according to an embodiment of the present disclosure is schematically shown. Figure 5 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0110] like Figure 5 As shown, the computer system 500 according to the embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure as described above.

[0111] In RAM 503, various programs and data required for the operation of system 500 are stored. Processor 501, ROM 502, and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the test method described above by executing the programs in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the test method described above by executing the programs stored in one or more memories.

[0112] According to an embodiment of the present disclosure, the system 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The system 500 may further include one or more of the following components connected to the I / O interface 505: an input section 501 including a keyboard, a mouse, etc. An output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc. A storage section 508 including a hard disk, etc. And a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that the computer program read therefrom is installed into the storage section 508 as needed.

[0113] According to an embodiment of the present disclosure, the test method described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0114] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the foregoing. According to an embodiment of the present disclosure, the computer-readable medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.

[0115] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0116] As another aspect, the present disclosure further provides a computer-readable medium, which may be included in the device described in the above embodiment. It may also exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes the test method.

[0117] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A testing method comprising: In response to the test instruction, an actual operation link is obtained, wherein the actual operation link includes N user behaviors that have actually been operated among M user behaviors of the system under test and actual operation processes of the N user behaviors, where M and N are positive integers and M≥N; Based on the actual operation link, determine a predicted operation link, wherein the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the measured system and the predicted operation flow of the P user behaviors, where P is a positive integer and M≥P; Based on the predicted operation link, a test case is generated and executed to respond to the test instruction, wherein the test case includes P test sub-cases, and the P test sub-cases correspond to the P user behaviors one by one; The test instruction includes a user feature of a specified user, and in response to the test instruction, obtaining the actual operation link includes: In response to a test instruction, obtaining Q user behaviors that have actually been executed among the M user behaviors of the system under test and actual operation processes of the Q user behaviors, where Q is a positive integer and M≥Q; Determining a reference user based on the user characteristics of the designated user, wherein the reference user has the same and / or similar user characteristics as the designated user; Filtering out N user behaviors that have been operated by the reference user from the Q user behaviors that have actually been operated; The actual operation processes corresponding to the N user behaviors are screened out from the actual operation processes of the Q user behaviors.

2. The method according to claim 1, wherein: The determining, based on the actual operation link, of the predicted operation link comprises: Based on the N user behaviors of the actual operation link, construct an initial transfer matrix, wherein the transfer matrix is ​​used to represent the transition probability between the initial user behavior and the final user behavior in the N user behaviors; Based on the actual operation process of the actual operation link, counting the transition probability values ​​between the N user behaviors; Filling the transfer probability values ​​into the initial transfer matrix to obtain a final transfer matrix; Based on the final transfer matrix, a predicted operation link is determined.

3. The method according to claim 2, wherein: The step of determining the prediction operation link based on the final transfer matrix includes: Based on the final transfer matrix, obtaining a proposed prediction operation link; Obtaining a preset threshold value of a transition probability value; An operation link that meets the preset threshold in the proposed predicted operation links is determined as the predicted operation link.

4. The method according to claim 1, wherein: The method further comprises: For the P user behaviors of the system under test, a test sub-case corresponding to each user behavior is generated in advance to obtain P test sub-cases.

5. The method according to claim 1, wherein: The generating and executing the test case based on the predicted operation link includes: Calling P test sub-cases corresponding to the P user behaviors that are expected to be operated; According to the expected operation flow of the P user behaviors, the P test sub-cases are arranged to generate and execute test cases.

6. A testing system comprising: an acquisition module, configured to acquire an actual operation link in response to a test instruction, wherein the actual operation link includes N user behaviors that have actually been operated among M user behaviors of the system under test and an actual operation process of the N user behaviors, where M and N are positive integers and M≥N; A determination module, configured to determine a predicted operation link based on the actual operation link, wherein the predicted operation link includes P user behaviors that are expected to be operated among the M user behaviors of the system under test and a predicted operation flow of the P user behaviors, where P is a positive integer and M≥P; A testing module, configured to generate and execute a test case based on the predicted operation link to respond to the test instruction, wherein the test case includes P test sub-cases, and the P test sub-cases correspond to the P user behaviors one by one; The test instruction includes a user feature of a specified user, and in response to the test instruction, the acquisition module includes: an acquisition submodule, configured to acquire, in response to a test instruction, Q user behaviors that have actually been executed among the M user behaviors of the system under test and actual operation processes of the Q user behaviors, where Q is a positive integer and M≥Q; A determination submodule, configured to determine a reference user based on the user characteristics of the designated user, wherein the reference user has the same and / or similar user characteristics as the designated user; A first screening submodule, configured to screen out N user behaviors that have been operated on by the reference user from the Q user behaviors that have actually been operated on; The second screening submodule is used to screen out the actual operation processes corresponding to the N user behaviors from the actual operation processes of the Q user behaviors.

7. The system according to claim 6, wherein: The system further comprises: The generating module is used to generate a test sub-case corresponding to each user behavior in advance for the P user behaviors of the system under test, so as to obtain P test sub-cases.

8. A computer system comprising: one or more processors; as well as a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

9. A computer-readable medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Automatic testing method and deviceutomated testing method and device, electronic equipment and computer readable medium

    CN109614318A