CN111767210A - Policy testing method and device, computer equipment and storage medium - Google Patents
Policy testing method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN111767210A CN111767210A CN202010532657.8A CN202010532657A CN111767210A CN 111767210 A CN111767210 A CN 111767210A CN 202010532657 A CN202010532657 A CN 202010532657A CN 111767210 A CN111767210 A CN 111767210A
- Authority
- CN
- China
- Prior art keywords
- case
- test
- strategy
- use case
- tested
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application relates to a policy testing method, a policy testing device, computer equipment and a computer-readable storage medium, wherein the policy testing method comprises the following steps: acquiring a reference case corresponding to a strategy to be tested, wherein the reference case at least comprises: executing a plurality of variables required by the strategy to be tested, the initial variable value of each variable and the expected execution result of the use case; acquiring use case configuration information, wherein the use case configuration information comprises a configuration variable value of at least one variable in a plurality of variables and a use case expected execution result corresponding to the configuration variable value; replacing an initial variable value of at least one variable in the reference case and an expected execution result of the reference case by using case configuration information to obtain a test case; and executing the test case, recording test data generated by executing the test case, and generating a test report of the strategy to be tested according to the test data. Through the method and the device, the problem of low strategy testing efficiency in the related technology is solved, and the strategy testing efficiency is improved.
Description
Technical Field
The present application relates to the field of test technologies, and in particular, to a policy testing method, a policy testing apparatus, a computer device, and a computer-readable storage medium.
Background
A policy is generally a scheme set composed of rules and decisions, which make decisions on the objects of certain properties by arranging and combining a series of rules according to different scenarios to achieve the evaluation goal. For example, in a risk assessment scenario, a risk policy is mainly executed to obtain an assessment result of an assessment target.
In order to guarantee the quality of the strategy, the strategy needs to be tested, including verifying the rules and model logics of each node of the strategy and verifying the correctness of data. Fig. 1 is a schematic diagram of a policy test according to the related art, as shown in fig. 1, the related art generally employs a test Framework such as a Robot Framework to write a test case script of a policy, where the test case script includes a case script and a case rule script, and manually executes the test case of the policy in a policy execution system, where the policy execution system is built by an Integrated Development Environment (IDE), and during the process of executing the test case, the policy execution system calls a case test interface, executes the case, returns an execution result, and the test Framework verifies the execution result through the case rule script, outputs a test report, and provides quality of analysis policy for a test developer.
In a strategy test scheme of the related art, a test developer usually compiles a test case script, and variable values of the case corresponding to a strategy need to be defined in the test case script, so that the strategy test efficiency is low due to the fact that the test case script is wrongly compiled due to the fact that the variable values are complicated in type and large in quantity.
At present, no effective solution is provided for the problem of low strategy test efficiency in the related technology.
Disclosure of Invention
The embodiment of the application provides a strategy testing method, a strategy testing device, computer equipment and a computer readable storage medium, so as to at least solve the problem of low strategy testing efficiency in the related art.
In a first aspect, an embodiment of the present application provides a policy testing method, including:
acquiring a reference use case corresponding to a strategy to be tested, wherein the reference use case at least comprises: executing a plurality of variables required by the to-be-tested strategy, an initial variable value of each variable and an expected execution result of a use case;
acquiring use case configuration information, wherein the use case configuration information comprises a configuration variable value of at least one variable of the variables and a use case expected execution result corresponding to the configuration variable value;
replacing the initial variable value of the at least one variable in the reference use case and the expected execution result of the reference use case by using the use case configuration information to obtain a test use case;
and executing the test case, recording test data generated by executing the test case, and generating a test report of the strategy to be tested according to the test data.
In some embodiments, the test case includes: and the variables are variables of the interface test cases.
In some of these embodiments, the policy to be tested comprises a plurality of rules and execution logic for the plurality of rules; before obtaining a reference use case corresponding to a policy to be tested, the method further includes:
generating the plurality of interface test cases according to the interfaces required to be called by the plurality of rules and the initial variable values;
and generating the reference case according to the plurality of interface test cases and the execution logic of the plurality of rules.
In some embodiments, before obtaining the reference use case corresponding to the policy to be tested, the method further includes: generating a use case configuration information configuration template according to the reference use case, wherein the use case configuration information configuration template comprises a configuration template for configuring the plurality of variables and a configuration template for configuring an expected execution result of the use case;
acquiring the use case configuration information comprises: and receiving the editing operation of the user on the use case configuration information configuration template to obtain the use case configuration information.
In some embodiments, executing the test case comprises:
and transmitting the variable and the variable value thereof in the test case to a strategy platform, and requesting the strategy platform to execute the strategy to be tested according to the variable and the variable value thereof in the test case, wherein the strategy platform calls a corresponding interface according to the variable and the variable value thereof in the test case in the process of executing the strategy to be tested.
In some of these embodiments, the test data includes at least one of:
executing process data generated in the process of the strategy to be tested;
and executing result data generated by the strategy to be tested.
In some of these embodiments, the process data includes at least one of:
executing the information of the interface called in the process of the strategy to be tested;
the return value of the interface called in the process of executing the to-be-tested strategy and/or the assertion rule check result information of the return value;
executing the information of the rules hit in the process of the strategy to be tested;
and executing the information of the decision group executed in the process of the strategy to be tested.
In a second aspect, an embodiment of the present application provides a policy testing apparatus, including:
the first obtaining module is configured to obtain a reference case corresponding to a policy to be tested, where the reference case at least includes: executing a plurality of variables required by the to-be-tested strategy, an initial variable value of each variable and an expected execution result of a use case;
the second obtaining module is used for obtaining use case configuration information, wherein the use case configuration information comprises a configuration variable value of at least one variable in the variables and a use case expected execution result corresponding to the configuration variable value;
the replacing module is used for replacing the initial variable value of the at least one variable in the reference use case and the expected execution result of the reference use case by using the use case configuration information to obtain a test use case;
and the execution module is used for executing the test case, recording test data generated by executing the test case and generating a test report of the strategy to be tested according to the test data.
In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the policy testing method according to the first aspect when executing the computer program.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the policy testing method according to the first aspect.
Compared with the related art, the policy testing method, the policy testing apparatus, the computer device and the computer readable storage medium provided by the embodiment of the application obtain the reference case corresponding to the policy to be tested, where the reference case at least includes: executing a plurality of variables required by the strategy to be tested, the initial variable value of each variable and the expected execution result of the use case; acquiring use case configuration information, wherein the use case configuration information comprises a configuration variable value of at least one variable in a plurality of variables and a use case expected execution result corresponding to the configuration variable value; replacing an initial variable value of at least one variable in the reference case and an expected execution result of the reference case by using case configuration information to obtain a test case; and executing the test case, recording test data generated by executing the test case, and generating a test report of the strategy to be tested according to the test data. The problem of low strategy testing efficiency in the related technology is solved, and the strategy testing efficiency is improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a schematic diagram of a policy test according to the related art;
FIG. 2 is a flow chart of a policy testing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an automated testing architecture for a wind control strategy according to an embodiment of the present application;
FIG. 4 is a flow chart illustrating an automated testing of a wind control strategy according to an embodiment of the present application;
FIG. 5 is a block diagram of a policy testing device according to an embodiment of the present application;
fig. 6 is a hardware configuration diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any creative effort belong to the protection scope of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Reference to "connected," "coupled," and the like in this application is not intended to be limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The term "plurality" as referred to herein means two or more. "and/or" describes an association relationship of associated objects, meaning that three relationships may exist, for example, "A and/or B" may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. Reference herein to the terms "first," "second," "third," and the like, are merely to distinguish similar objects and do not denote a particular ordering for the objects.
The embodiment provides a strategy testing method. Fig. 2 is a flowchart of a policy testing method according to an embodiment of the present application, and as shown in fig. 2, the flowchart includes the following steps:
step S201, obtaining a reference case corresponding to the strategy to be tested, wherein the reference case at least comprises: a plurality of variables required by executing the strategy to be tested, an initial variable value of each variable and an expected execution result of the use case.
The reference use case in this embodiment may be executed in an interface of the test policy, where a variable includes an interface entry parameter, and an expected execution result of the use case includes an interface return value. In the related technology, in the process of performing the strategy test, a test developer needs to know interface input parameters and interface return values first and then manually compile a test case script, and because the interface input parameters and the interface return values related to different strategies are various and large in quantity, errors are easily generated in the process of compiling the test case script, and the strategy test efficiency is low. Moreover, the professional threshold of the test scheme is high, the test scheme is not suitable for common testers, and the universal application value is low.
In order to solve the problems, in the process of the strategy test, a reference case is set, a test case script is realized in the reference case, the reference case script comprises a plurality of variables required by executing the strategy to be tested, initial variable values of each variable and expected execution results of the case, reference is provided for implementing the strategy test, and ordinary testers do not need to know interface input parameters and interface return values, so that the test difficulty is reduced.
Step S202, acquiring use case configuration information, wherein the use case configuration information comprises a configuration variable value of at least one variable of the variables and a use case expected execution result corresponding to the configuration variable value.
Variables in the use case configuration information exist in the reference use case, the configuration variable values of which may be variable values different from the initial variable values in the reference use case, and the expected execution results of the use cases in the use case configuration information may be expected execution results different from the expected execution results in the reference use case. In the related art, the test cases of the policies are usually written into thousands of test cases according to different variable values, the policy execution system needs to load the whole test case before executing the test case each time, and the resources of the policy execution system are lost when the to-be-tested policies relate to a large number of case variable values. By setting the case configuration information, the policy execution system does not need to load the whole test case before executing each test case, only needs to load variable values and expected execution results, namely, all test cases of the to-be-tested policy can be obtained through one-time case configuration information loading operation, and resource loss of the policy execution system is reduced.
Step S203, replacing the initial variable value of at least one variable in the reference case and the expected execution result of the reference case by using the case configuration information to obtain a test case.
In this step, a copy of the reference use case may be created by referring to the use case, and in the copy, the use case configuration information is selected to replace the initial variable values and the expected execution results of some or all of the variables, so as to generate the test case. According to the method and the device, in the test case generation process, by replacing case configuration information, the probability of errors caused when the test case script is edited in the related technology is reduced, and the efficiency of strategy test is improved; meanwhile, the technical threshold of the strategy test is also reduced, common testers can complete the strategy test, and the general application value of the strategy test is improved.
Step S204, executing the test case, recording test data generated by executing the test case, and generating a test report of the strategy to be tested according to the test data.
The strategy testing process can be integrated in the strategy execution system, the strategy execution system executes the test case, test data generated by executing the test case is recorded, and a test report of the strategy to be tested is generated according to the test data. For example, a test Framework such as a Robot Framework is integrated in a policy execution system, after the policy execution system executes a test case, test data generated by executing the test case is recorded by the Robot Framework, and a test report of a to-be-tested policy is generated according to the test data.
Through the steps, the problem of low strategy testing efficiency in the related technology is solved, and the strategy testing efficiency is improved.
In step S203, the test case is configured to include: and the variables are variables of the interface test cases. In this embodiment, the test case may be executed in an interface of the test policy, where the variable includes an interface entry parameter, and the expected execution result of the test case includes an interface return value.
In the policy execution system, the policy to be tested comprises a plurality of rules and execution logic of the plurality of rules; before acquiring a reference case corresponding to a strategy to be tested, generating a plurality of interface test cases according to interfaces required to be called by a plurality of rules and initial variable values; and generating a reference case according to the multiple interface test cases and the execution logic of the multiple rules.
The strategy often comprises a series of rules and execution logics, initial variable values in reference cases are used for participating in the calculation of the rules, and execution results are obtained according to the execution logics in the calculation process, wherein the initial variable values are input parameters of the interface, and the execution results are return values of the interface. As a specific implementation manner, in the process of generating the reference case according to the multiple interface test cases and the execution logic of the multiple rules, the initial variable value may be set as an admission variable value, where the admission variable value indicates that all execution results corresponding to the admission variable value are passed, so as to provide a reference for the execution result corresponding to the replaced variable value after replacing some initial variable value with some configuration variable value.
In order to further improve the efficiency of the policy test, in some embodiments, a use case configuration information configuration template may be generated according to a reference use case, where the use case configuration information configuration template includes a configuration template for configuring a plurality of variables and a configuration template for configuring an expected execution result of the use case; and obtaining the use case configuration information by receiving the editing operation of a user on the use case configuration information configuration template. In this embodiment, the case configuration information configuration template provides preset variable values and expected execution results for ordinary testers, and the ordinary testers only need to change some variable values or the expected execution results, and do not need to operate the cooperation between the case configuration information and the reference case, thereby further reducing the difficulty of the ordinary testers in testing the strategy.
In step S204, executing the test case includes: and transmitting the variable and the variable value thereof in the test case to a strategy platform, and requesting the strategy platform to execute the strategy to be tested according to the variable and the variable value thereof in the test case, wherein the strategy platform calls a corresponding interface according to the variable and the variable value thereof in the test case in the process of executing the strategy to be tested.
In this embodiment, the policy platform includes a policy execution system, and the policy platform may transmit the variable value in the test case to the corresponding interface through the policy execution system in the process of executing the test case, that is, the variable value participates in the calculation of the rule corresponding to the interface, generates an execution result according to the execution logic, and returns the execution result as an interface return value.
In some of these embodiments, the test data includes at least one of: executing process data generated in the process of the strategy to be tested; and executing result data generated by the strategy to be tested.
Wherein the process data includes variable values, and the result data includes execution results corresponding to the variable values
In some of these embodiments, the process data includes at least one of: executing the information of the interface called in the process of the strategy to be tested; checking result information of a return value of an interface called in the process of executing the strategy to be tested and/or an assertion rule of the return value; information of rules hit in the process of executing the strategy to be tested; information of the decision group executed in the process of executing the policy to be tested.
In this embodiment, by recording information of an interface called in the process of executing a policy to be tested, a rule and an execution logic corresponding to the interface can be determined; the execution result can be determined by recording the return value of the interface called in the process of executing the strategy to be tested and/or the verification result information of the assertion rule of the return value, and whether the execution result meets the expected decision result is determined; whether the rules hit by the test cases conform to the expected rules or not can be determined by recording the information of the hit rules in the process of executing the strategy to be tested; by recording information of the decision group executed in the process of executing the strategy to be tested, the number of executing nodes in the process of executing the strategy to be tested can be determined.
The policy testing method described in the above embodiment may be applied to an automated testing scenario of a wind control policy. Fig. 3 is a schematic diagram of an automated testing architecture of a wind control policy according to an embodiment of the present application, and as shown in fig. 3, the architecture includes a use case configuration center, a use case library, a policy automated testing module, and a wind control system, which are coupled in sequence. The system comprises a case configuration center, a wind control system and a wind control system, wherein the case configuration center provides tester reference cases and case configuration information configuration templates, each reference case corresponds to a certain to-be-tested wind control strategy, and the reference cases comprise variables for executing the to-be-tested strategies; the case configuration information template can generate case configuration information by receiving the editing operation of a tester on the case configuration information template, including case variable value setting and case assertion rule setting. After the reference use case and the use case configuration information are configured, the use case configuration center stores the reference use case and the use case configuration information into the use case library. The strategy automation test module is used for providing test services, such as triggering test, making a test plan and analyzing a test report, reading reference cases and case configuration information from a case library, generating test cases and sending the test cases to the wind control system. The wind control system provides a case testing interface for executing a test case, returns an execution result to the strategy automation testing module, and forms a testing report through the strategy automation testing module.
With reference to the automated testing architecture of the wind control policy described in fig. 3, fig. 4 is a flowchart of automated testing of the wind control policy according to an embodiment of the present application, where the flowchart includes the following steps:
step S401, reads use case configuration information.
Step S402, loading a reference case.
Step S403, assigning use case variables. The method comprises the steps of replacing initial variable values by configuration variable values, transmitting the variable values to corresponding interfaces, and requesting to execute test cases. Such as using a Dubbo (remote procedure call service framework) to pass variable values in the current test case.
Step S404, executing the test case.
In step S405, the execution result is returned.
Step S406, verifying the case assertion rule.
Step S407, recording case test data.
Step S408, judging whether the use case configuration information of the next use case exists; returning to step S403 when it is determined that use case configuration information of the next use case exists; otherwise, step S409 is performed.
Step S409, a test report is generated.
The steps S401 to S403 and S406 to S409 may be executed in the wind control policy automation test module, and the steps S404 to S405 may be executed in the wind control system.
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here. For example, the order of step S401 and step S402 may be interchanged.
In the above steps, the wind control strategy automation test module triggers the wind control strategy automation test service, reads and loads the reference case and case configuration information of the strategy from the case library, reads case configuration information corresponding to a test case in sequence, and replaces the initial variable value in the reference case according to the configuration variable value of the case configuration information to assign the variable value required by the wind control strategy; requesting the wind control system to execute a test case of a wind control strategy, returning an execution result by the wind control system, and verifying the execution result according to an assertion rule set by the case configuration information; in the process, test data, including process data and result data, are recorded; and the wind control strategy automatic test module reads the case configuration information of the next case of the wind control strategy until all the case configuration information of the wind control strategy is read, and outputs a test report. The test report includes whether the test passes or not and the execution details of the test case.
Compared with the related art, the strategy testing method provided by the embodiment of the application at least comprises the following advantages:
(1) the reference use case and the use case configuration information configuration template are introduced, so that a tester only needs to care about the change of the variable value related to the use case and the influence on the final result of the strategy, the test efficiency is improved, and meanwhile, the probability of error in the definition of the use case is reduced.
(2) The configuration of the case configuration information replaces the test case script editing of the related technology, the technical threshold of the strategy automation test is reduced, the method is suitable for common testers and non-technical personnel, and the universal application value of the strategy test is high.
(3) The strategy testing method can be integrated in a strategy execution system to form an automatic testing process of the strategy, and the online time efficiency of the strategy is shortened.
The present embodiment further provides a policy testing apparatus, which is used to implement the foregoing embodiments and preferred embodiments, and the description of the policy testing apparatus is omitted here. As used hereinafter, the terms "module," "unit," "subunit," and the like may implement a combination of software and/or hardware for a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of a policy testing apparatus according to an embodiment of the present application, and as shown in fig. 5, the apparatus includes: a first obtaining module 51, a second obtaining module 52, a replacing module 53, and an executing module 54, wherein:
a first obtaining module 51, configured to obtain a reference case corresponding to a policy to be tested, where the reference case at least includes: executing a plurality of variables required by the strategy to be tested, the initial variable value of each variable and the expected execution result of the use case;
the second obtaining module 52 obtains use case configuration information, where the use case configuration information includes a configuration variable value of at least one of the variables and a use case expected execution result corresponding to the configuration variable value;
a replacing module 53, coupled to the first obtaining module 51 and the second obtaining module 52, configured to replace an initial variable value of at least one variable in the reference case and an expected execution result of the reference case with the case configuration information, so as to obtain a test case;
and the execution module 54 is coupled to the replacement module 53, and is configured to execute the test case, record test data generated by executing the test case, and generate a test report of the to-be-tested policy according to the test data.
In some embodiments, the test cases obtained by the replacing module 53 include: and the variables are variables of the interface test cases.
In some of these embodiments, the apparatus further comprises: the first generation module is used for generating a plurality of interface test cases according to the interfaces required to be called by the rules and the initial variable values; and generating a reference case according to the multiple interface test cases and the execution logic of the multiple rules.
In some of these embodiments, the apparatus further comprises: the second generation module is used for generating a use case configuration information configuration template according to a reference use case, wherein the use case configuration information configuration template comprises a configuration template used for configuring a plurality of variables and a configuration template used for configuring an expected execution result of the use case; the second obtaining module 52 includes a receiving submodule, configured to receive an editing operation of a user on the use case configuration information configuration template, so as to obtain use case configuration information.
In some of these embodiments, the execution module 54 includes: and the transmission submodule is used for transmitting the variable and the variable value thereof in the test case to the strategy platform and requesting the strategy platform to execute the strategy to be tested according to the variable and the variable value thereof in the test case, wherein the strategy platform calls a corresponding interface according to the variable and the variable value thereof in the test case in the process of executing the strategy to be tested.
In some embodiments, the test data recorded by execution module 54 includes at least one of: executing process data generated in the process of the strategy to be tested; and executing result data generated by the strategy to be tested.
In some embodiments, the process data recorded by the execution module 54 includes at least one of: executing the information of the interface called in the process of the strategy to be tested; checking result information of a return value of an interface called in the process of executing the strategy to be tested and/or an assertion rule of the return value; information of rules hit in the process of executing the strategy to be tested; information of the decision group executed in the process of executing the policy to be tested.
The above modules may be functional modules or program modules, and may be implemented by software or hardware. For a module implemented by hardware, the modules may be located in the same processor; or the modules can be respectively positioned in different processors in any combination.
In addition, the policy testing method of the embodiment of the present application described in conjunction with fig. 2 may be implemented by a computer device. Fig. 6 is a hardware structure diagram of a computer device according to an embodiment of the present application.
The computer device may comprise a processor 61 and a memory 62 in which computer program instructions are stored.
Specifically, the processor 61 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
The memory 62 may be used to store or cache various data files that need to be processed and/or used for communication, as well as possible computer program instructions executed by the processor 61.
The processor 61 implements any of the policy testing methods in the above embodiments by reading and executing computer program instructions stored in the memory 62.
In some of these embodiments, the computer device may also include a communication interface 63 and a bus 60. As shown in fig. 6, the processor 61, the memory 62, and the communication interface 63 are connected via a bus 60 to complete mutual communication.
The communication interface 63 is used for implementing communication between modules, devices, units and/or apparatuses in the embodiments of the present application. The communication interface 63 may also enable communication with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
In addition, in combination with the policy testing method in the foregoing embodiments, the embodiments of the present application may provide a computer-readable storage medium to implement. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the policy testing methods in the above embodiments.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A policy testing method, comprising:
acquiring a reference use case corresponding to a strategy to be tested, wherein the reference use case at least comprises: executing a plurality of variables required by the to-be-tested strategy, an initial variable value of each variable and an expected execution result of a use case;
acquiring use case configuration information, wherein the use case configuration information comprises a configuration variable value of at least one variable of the variables and a use case expected execution result corresponding to the configuration variable value;
replacing the initial variable value of the at least one variable in the reference use case and the expected execution result of the reference use case by using the use case configuration information to obtain a test use case;
and executing the test case, recording test data generated by executing the test case, and generating a test report of the strategy to be tested according to the test data.
2. The policy testing method according to claim 1, wherein the test case comprises: and the variables are variables of the interface test cases.
3. The policy testing method according to claim 2, wherein the policy to be tested comprises a plurality of rules and execution logic of the plurality of rules; before obtaining a reference use case corresponding to a policy to be tested, the method further includes:
generating the plurality of interface test cases according to the interfaces required to be called by the plurality of rules and the initial variable values;
and generating the reference case according to the plurality of interface test cases and the execution logic of the plurality of rules.
4. The policy testing method according to claim 1,
before obtaining a reference use case corresponding to a policy to be tested, the method further includes: generating a use case configuration information configuration template according to the reference use case, wherein the use case configuration information configuration template comprises a configuration template for configuring the plurality of variables and a configuration template for configuring an expected execution result of the use case;
acquiring the use case configuration information comprises: and receiving the editing operation of the user on the use case configuration information configuration template to obtain the use case configuration information.
5. The policy testing method according to claim 1, wherein executing the test case comprises:
and transmitting the variable and the variable value thereof in the test case to a strategy platform, and requesting the strategy platform to execute the strategy to be tested according to the variable and the variable value thereof in the test case, wherein the strategy platform calls a corresponding interface according to the variable and the variable value thereof in the test case in the process of executing the strategy to be tested.
6. The policy testing method according to claim 1, wherein said test data comprises at least one of:
executing process data generated in the process of the strategy to be tested;
and executing result data generated by the strategy to be tested.
7. The policy testing method according to claim 6, wherein said process data comprises at least one of:
executing the information of the interface called in the process of the strategy to be tested;
the return value of the interface called in the process of executing the to-be-tested strategy and/or the assertion rule check result information of the return value;
executing the information of the rules hit in the process of the strategy to be tested;
and executing the information of the decision group executed in the process of the strategy to be tested.
8. A policy testing apparatus, comprising:
the first obtaining module is configured to obtain a reference case corresponding to a policy to be tested, where the reference case at least includes: executing a plurality of variables required by the to-be-tested strategy, an initial variable value of each variable and an expected execution result of a use case;
the second obtaining module is used for obtaining use case configuration information, wherein the use case configuration information comprises a configuration variable value of at least one variable in the variables and a use case expected execution result corresponding to the configuration variable value;
the replacing module is used for replacing the initial variable value of the at least one variable in the reference use case and the expected execution result of the reference use case by using the use case configuration information to obtain a test use case;
and the execution module is used for executing the test case, recording test data generated by executing the test case and generating a test report of the strategy to be tested according to the test data.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the policy testing method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a policy testing method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010532657.8A CN111767210A (en) | 2020-06-12 | 2020-06-12 | Policy testing method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010532657.8A CN111767210A (en) | 2020-06-12 | 2020-06-12 | Policy testing method and device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111767210A true CN111767210A (en) | 2020-10-13 |
Family
ID=72719370
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010532657.8A Pending CN111767210A (en) | 2020-06-12 | 2020-06-12 | Policy testing method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111767210A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112540916A (en) * | 2020-11-30 | 2021-03-23 | 的卢技术有限公司 | Automatic rerun method and device for failed case, computer equipment and storage medium |
CN115114146A (en) * | 2022-06-02 | 2022-09-27 | 马上消费金融股份有限公司 | Interface test method, device, equipment and storage medium |
CN115620851A (en) * | 2022-12-19 | 2023-01-17 | 一临云(深圳)科技有限公司 | Data verification method and device, electronic equipment and readable storage medium |
-
2020
- 2020-06-12 CN CN202010532657.8A patent/CN111767210A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112540916A (en) * | 2020-11-30 | 2021-03-23 | 的卢技术有限公司 | Automatic rerun method and device for failed case, computer equipment and storage medium |
CN115114146A (en) * | 2022-06-02 | 2022-09-27 | 马上消费金融股份有限公司 | Interface test method, device, equipment and storage medium |
CN115620851A (en) * | 2022-12-19 | 2023-01-17 | 一临云(深圳)科技有限公司 | Data verification method and device, electronic equipment and readable storage medium |
CN115620851B (en) * | 2022-12-19 | 2023-03-31 | 一临云(深圳)科技有限公司 | Data verification method and device, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8918678B2 (en) | Functional testing of a processor design | |
CN111965530A (en) | JTAG-based FPGA chip automatic test method | |
CN111767210A (en) | Policy testing method and device, computer equipment and storage medium | |
CN110287104A (en) | Method for generating test case, device, terminal and computer readable storage medium | |
CN110275818A (en) | Method of generating test program, device and storage medium | |
CN113342669B (en) | Verification method and device for shortening convergence time of chip code coverage rate | |
CN115809203B (en) | Dynamic nesting method and device for software test cases and application of dynamic nesting method and device | |
CN114429103A (en) | Chip verification method and device, electronic equipment and storage medium | |
CN110362469A (en) | Based on modular testing use-case control method, device, terminal and storage medium | |
CN114398848A (en) | Test vector generation method and device and storage medium | |
CN116069635A (en) | SOC system testing method and device, computer equipment and storage medium | |
Noorian et al. | Non-functional properties in software product lines: A taxonomy for classification. | |
CN114417563A (en) | Multi-core mechanism simulation method and device and electronic equipment | |
CN112731117A (en) | Automatic verification method and system for chip, and storage medium | |
CN110473585B (en) | Replacement method, device and equipment for erasing failed storage unit and storage medium | |
CN116431522A (en) | Automatic test method and system for low-code object storage gateway | |
CN115657981A (en) | Method for setting print level of print information in authentication environment and authentication method | |
CN115176233B (en) | Performing tests in deterministic order | |
CN112463633B (en) | Method, device, equipment and medium for checking address decoding of on-chip memory | |
CN114546749A (en) | Chip random test case regression method, device, equipment and readable medium | |
CN110795338B (en) | Front-end and back-end interaction-based automatic testing method and device and electronic equipment | |
CN115757123B (en) | Test case generation method, device, equipment and medium | |
CN116662210B (en) | Interface regression testing method, device and application | |
US10060976B1 (en) | Method and apparatus for automatic diagnosis of mis-compares | |
CN109800155B (en) | Method and device for testing QTE interlocking application software based on Probe |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |