Test case generation method, device, electronic device and storage medium
By generating a target time stamp that meets the time conditions, the time window test cases are automatically generated, which solves the problems of low efficiency and poor flexibility in the generation of test cases in the prior art, and realizes efficient and accurate test case generation and rapid iteration.
Patent Information
- Application Number
- CN202111274803.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-10-29
AI Technical Summary
The software test cases of existing attribution systems are inefficient in generating, prone to errors and poor flexibility, making it difficult to iterate quickly to adapt to changes in demand.
By obtaining the pending test case template, including the use case identification, attribution link type, and initial timestamp, the target timestamp upper and lower limits that meet the time conditions are generated based on the configuration parameters, thereby automatically generating the time window test case.
Improves the efficiency and accuracy of test case generation, reduces human errors, and increases flexibility and convenience, and can quickly adapt to changes in demand.
Smart Images

Figure CN114116452B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to software testing technology, and in particular to a test case generation method, device, electronic device and storage medium. Background Art
[0002] The attribution system is an important means for Internet products to evaluate the effectiveness of attracting new users and promoting activation. Software quality assurance for the attribution system is also extremely challenging. In abstract terms, attribution is to match user activation data with ad click data to give an attribution evaluation of the advertising effect.
[0003] The current attribution system software testing workload is large, the test case generation efficiency is low, and manual calculations are prone to errors. It is also inconvenient to iterate and has poor flexibility. Summary of the invention
[0004] The present disclosure provides a test case generation method, device, electronic device and storage medium to at least solve the problems of low test case generation efficiency, prone to errors and poor flexibility in related technologies. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a test case generation method is provided, comprising:
[0006] Obtaining a test case template to be processed, wherein the test case template to be processed includes a case identifier, an attribution link type, an initial timestamp, and a time condition;
[0007] Acquire a time window parameter corresponding to the attribution link type from the configuration parameters to be tested;
[0008] Determine, according to the initial timestamp and the time window parameter, a target timestamp upper limit and a target timestamp lower limit that meet the time condition;
[0009] A time window test case corresponding to the test case identifier is generated according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit.
[0010] Optionally, the test case template to be processed also includes a sub-case identifier.
[0011] Optionally, determining, according to the initial timestamp and the time window parameter, a target timestamp upper limit and a target timestamp lower limit that satisfy the time condition includes:
[0012] If the use case identifier includes a sub-use case identifier, then determining a calculation formula corresponding to the time condition under the sub-use case identifier according to the time window parameter;
[0013] According to the initial timestamp and the calculation formula, a target timestamp upper limit and a target timestamp lower limit that satisfy the time condition corresponding to the sub-use case identifier are determined.
[0014] Optionally, the initial timestamp includes an initial timestamp upper limit and an initial timestamp lower limit;
[0015] Determining, according to the initial timestamp and the calculation formula, a target timestamp upper limit and a target timestamp lower limit that satisfy the time condition corresponding to the sub-use case identifier, including:
[0016] Determine the initial timestamp upper limit as the target timestamp upper limit, and determine the target timestamp lower limit according to the calculation formula and the target timestamp upper limit; or
[0017] The initial timestamp lower limit is determined as the target timestamp lower limit, and the target timestamp upper limit is determined according to the calculation formula and the target timestamp lower limit.
[0018] Optionally, determining, according to the initial timestamp and the time window parameter, a target timestamp upper limit and a target timestamp lower limit that satisfy the time condition includes:
[0019] If the use case identifier includes at least two sub-use case identifiers, then according to the time window parameter, respectively determine the calculation formulas corresponding to the time conditions under the at least two sub-use case identifiers;
[0020] According to the initial timestamp and at least two calculation formulas, the target timestamp upper limit and the target timestamp lower limit that meet the time conditions corresponding to the at least two sub-use case identifiers are determined respectively, and the target timestamp upper limit and the target timestamp lower limit corresponding to the at least two sub-use case identifiers are obtained.
[0021] Optionally, obtaining the test case template to be processed includes:
[0022] Traversing pre-configured test case templates, and determining the currently traversed test case template as the test case template to be processed;
[0023] After generating the time window test case corresponding to the use case identifier, the method further includes:
[0024] Add the time window test case to the test case list.
[0025] According to a second aspect of an embodiment of the present disclosure, a test case generating device is provided, comprising:
[0026] A test case template acquisition module is configured to execute and acquire a test case template to be processed, wherein the test case template to be processed includes a test case identifier, an attribution link type, an initial timestamp, and a time condition;
[0027] A time window parameter acquisition module, configured to acquire a time window parameter corresponding to the attribution link type from the configuration parameters to be tested;
[0028] A timestamp determination module is configured to determine a target timestamp upper limit and a target timestamp lower limit that meet the time condition according to the initial timestamp and the time window parameter;
[0029] The test case generation module is configured to generate a time window test case corresponding to the test case identifier according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit.
[0030] Optionally, the test case template to be processed also includes a sub-case identifier.
[0031] Optionally, the timestamp determination module includes:
[0032] A first calculation formula determination unit is configured to determine, if the use case identifier includes a sub-use case identifier, a calculation formula corresponding to the time condition under the sub-use case identifier according to the time window parameter;
[0033] The first timestamp determination unit is configured to determine a target timestamp upper limit and a target timestamp lower limit that meet a time condition corresponding to the sub-use case identifier according to the initial timestamp and the calculation formula.
[0034] Optionally, the initial timestamp includes an initial timestamp upper limit and an initial timestamp lower limit;
[0035] The first timestamp determination unit is configured to perform:
[0036] Determine the initial timestamp upper limit as the target timestamp upper limit, and determine the target timestamp lower limit according to the calculation formula and the target timestamp upper limit; or
[0037] The initial timestamp lower limit is determined as the target timestamp lower limit, and the target timestamp upper limit is determined according to the calculation formula and the target timestamp lower limit.
[0038] Optionally, the timestamp determination module includes:
[0039] A second calculation formula determination unit is configured to execute, if the use case identifier includes at least two sub-use case identifiers, then determine the calculation formulas corresponding to the time conditions under the at least two sub-use case identifiers according to the time window parameter respectively;
[0040] The second timestamp determination unit is configured to execute, based on the initial timestamp and at least two calculation formulas, respectively determine the target timestamp upper limit and the target timestamp lower limit that satisfy the time conditions corresponding to the at least two sub-use case identifiers, and obtain the target timestamp upper limit and the target timestamp lower limit that respectively correspond to the at least two sub-use case identifiers.
[0041] Optionally, the use case template acquisition module includes:
[0042] A traversal unit is configured to execute traversal of pre-configured test case templates and determine the currently traversed test case template as the test case template to be processed;
[0043] The device also includes:
[0044] The use case saving module is configured to add the time window test case to the use case list after generating the time window test case corresponding to the use case identifier.
[0045] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0046] processor;
[0047] a memory for storing instructions executable by the processor;
[0048] The processor is configured to execute the instructions to implement the test case generation method as described in the first aspect.
[0049] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the test case generation method as described in the first aspect.
[0050] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program or computer instructions, which, when executed by a processor, implements the test case generation method described in the first aspect.
[0051] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0052] The disclosed embodiment obtains a test case template to be processed, which includes a test case identifier, an attribution link type, an initial timestamp and a time condition, obtains a time window parameter corresponding to the attribution link type from the configuration parameters to be tested, determines a target timestamp upper limit and a target timestamp lower limit that meet the time condition according to the initial timestamp and the time window parameter, and generates a time window test case corresponding to the use case identifier according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit, thereby automatically generating a corresponding time window test case according to the test case template to be processed and the configuration parameters, improving the test case generation efficiency, reducing human errors, and improving the accuracy of the generated test cases. Moreover, since the test case template to be processed and the configuration parameters can be configured based on requirements, when the requirements are updated, only the configuration parameters need to be updated, and the corresponding time window test case can be regenerated based on the updated configuration parameters, thereby improving the flexibility and convenience of test case generation.
[0053] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0055] Figure 1 is a flow chart of a test case generation method according to an exemplary embodiment;
[0056] Figure 2 is a flow chart of a test case generation method according to an exemplary embodiment;
[0057] Figure 3 is a block diagram of a test case generating device according to an exemplary embodiment;
[0058] Figure 4 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0059] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0060] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0061] When conducting attribution analysis on advertising effectiveness, taking the common DeepLink technology as an example, a user clicks on an advertisement provided by an advertiser to launch a designated application (Application, App) and enter a designated page (time is recorded as t1), and then completes actions according to the guidance, such as registration, login, participation in activities, etc. (time is recorded as t2); then at time t1, the application will report the click data of the user entering the page; similarly at time t2, the user's registration or login activation data is obtained; by matching the click data and activation data, the attribution analysis of the effectiveness of this advertisement is obtained. Among them, DeepLink refers to the deep-level page link within the application, such as product feature pages, event promotion pages, etc. Advertisers using Deeplink can directly enter the designated application page after the user clicks the advertisement.
[0062] At the same time, whether the activation is effective also depends on the time window relationship between t1 and t2. In a very special case, if the user never completes the activation after entering the specified page, it is impossible to be attributed. Different strategies and different requirements will have different time window requirements. In the software testing of the attribution system, different test cases are often designed according to different time windows.
[0063] In the related technology, the software testing of the attribution system basically adopts the method of data mock, that is, to create the upstream data of the expected conditions, then execute the attribution task, and finally verify whether the attribution result meets the expectations. In this case, the design of the time window use case adopts a fixed timestamp use case. For example, if the activation effective time of DeepLink is "T1<=t2-t1<=T2", then for this requirement, several fixed times t2 and t1 will be designed to cover the requirement, and the designed t2 and t1 are obtained by manual calculation. When the activation effective time of DeepLink is "T1<=t2-t1<=T2", assuming that the lower limit of the time window of a certain requirement is T1=30 and the upper limit of the time window is T2=120, the specific timestamps of each test case can be obtained by manual calculation as shown in Table 1.
[0064] Table 1 Specific timestamps of test cases
[0065]
[0066] As can be seen from Table 1, when calculating the specific timestamp, the boundary value and equivalence class method designed by the use case are used to cover the time window.
[0067] Judging from the above use case design process and results, this method has the following disadvantages:
[0068] 1. It is impossible to quickly iterate based on demand changes. The size of the time window is affected by the strategy, and various comparative experiments are often conducted. At this time, the above "T1 = 30; T2 = 120" needs to be modified. However, this fixed timestamp method requires a lot of calculations to obtain the use case under the new iteration.
[0069] 2. Large workload and prone to errors. Different attribution links have different time windows and calculation methods. Each method has multiple time limits. Fixed timestamps are calculated manually, which is labor-intensive and prone to errors.
[0070] 3. It is difficult to meet complex time window requirements. In addition to the time window requirements of a single use case, multiple use cases also have time window related requirements. For example, clicks closer to the activation time are valid. In this case, the manual calculation of timestamps is not enough.
[0071] In order to solve the above problems, the embodiments of the present disclosure provide the following technical solutions.
[0072] Figure 1 is a flow chart of a test case generation method according to an exemplary embodiment. Figure 1 As shown, the test case generation method can be used in electronic devices such as computers, and is suitable for testing attribution systems, and includes the following steps.
[0073] In step S11, a test case template to be processed is obtained, wherein the test case template to be processed includes a case identifier, an attribution link type, an initial timestamp, and a time condition.
[0074] The test case template to be processed may be a pre-configured test case template, which is pre-configured with a test case identifier, an attribution link type, an initial timestamp, and a time condition. The initial timestamp may include an initial timestamp lower limit and an initial timestamp upper limit, or may include only one of the initial timestamp lower limit and the initial timestamp upper limit. The time condition is a condition that the target timestamp to be determined in the current test case needs to satisfy.
[0075] A test case template may be obtained from the pre-configured test case templates as the test case template to be processed. For example, a test case template may be randomly selected from the pre-configured test case templates as the test case template to be processed; or, a test case template may be obtained from the pre-configured test case templates one by one as the test case template to be processed.
[0076] In step S12, a time window parameter corresponding to the attribution link type is obtained from the configuration parameters to be tested.
[0077] The configuration parameters to be tested are the correspondence between the pre-configured attribution link type and the time window parameter. After obtaining the test case template to be processed, the corresponding time window parameter can be obtained from the configuration parameter based on the attribution link type in the test case template to be processed. The time window parameter may include an upper limit of the time window and a lower limit of the time window, the lower limit of the time window, i.e., the above-mentioned T1, is the minimum time window width to be satisfied, and the upper limit of the time window, i.e., the above-mentioned T2, is the maximum time window width to be satisfied.
[0078] By configuring parameters, the problem in related technologies that it is impossible to quickly iterate in response to changes in requirements can be solved. When the time window requirements change, you only need to update the configuration parameters of the corresponding attribution link. Then, you can regenerate test cases based on the updated configuration parameters to obtain time window test cases under the new requirements.
[0079] In step S13, a target timestamp upper limit and a target timestamp lower limit that meet the time condition are determined according to the initial timestamp and the time window parameter.
[0080] The time condition specifies the relationship between the time window composed of the target timestamp upper limit and the target timestamp lower limit to be determined and the time window parameters, so that based on the time condition and the time window parameters, the conditions that need to be satisfied by the time window composed of the target timestamp upper limit and the target timestamp lower limit can be determined, and then the target timestamp upper limit and the target timestamp lower limit can be obtained according to the initial timestamp. For example, the initial timestamp upper limit in the initial timestamp can be determined as the target timestamp upper limit, so that the target timestamp lower limit can be obtained based on the conditions that need to be satisfied by the time window composed of the target timestamp upper limit and the target timestamp lower limit and the target timestamp upper limit; or the initial timestamp lower limit in the initial timestamp can be determined as the target timestamp lower limit, so that the target timestamp upper limit can be obtained based on the conditions that need to be satisfied by the time window composed of the target timestamp upper limit and the target timestamp lower limit and the target timestamp lower limit.
[0081] In an exemplary embodiment, the test case template to be processed further includes a sub - case identifier. One use - case identifier can correspond to one or more sub - case identifiers. When one use - case identifier corresponds to one sub - case identifier, it is the time - window requirement of a single test case itself; when one use - case identifier corresponds to multiple sub - case identifiers, the multiple sub - cases have time - window - related requirements.
[0082] In an exemplary embodiment, according to the initial timestamp and the time - window parameter, determining the upper limit and the lower limit of the target timestamp that meet the time condition includes: If there is one sub - case identifier under the use - case identifier, then according to the time - window parameter, determining the calculation formula corresponding to the time condition under the sub - case identifier; According to the initial timestamp and the calculation formula, determining the upper limit and the lower limit of the target timestamp that meet the time condition corresponding to the sub - case identifier.
[0083] When there is one sub - case identifier under the use - case identifier, it indicates that this test case is a single test case with its own time - window requirement. At this time, the calculation formula corresponding to the time condition under the sub - case identifier can be determined according to the time - window parameter. For example, when the time condition is lower than the time - window lower limit (Under_Min) in the time - window parameter, that is, the time condition is t2 - t1 < T1, the determined calculation formula can be t2 - t1 = T1 - a, where a can be any value less than T1, for example, it can be 1.
[0084] After determining the calculation formula corresponding to the time condition under the sub - case identifier, the upper limit or the lower limit of the target timestamp can be determined according to the initial timestamp. Thus, substituting the determined upper limit of the target timestamp into the calculation formula to obtain the lower limit of the target timestamp, or substituting the determined lower limit of the target timestamp into the calculation formula to obtain the upper limit of the target timestamp, so as to obtain the upper limit and the lower limit of the target timestamp that meet the time condition corresponding to the sub - case identifier.
[0085] When there is one sub - case identifier under the use - case identifier, the calculation formula corresponding to the time condition under the sub - case identifier can be determined according to the time - window parameter. Furthermore, according to the initial timestamp and the calculation formula, the upper limit and the lower limit of the target timestamp that meet the time condition corresponding to the sub - case identifier can be determined, realizing that for a single use - case, the target timestamp in the test case can be flexibly determined.
[0086] In an exemplary embodiment, the initial timestamp includes an upper limit of the initial timestamp and a lower limit of the initial timestamp;
[0087] According to the initial timestamp and the calculation formula, determining the upper limit and the lower limit of the target timestamp that meet the time condition corresponding to the sub - case identifier includes:
[0088] Determine the initial timestamp upper limit as the target timestamp upper limit, and determine the target timestamp lower limit according to the calculation formula and the target timestamp upper limit; or
[0089] The initial timestamp lower limit is determined as the target timestamp lower limit, and the target timestamp upper limit is determined according to the calculation formula and the target timestamp lower limit.
[0090] When the initial timestamp includes the initial timestamp upper limit and the initial timestamp lower limit, the initial timestamp upper limit can be directly determined as the target timestamp upper limit, and the target timestamp upper limit is substituted into the calculation formula to obtain the target timestamp lower limit; or, the initial timestamp lower limit can be directly determined as the target timestamp lower limit, and the target timestamp lower limit is substituted into the calculation formula to obtain the target timestamp upper limit. When the initial timestamp includes the initial timestamp upper limit and the initial timestamp lower limit, the initial timestamp upper limit or the initial timestamp lower limit can be flexibly used as the basis to determine the target timestamp upper limit and the target timestamp lower limit that meet the time conditions.
[0091] In another exemplary embodiment, a target timestamp upper limit and a target timestamp lower limit that satisfy the time condition are determined based on the initial timestamp and the time window parameter, including: if the use case identifier includes at least two sub-use case identifiers, then based on the time window parameter, respectively determining the calculation formulas corresponding to the time conditions under the at least two sub-use case identifiers; based on the initial timestamp and at least two calculation formulas, respectively determining the target timestamp upper limit and the target timestamp lower limit that satisfy the time conditions corresponding to the at least two sub-use case identifiers, to obtain the target timestamp upper limit and the target timestamp lower limit that respectively correspond to the at least two sub-use case identifiers.
[0092] When there are at least two sub - use - case identifiers under the use - case identifier, it indicates that this test case is multiple test cases with associated time - window requirements. At this time, the time conditions under multiple sub - use - case identifiers can be comprehensively considered, and the calculation formulas corresponding to the time conditions under at least two sub - use - case identifiers can be determined respectively according to the time - window parameters under each sub - use - case identifier. For example, there are two sub - use - case identifiers under a use - case identifier. The time condition under sub - use - case identifier 1 is normal and the upper limit of the target timestamp is closer to the lower limit of the target timestamp (Normal_Closed), and the time condition under sub - use - case identifier 2 is normal and the upper limit of the target timestamp is farther from the lower limit of the target timestamp (Normal_Far), that is, the time condition is T1 < t2 - t1 < T2 and t2 is closer to t1 under sub - use - case identifier 1, and t2 is farther from t1 under sub - use - case identifier 2. In this way, it can be determined that the calculation formula under sub - use - case identifier 1 is that t2 - t1 is a value slightly greater than T1, that is, t2 - t1 = T1 + a, where a is a value much smaller than T2 - T1, for example, it can be 1. The calculation formula under sub - use - case identifier 2 is that t2 - t1 is a value slightly less than T2, that is, t2 - t1 = T2 - b, where b is a value much smaller than T2 - T1, for example, it can be 1.
[0093] After determining the calculation formulas corresponding to at least two sub - use - case identifiers respectively, for each sub - use - case identifier, the upper limit of the target timestamp or the lower limit of the target timestamp can be determined according to the initial timestamp. Then, substitute the determined upper limit of the target timestamp into the calculation formula corresponding to this sub - use - case identifier to obtain the lower limit of the target timestamp under this sub - use - case identifier, or substitute the determined lower limit of the target timestamp into the calculation formula corresponding to this sub - use - case identifier to obtain the upper limit of the target timestamp under this sub - use - case identifier, so as to obtain the upper limit of the target timestamp and the lower limit of the target timestamp corresponding to at least two sub - use - case identifiers respectively.
[0094] When there are at least two sub - use - case identifiers under the use - case identifier, the calculation formulas corresponding to the time conditions under at least two sub - use - case identifiers can be determined respectively according to the time - window parameters, and then the upper limit of the target timestamp and the lower limit of the target timestamp corresponding to each sub - use - case identifier can be determined according to the initial timestamp and at least two calculation formulas, realizing that for relatively complex time - window use cases, the target timestamp in the test case can be flexibly determined, which can meet the requirements of relatively complex scenarios.
[0095] In step S14, according to the to - be - processed test - case template, the upper limit of the target timestamp and the lower limit of the target timestamp, a time - window test case corresponding to the use - case identifier is generated.
[0096] After obtaining the target timestamp upper limit and the target timestamp lower limit, the target timestamp upper limit and the target timestamp lower limit can be used to replace the initial timestamp in the test case template to obtain a time window test case corresponding to the use case identifier. The time window test case may include a use case identifier, a sub-use case identifier, an attribution link type, a target timestamp upper limit and a target timestamp lower limit.
[0097] The test case generation method provided by this exemplary embodiment obtains a test case template to be processed, where the test case template to be processed includes a use case identifier, an attribution link type, an initial timestamp and a time condition, obtains a time window parameter corresponding to the attribution link type from the configuration parameters to be tested, determines a target timestamp upper limit and a target timestamp lower limit that meet the time condition according to the initial timestamp and the time window parameter, and generates a time window test case corresponding to the use case identifier according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit, thereby realizing automatic generation of corresponding time window test cases according to the test case template to be processed and the configuration parameters, improving the test case generation efficiency, reducing human errors, and improving the accuracy of the generated test cases. Moreover, since the test case template to be processed and the configuration parameters can be configured based on requirements, when the requirements are updated, only the configuration parameters need to be updated, and the corresponding time window test cases can be regenerated based on the updated configuration parameters, thereby improving the flexibility and convenience of test case generation.
[0098] On the basis of the above technical solution, the obtaining of the test case template to be processed includes: traversing the pre-configured test case templates, and determining the currently traversed test case template as the test case template to be processed;
[0099] After generating the time window test case corresponding to the use case identifier, the method further includes: adding the time window test case to a use case list.
[0100] In the test of an attribution system, for the activation effective time, multiple corresponding test case templates can be pre-configured, each test case template can include a case identifier, an attribution link type, an initial timestamp and a time condition, and configuration parameters that meet different requirements can be pre-configured. When generating test cases based on test case templates, the pre-configured test case templates can be traversed, and the currently traversed test case template can be determined as a test case template to be processed, thereby generating a corresponding time window test case based on the above test case generation method. After the time window test case is generated, the time window test case is added to the use case list, and the test case to be executed can be obtained from the use case list and tested later.
[0101] By traversing the pre-configured test case templates, corresponding time window test cases can be generated for the pre-configured multiple test case templates in turn, thereby avoiding missing a test case.
[0102] Figure 2 is a flow chart of a test case generation method according to an exemplary embodiment. Figure 2 As shown, the test case generation method can be used in electronic devices such as computers, and is suitable for testing attribution systems, and includes the following steps.
[0103] In step S21, the pre-configured test case templates are traversed, and the currently traversed test case template is determined as the test case template to be processed.
[0104] The test case template to be processed includes a case identifier, a sub-case identifier, an attribution link type, an initial timestamp and a time condition.
[0105] One sub-use case identifier corresponds to one sub-use case. All sub-use cases under the same use case identifier can be stored in groups. One group can include one sub-use case identifier or multiple sub-use case identifiers.
[0106] The time condition is defined in the test case template. Through different definitions of the time condition, the target timestamp that meets the time condition can be automatically calculated. For the above example: the activation validity period of DeepLink is "T1<=t2-t1<=T2", then the time conditions of each test case can be shown in Table 2:
[0107] Table 2 Time conditions of test cases
[0108]
[0109]
[0110] As shown in Table 2, in general, the time condition is a description of the time window boundary value and the equivalence class. In the test case generation process, the target timestamp that meets the conditions will be given flexibly, conveniently and automatically according to the definition of the time condition, which can solve the problem of large manual calculation workload and easy errors.
[0111] By defining time conditions that meet the requirements, more complex attribution requirements can be met. Taking the click time closer to the activation time as an example, the time conditions shown in Table 3 can be defined.
[0112] Table 3 Time conditions for complex attribution requirements
[0113]
[0114] As shown in Table 3, through personalized time condition definition, more complex time window test cases can be obtained to meet various scenarios.
[0115] In step S22, a time window parameter corresponding to the attribution link type is obtained from the configuration parameters to be tested.
[0116] The configuration parameters are the correspondence between the attribution link type and the time window parameter configured according to the attribution requirements. After obtaining the test case template to be processed, the corresponding time window parameter can be obtained from the configuration parameters based on the attribution link type in the test case template to be processed.
[0117] In step S23, a target timestamp upper limit and a target timestamp lower limit that meet the time condition are determined according to the initial timestamp and the time window parameter.
[0118] When the test case identifier includes one sub-case identifier or at least two sub-case identifiers, different methods can be used to determine the target timestamp upper limit and the target timestamp lower limit that meet the time conditions of each sub-case identifier.
[0119] When a sub-case identifier is included under the test case identifier, if the time condition is higher than the time window upper limit (Over_Max) in the time window parameter, a target timestamp upper limit and a target timestamp lower limit that meet the time condition are calculated for the time condition.
[0120] When the test case identifier includes at least two sub-case identifiers, the time conditions under each sub-case identifier are comprehensively considered, such as the time conditions are normal value and the target timestamp upper limit is closer to the target timestamp lower limit (Normal_Closed), normal value and the target timestamp upper limit is farther from the target timestamp lower limit (Normal_Far), and the target timestamp upper limit and target timestamp lower limit that meet each time condition are calculated.
[0121] For a use case identifier that includes one or more sub-use case identifiers, the target timestamp will be calculated according to different time conditions (time_condition). When calculating the target timestamp, the input is the initial timestamp t2, t1 in the test case template to be processed and the time window parameter of the corresponding attribution link type. Taking the above activation effective time of "T1<=t2-t1<=T2" as an example, assuming that the lower limit of the time window of a certain requirement is T1=30 and the upper limit of the time window is T2=120, the specific calculation process is shown in Table 4.
[0122] Table 4 Target timestamp calculation process
[0123]
[0124]
[0125] In step S24, a time window test case corresponding to the test case identifier is generated according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit.
[0126] In step S25, the time window test case is added to the test case list.
[0127] In step S26, it is determined whether all the pre-configured test case templates have been processed. If yes, the process ends; otherwise, the process proceeds to step S21.
[0128] When all pre-configured test case templates have not been processed, the above steps S21 to S25 are executed in a loop until all time window test cases corresponding to the pre-configured test case templates are generated.
[0129] The test case generation method provided by this exemplary embodiment can pre-configure test case templates and configuration parameters. When the attribution requirements change, the configuration parameters to be tested can be updated, and the corresponding time window test cases can be generated based on the updated configuration parameters. The requirement iteration can be quickly adapted and the target timestamp can be automatically calculated according to the time condition, which can reduce the workload and the possibility of errors. When one use case identifier corresponds to multiple sub-use case identifiers, the time conditions can be combined to meet more complex scenario requirements, thereby improving the flexibility and convenience of test case generation.
[0130] Figure 3 is a block diagram of a test case generation device according to an exemplary embodiment. Figure 3 The device includes a test case template acquisition module 31, a time window parameter acquisition module 32, a timestamp determination module 33 and a test case generation module 34.
[0131] The test case template acquisition module 31 is configured to execute acquisition of a test case template to be processed, wherein the test case template to be processed includes a test case identifier, an attribution link type, an initial timestamp and a time condition;
[0132] The time window parameter acquisition module 32 is configured to acquire the time window parameter corresponding to the attribution link type from the configuration parameters to be tested;
[0133] The timestamp determination module 33 is configured to determine a target timestamp upper limit and a target timestamp lower limit that meet the time condition according to the initial timestamp and the time window parameter;
[0134] The test case generation module 34 is configured to generate a time window test case corresponding to the test case identifier according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit.
[0135] Optionally, the test case template to be processed also includes a sub-case identifier.
[0136] Optionally, the timestamp determination module includes:
[0137] A first calculation formula determination unit is configured to determine, if the use case identifier includes a sub-use case identifier, a calculation formula corresponding to the time condition under the sub-use case identifier according to the time window parameter;
[0138] The first timestamp determination unit is configured to determine a target timestamp upper limit and a target timestamp lower limit that meet a time condition corresponding to the sub-use case identifier according to the initial timestamp and the calculation formula.
[0139] Optionally, the initial timestamp includes an initial timestamp upper limit and an initial timestamp lower limit;
[0140] The first timestamp determination unit is configured to perform:
[0141] Determine the initial timestamp upper limit as the target timestamp upper limit, and determine the target timestamp lower limit according to the calculation formula and the target timestamp upper limit; or
[0142] The initial timestamp lower limit is determined as the target timestamp lower limit, and the target timestamp upper limit is determined according to the calculation formula and the target timestamp lower limit.
[0143] Optionally, the timestamp determination module includes:
[0144] A second calculation formula determination unit is configured to execute, if the use case identifier includes at least two sub-use case identifiers, then determine the calculation formulas corresponding to the time conditions under the at least two sub-use case identifiers according to the time window parameter respectively;
[0145] The second timestamp determination unit is configured to execute, based on the initial timestamp and at least two calculation formulas, respectively determine the target timestamp upper limit and the target timestamp lower limit that satisfy the time conditions corresponding to the at least two sub-use case identifiers, and obtain the target timestamp upper limit and the target timestamp lower limit that respectively correspond to the at least two sub-use case identifiers.
[0146] Optionally, the use case template acquisition module includes:
[0147] A traversal unit is configured to execute traversal of pre-configured test case templates and determine the currently traversed test case template as the test case template to be processed;
[0148] The device also includes:
[0149] The use case saving module is configured to add the time window test case to the use case list after generating the time window test case corresponding to the use case identifier.
[0150] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0151] Figure 4 4 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 400 may be provided as a computer or a server. Figure 4 , the electronic device 400 includes a processing component 422, which further includes one or more processors, and a memory resource represented by a memory 432, for storing instructions that can be executed by the processing component 422, such as an application. The application stored in the memory 432 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 422 is configured to execute instructions to perform the above-mentioned test case generation method.
[0152] The electronic device 400 may also include a power supply component 426 configured to perform power management of the electronic device 400, a wired or wireless network interface 450 configured to connect the electronic device 400 to a network, and an input / output (I / O) interface 458. The electronic device 400 may operate based on an operating system stored in the memory 432, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0153] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 432 including instructions, and the above instructions can be executed by the processing component 422 of the electronic device 400 to complete the above test case generation method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0154] In an exemplary embodiment, a computer program product is also provided, including a computer program or a computer instruction, wherein the computer program or the computer instruction implements the above-mentioned test case generating method when executed by a processor.
[0155] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0156] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A test case generation method, It is characterized in that include: Obtaining a test case template to be processed, wherein the test case template to be processed includes a case identifier, an attribution link type, an initial timestamp, and a time condition; The time condition specifies the relationship between the time window composed of the target timestamp upper limit and the target timestamp lower limit to be determined and the time window parameter; Acquire a time window parameter corresponding to the attribution link type from the configuration parameters to be tested; Determine, according to the initial timestamp and the time window parameter, a target timestamp upper limit and a target timestamp lower limit that meet the time condition; Generate a time window test case corresponding to the test case identifier according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit; The initial timestamp includes an initial timestamp upper limit and an initial timestamp lower limit, and determining a target timestamp upper limit and a target timestamp lower limit that meet the time condition according to the initial timestamp and the time window parameter includes: Determine, according to the time window parameter, a calculation formula corresponding to the time condition under the use case identification; Determine the initial timestamp upper limit as the target timestamp upper limit, and determine the target timestamp lower limit according to the calculation formula and the target timestamp upper limit; or, The initial timestamp lower limit is determined as the target timestamp lower limit, and the target timestamp upper limit is determined according to the calculation formula and the target timestamp lower limit.
2. The method according to claim 1, It is characterized in that The test case template to be processed also includes a sub-case identifier.
3. The method according to claim 2, It is characterized in that Determining a calculation formula corresponding to the time condition under the use case identifier according to the time window parameter includes: If the use case identifier includes a sub-use case identifier, a calculation formula corresponding to the time condition under the sub-use case identifier is determined according to the time window parameter.
4. The method according to claim 2, It is characterized in that Determining a calculation formula corresponding to the time condition under the use case identifier according to the time window parameter includes: If the use case identifier includes at least two sub-use case identifiers, the calculation formulas corresponding to the time conditions under the at least two sub-use case identifiers are determined respectively according to the time window parameter.
5. The method according to claim 1, It is characterized in that The obtaining of the test case template to be processed includes: Traversing pre-configured test case templates, and determining the currently traversed test case template as the test case template to be processed; After generating the time window test case corresponding to the use case identifier, the method further includes: Add the time window test case to the test case list.
6. A test case generating device, It is characterized in that include: The test case template acquisition module is configured to execute and acquire a test case template to be processed, wherein the test case template to be processed includes a test case identifier, an attribution link type, an initial timestamp and a time condition; the time condition specifies a relationship between a time window composed of a target timestamp upper limit and a target timestamp lower limit to be determined and a time window parameter; the initial timestamp includes an initial timestamp upper limit and an initial timestamp lower limit, A time window parameter acquisition module, configured to acquire a time window parameter corresponding to the attribution link type from the configuration parameters to be tested; A timestamp determination module is configured to determine a target timestamp upper limit and a target timestamp lower limit that meet the time condition according to the initial timestamp and the time window parameter; wherein the timestamp determination module is configured to determine a calculation formula corresponding to the time condition under the use case identifier according to the time window parameter; determine the initial timestamp upper limit as the target timestamp upper limit, and determine the target timestamp lower limit according to the calculation formula and the target timestamp upper limit; or determine the initial timestamp lower limit as the target timestamp lower limit, and determine the target timestamp upper limit according to the calculation formula and the target timestamp lower limit; The test case generation module is configured to generate a time window test case corresponding to the test case identifier according to the test case template to be processed, the target timestamp upper limit and the target timestamp lower limit.
7. The device according to claim 6, It is characterized in that The test case template to be processed also includes a sub-case identifier.
8. The device according to claim 7, It is characterized in that The timestamp determination module comprises: The first calculation formula determination unit is configured to determine the calculation formula corresponding to the time condition under the sub-case identification according to the time window parameter if the use case identification includes a sub-case identification.
9. The device according to claim 7, It is characterized in that The timestamp determination module comprises: The second calculation formula determination unit is configured to execute, if the use case identifier includes at least two sub-use case identifiers, then determine the calculation formulas corresponding to the time conditions under the at least two sub-use case identifiers according to the time window parameter.
10. The device according to claim 6, It is characterized in that The use case template acquisition module includes: A traversal unit is configured to execute traversal of pre-configured test case templates and determine the currently traversed test case template as the test case template to be processed; The device also includes: The use case saving module is configured to add the time window test case to the use case list after generating the time window test case corresponding to the use case identifier.
11. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the test case generation method as described in any one of claims 1 to 5.
12. A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to execute the test case generating method according to any one of claims 1 to 5.
13. A computer program product comprising a computer program or computer instructions, It is characterized in that When the computer program or computer instruction is executed by a processor, the test case generation method according to any one of claims 1 to 5 is implemented.
