Method and device for generating reverse case based on data quality rule

By formatting and uniformly processing data quality rules, and generating test countercases and scripts, the problem of time-consuming and labor-consuming writing of countercases in assembly tests is solved, and efficient and full-coverage test results are achieved.

CN118964192APending Publication Date: 2024-11-15中国邮政储蓄银行股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411034238.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

During the assembly and testing process, due to too many data quality rules, there are too many counter-cases that need to be covered. Manually writing counter-cases by testers consumes a lot of manpower and time, and it is difficult to achieve full coverage. There are omissions and human interference factors. This results in high testing costs and low efficiency.

Method used

By uniformly formatting multiple initial data quality rules, a machine-identified target data quality rules are generated, and a test countercase and countercase test script is generated based on the test case and target data quality rules, supporting characters, arrays, and key values Write rules and custom functions to the format, generate a total countercase table, including test countercases and result items.

Benefits of technology

Reduces human interference in assembly tests, improves testing efficiency, saves test costs, achieves full coverage of countercases of data quality rules, supports flexible writing rules and custom functions, and solves the human interference factors in the existing technology. Large, high cost and low efficiency problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964192A_ABST
    Figure CN118964192A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for generating a reverse case based on a data quality rule, and the method comprises the steps: carrying out the unified formatting of a plurality of initial data quality rules, obtaining a corresponding preparatory data quality rule, integrating the data quality rules, obtaining a target data quality rule, and storing the target data quality rule in a database; the format of the target data quality rule is a machine recognizable format, and the target data quality rule is a data rule for evaluating data correctness; a positive test case is obtained, fields in the positive test case are scanned, negative test cases and corresponding negative case test scripts are generated according to the positive test case and the target data quality rule, one positive test case corresponds to multiple negative test cases, and the negative case test scripts are execution scripts of the corresponding negative test cases; and generating a total inverse case table according to the test inverse cases, wherein the total inverse case table comprises all the test inverse cases and test result items. The method can reduce man-made interference in the assembly test, improve the test efficiency and save the test cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer data quality, and in particular, to a method for generating a counter-case based on data quality rules, a device for generating a counter-case based on data quality rules, a computer-readable storage medium, and an electronic device. Background Art

[0002] During the assembly test process, many necessary and similar test counter-cases need to be verified for the input items. Manually writing these cases will generate a huge workload and consume a lot of time.

[0003] In the assembly test phase, due to the need for data quality control, testers need to write all counter-cases that fully cover the data quality rules based on the data quality rules to ensure the correctness and comprehensiveness of the code.

[0004] In actual testing work, due to too many data quality rules, there are too many counter-cases that need to be covered. Writing cases one by one according to the data quality rules will consume a lot of manpower and time costs, and there will inevitably be omissions. Testers often selectively write counter-cases based on experience and actual conditions, which makes it difficult to achieve full coverage, creates hidden dangers, and may cause problem codes to be omitted. Summary of the invention

[0005] The main purpose of the present application is to provide a method for generating counter-cases based on data quality rules, a device for generating counter-cases based on data quality rules, a computer-readable storage medium and an electronic device, so as to at least solve the problem in the prior art that the method of writing counter-cases by testers has large human interference factors, low testing cost and low testing efficiency.

[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for generating counter-cases based on data quality rules is provided, including uniformly formatting multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrating all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules for evaluating data correctness; obtaining a test positive case, and scanning the fields in the test positive case to generate a test counter-case and a corresponding counter-case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to multiple test counter-cases, and the counter-case test script is an execution script of the corresponding test counter-case; generating a total counter-case table according to all the test counter-cases, and the total counter-case table includes all the test counter-cases and test result items.

[0007] Optionally, the fields in the test positive case are scanned to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, including: scanning the input item fields of the test positive case, searching the target data quality rules according to each of the input item fields, and determining whether there is a test rule corresponding to the input item field in the target data quality rule; if there is a test rule corresponding to the input item field in the target data quality rule, determining the input item field as a field to be replaced, and replacing the field to be replaced according to the test rule corresponding to the field to be replaced, so as to obtain the test negative case corresponding to the test positive case.

[0008] Optionally, according to the test rule corresponding to the field to be replaced, the field to be replaced is replaced to obtain the test negative case corresponding to the test positive case, including: determining that the target data quality rule includes a character length rule and a character format rule, the character length rule is used to constrain the character length of the field, and the character format rule is used to constrain the format of each character in the field; according to the character length rule and the character format rule, a character in the field to be replaced is replaced with a character length and / or a character format replacement to obtain the test negative case corresponding to the test positive case.

[0009] Optionally, according to the test rule corresponding to the field to be replaced, the field to be replaced is replaced to obtain the test negative case corresponding to the test positive case, including: determining that the target data quality rule includes an array format rule, and the array format rule is used to constrain the overall character format of the array field; according to the array format rule, the character format of the entire field to be replaced is replaced to obtain the test negative case corresponding to the test positive case.

[0010] Optionally, according to the test rule corresponding to the field to be replaced, the field to be replaced is replaced to obtain the test negative case corresponding to the test positive case, including: determining that the target data quality rule includes a key-value pair association rule, and the key-value pair association rule is used to constrain the format of two interrelated fields; determining a first field and a second field, the first field and the second field are two interrelated fields to be replaced; according to the key-value pair association rule, performing character replacement on one of the first field and the second field to obtain the test negative case corresponding to the test positive case.

[0011] Optionally, the target data quality rules are Excel documents, and the target data quality rules include at least: Chinese name of the field, English name of the field, field usage scenario, test method, test data, data format rules, business-related information, and obtaining a positive test case, including: determining multiple test requirements, where the test requirements are test requirements for predefined fields; determining one or more positive test cases based on all the test requirements, wherein, when there is only one positive test case, the positive test case satisfies all the test requirements, and when there are multiple positive test cases, all of the positive test cases satisfy all the test requirements.

[0012] Optionally, after generating a total counter-case table based on all the test counter-cases, the method further includes: executing each of the counter-case test scripts in sequence to obtain corresponding test results, and aggregating each of the test results into the total counter-case table based on the correspondence between the counter-case test scripts and the test results.

[0013] According to another aspect of the present application, a device for generating counter-cases based on data quality rules is provided, comprising: a first processing unit, used to uniformly format multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrate all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules for evaluating data correctness; a second processing unit, used to obtain a test positive case, and scan the fields in the test positive case to generate a test counter-case and a corresponding counter-case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to multiple test counter-cases, and the counter-case test script is an execution script of the corresponding test counter-case; a third processing unit, used to generate a total counter-case table according to all the test counter-cases, wherein the total counter-case table includes all the test counter-cases and test result items.

[0014] According to another aspect of the present application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods for generating counter-cases based on data quality rules.

[0015] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing any one of the new energy multi-station flexible direct current transmission system strength assessment methods.

[0016] Apply the technical solution of the present application, the generation method of the counter-case based on the data quality rule, firstly, a plurality of initial data quality rules are uniformly formatted to obtain the corresponding preliminary data quality rules, and all the preliminary data quality rules are integrated to obtain the target data quality rules, the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules for evaluating the correctness of data; then obtain the test positive case, and scan the fields in the test positive case to generate the test counter-case and the corresponding counter-case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to multiple test counter-cases, and the counter-case test script is the execution script of the corresponding test counter-case; finally, a total counter-case table is generated according to all the test counter-cases, and the total counter-case table includes all the test counter-cases and test result items. The method reduces the human interference in the assembly test, improves the test efficiency, saves the test cost, supports the writing rules in the format of characters, arrays, and key-value pairs, supports custom functions, has comprehensive coverage, is flexible to write, and solves the problem that the human interference factor of the method of writing counter-cases by testers in the prior art is large, and the test cost is low and the test efficiency is low. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 A hardware structure block diagram of a mobile terminal for executing a method for generating counter-cases based on data quality rules provided in an embodiment of the present application is shown;

[0019] Figure 2 A schematic flow chart of a method for generating a counter-case based on data quality rules according to an embodiment of the present application is shown;

[0020] Figure 3 A schematic diagram of a data quality rule schematic table provided according to an embodiment of the present application is shown;

[0021] Figure 4 A schematic diagram of a test data schematic table provided according to an embodiment of the present application is shown;

[0022] Figure 5 A structural block diagram of a device for generating a counter-case based on data quality rules according to an embodiment of the present application is shown;

[0023] Figure 6 A component relationship diagram of a method for generating a counter-case based on data quality rules provided according to an embodiment of the present application is shown;

[0024] Figure 7 A schematic flow chart of another method for generating a counter-case based on data quality rules according to an embodiment of the present application is shown;

[0025] Figure 8 A structural block diagram of another device for generating counter-cases based on data quality rules provided according to an embodiment of the present application is shown.

[0026] The above drawings include the following reference numerals:

[0027] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION

[0028] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0029] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0032] Data quality rules: Constraints on data to ensure data availability. The data quality of this application is mainly aimed at constraints on interface input items.

[0033] Positive case: refers to a test case in which the system functions normally, that is, a case in which no abnormalities occur.

[0034] Countercase: A countercase is a case that causes abnormal situations in the program, relative to the positive case.

[0035] As introduced in the background technology, in the prior art, many necessary and similar test counter-cases need to be verified for the input items in the assembly test process. Manually writing these cases will generate a huge workload and consume a lot of time. In order to solve the problem that the method of writing counter-cases by testers in the prior art has a large human interference factor, low testing cost and low testing efficiency, the embodiments of the present application provide a method for generating counter-cases based on data quality rules, a device for generating counter-cases based on data quality rules, a computer-readable storage medium and an electronic device.

[0036] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0037] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 1 is a hardware structure block diagram of a mobile terminal of a method for generating a counter-case based on data quality rules according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0038] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for generating counter-cases based on data quality rules in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0039] In this embodiment, a method for generating counter-cases based on data quality rules that runs on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0040] Figure 2 is a flow chart of a method for generating a counter-case based on data quality rules according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0041] Step S201, uniformly format multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrate all the above preliminary data quality rules to obtain target data quality rules. The format of the above target data quality rules is a machine-recognizable format, and the above target data quality rules are data rules used to evaluate data correctness.

[0042] Specifically, the target data quality rules are documents that explain the correctness of data based on documents such as data dictionaries. Different data quality rules are set according to different test points that need to be tested. Generally, the target data quality rules include the test rules required for all test points.

[0043] In some instances, the specific implementation of step S201 includes: converting the original data quality rules into a formatted Excel document that can be recognized by the machine. The Excel document may include necessary customized information such as the Chinese name of the field, the English name, the scenario, the test method, the test data, the data quality rules, and other personalized information related to the business. These contents can be used for field identification, scenario description, data filling, etc. in step S202.

[0044] Step S202, obtain the test positive case, and scan the fields in the test positive case to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rules, wherein one test positive case corresponds to multiple test negative cases, and the negative case test script is an execution script of the corresponding test negative case.

[0045] Specifically, negative cases are generated in batches by replacing fields in positive cases under the constraints of data quality rules; negative cases that meet the requirements of data quality rule control are generated based on existing positive cases, reducing repetitive work and saving time and labor costs.

[0046] The generation of counter-case test scripts according to data quality rules includes: scanning the test cases, generating corresponding counter-case test scripts one by one according to the data quality rules, and generating an Excel table summarizing counter-cases with missing results.

[0047] The target data quality rules are in the form of an Excel document, which at least includes: the Chinese name of the field, the English name of the field, the field usage scenario, the test method, the test data, the data format rules, and business-related information. The test positive cases are obtained, including:

[0048] Step S2021, determining a plurality of test requirements, where the test requirements are test requirements of predefined fields;

[0049] Step S2022, determining one or more positive test cases according to all the test requirements, wherein, when there is only one positive test case, the positive test case satisfies all the test requirements, and when there are multiple positive test cases, all the positive test cases satisfy all the test requirements.

[0050] Specifically, this can cover all test requirements to perform effective testing. Generally, a test case includes all test requirements.

[0051] The fields in the test positive case are scanned to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, including:

[0052] Step S301, scanning the input item fields of the above test positive cases, searching the above target data quality rules according to the above input item fields, and determining whether there is a test rule corresponding to the above input item fields in the above target data quality rules;

[0053] Step S302, when there is a test rule corresponding to the above-mentioned input item field in the above-mentioned target data quality rule, the above-mentioned input item field is determined as a field to be replaced, and the above-mentioned field to be replaced is replaced according to the above-mentioned test rule corresponding to the above-mentioned field to be replaced, so as to obtain the above-mentioned test negative case corresponding to the above-mentioned test positive case.

[0054] Specifically, cases are generated based on data quality rules. The replacement method supports writing rules in three formats: character, array, and key-value pairs. Custom functions can be used to achieve flexible writing and comprehensive coverage. There is no limit on programming languages, including Java, Python, etc. Programming languages ​​are just tools. There is no limit on testing tools, including Postman, Jmeter, etc. The test scripts generated by different testing tools are different. You can choose according to your own needs and tool features. The data quality case documents (Excel version) they generate are the same.

[0055] In some instances, multiple replacements can be made for different test aspects of a positive case, that is, multiple different counter-cases can be generated for a positive case. The number of counter-cases is determined according to the test requirements and can range from 10, 20, to 100.

[0056] In some instances, the specific steps of generating counter-case test scripts based on data quality rules include:

[0057] Step S1, parsing files and locating cases: scanning all test case files under data quality rules, and filtering out the test positive cases that need to generate test negative cases in each file;

[0058] Step S2: Scan the case and filter replaceable fields: Scan the input part of the case and search for data quality rules based on each input field. If the field has a corresponding rule in the data quality rule, it means that a test counter-case can be generated based on the rule.

[0059] Step S3: Replace fields and generate test counter-cases: Use the original test case as a template, fill the test case and script content according to the test method and test data of the data quality rule, and generate cases and scripts. The replacement method supports three types: character, array, and key-value pair, and supports custom functions, so that cases can be flexibly generated according to the rules.

[0060] Among them, according to the above test rule corresponding to the above field to be replaced, the above field to be replaced is replaced to obtain the above test negative case corresponding to the above test positive case, including:

[0061] Step S401, determining that the target data quality rule includes a character length rule and a character format rule, wherein the character length rule is used to constrain the character length of a field, and the character format rule is used to constrain the format of each character in the field;

[0062] Step S402, according to the above character length rule and the above character format rule, character length replacement and / or character format replacement are performed on a certain character in the above field to be replaced, so as to obtain the above test negative case corresponding to the above test positive case.

[0063] Specifically, the replacement method can be used to replace a certain character in a field, with comprehensive coverage and flexible writing.

[0064] In some instances, a data quality rule requires a field to consist of 12 characters of a fixed length, with the first character being a letter and the rest being numbers. The replacement method can be defined as CHAR, i.e., characters, and the replacement data is {"0":["1","2"],"1":["A"]}, where commas represent separation. The first character of a field is replaced with 1, and the rest of the characters remain unchanged to generate the first test counter-case, the first character is replaced with 2, and the rest of the characters remain unchanged to generate the second test counter-case, and the second character of a field is replaced with A, and the rest of the characters remain unchanged to generate the third test counter-case. The first test counter-case and the second test counter-case do not meet the requirement that the first character is a letter in the rule, and the third test counter-case does not meet the requirement that the rest of the characters are numbers in the rule. The specific replacement data is pre-defined.

[0065] Among them, according to the above test rule corresponding to the above field to be replaced, the above field to be replaced is replaced to obtain the above test negative case corresponding to the above test positive case, including:

[0066] Step S501, determining that the target data quality rule includes an array format rule, where the array format rule is used to constrain the format of the entire character of an array field;

[0067] Step S502: According to the array format rule, character format replacement is performed on the entire field to be replaced to obtain the test negative case corresponding to the test positive case.

[0068] Specifically, the replacement method can be used to replace the entire field, with comprehensive coverage and flexible writing.

[0069] In some instances, a field is of numeric type, and a data quality rule requires that the field must be of integer type. You can define the replacement method as ARRAY, that is, array, and the replacement data as [0.1,2.5]. This will replace a field with 0.1 to generate the first test counter-case, and replace a field with 2.5 to generate the second test counter-case.

[0070] In some instances, a field is a date field, and a data quality rule requires that the field must be a valid date. You can define the replacement method as ARRAY, and the replacement data as ["20231301","20230230","20230630","20230732"]. Then, a field is replaced with 20231301 to generate the first test counter-case, a field is replaced with 20230230 to generate the second test counter-case, a field is replaced with 20230630 to generate the third test counter-case, and a field is replaced with 20230732 to generate the fourth test counter-case.

[0071] Among them, according to the above test rule corresponding to the above field to be replaced, the above field to be replaced is replaced to obtain the above test negative case corresponding to the above test positive case, including:

[0072] Step S601, determining that the target data quality rule includes a key-value pair association rule, where the key-value pair association rule is used to constrain the format of two mutually related fields;

[0073] Step S602, determining a first field and a second field, wherein the first field and the second field are two mutually related fields to be replaced;

[0074] Step S603: According to the key-value pair association rule, characters of one of the first field and the second field are replaced to obtain the test negative case corresponding to the test positive case.

[0075] Specifically, the replacement method can be used to replace a field when it is associated with other fields, with comprehensive coverage and flexible writing.

[0076] In some instances, a field is a personal ID type code, and a data quality rule requires that the personal ID type code should be consistent with the nationality code. For example, if the nationality code is the first nationality, the personal ID type code cannot be the second nationality ID type code, the third nationality ID type code, the fourth nationality ID type code, etc. The replacement method can be defined as MAP, that is, a key-value pair, and the replacement data is {"first nationality code":["second nationality ID type","third nationality ID type"],"fourth nationality code":["first nationality ID type","second nationality ID type"]}, where if the nationality code is the first nationality code, the personal ID type code field is replaced with "second nationality ID type" to generate the first test counter-case, and the personal ID type code field is replaced with "third nationality ID type" to generate the second test counter-case. If the nationality code is the fourth nationality code, the personal ID type code field is replaced with "first nationality ID type" to generate the third test counter-case, and the personal ID type code field is replaced with "second nationality ID type" to generate the fourth test counter-case.

[0077] In addition, custom functions are supported in the three replacement methods, so that counter-cases can be generated more flexibly.

[0078] In some instances, a field is a date field, and a data quality rule requires the date format to be 8 digits, YYYYMMDD. The replacement method can be defined as ARRAY, and the replacement data is ["FUNC:ChangeDateTimeFormat('YYYYMMDD','YYYY-MM-DD')","FUNC:ChangeDate TimeFormat('YYYYMMDD','YYYY / MM / DD')"]. ChangeDateTimeFormat() is a custom function that converts the date from the old format to the new format. If the field value is 20230101, the field will be replaced with 2023-01-01 to generate the first test counter-case, and the field will be replaced with 2023 / 01 / 01 to generate the second test counter-case.

[0079] In some instances, a data quality rule requires that the length of the field be 8 bits. The replacement method can be defined as ARRAY, that is, an array, and the replacement data is ["FUNC::ChangeStringLength(1)","FUNC::ChangeStringLength(-1)"]. ChangeStringLength() is a custom function that reduces or increases the length of the field by a few bits. If the field value is 12345678, the field will be replaced with 123456788 to generate the first test countercase, and the field will be replaced with 1234567 to generate the second test countercase.

[0080] In some instances, a data quality rule requires that when the document type is "first nationality document type", the first digit of the personal document number must be "H" or "M". The replacement method can be defined as MAP, and the replacement data is {"first nationality document type": ["FUNC::CertNonMainLandFirstDigit"]}, CertNonMainLandFirstDigit() is a custom function that replaces the first digit of the field with A. If the document type is the first nationality document type, the first digit of the personal document number field will be replaced with A to generate the first test countercase.

[0081] Step S203: Generate a total counter-case table according to all the above test counter-cases, wherein the total counter-case table includes all the above test counter-cases and test result items.

[0082] Specifically, based on the existing positive cases, negative cases that meet the requirements of data quality rule control are generated to reduce repetitive work, save time and labor costs; the quality rule table is configured according to actual needs, supports writing rules in character, array, and key-value pair formats, supports custom functions, and has comprehensive coverage and flexible writing. There is no limit on programming languages, Java, Python, etc. are all acceptable, and programming languages ​​are just tools. There is no limit on testing tools, Postman, Jmeter, etc. are all acceptable. The test scripts generated by different testing tools are different, and you can choose according to your own needs and tool features. The data quality case documents (Excel version) they generate are the same.

[0083] Among them, after generating a total counter-case table based on all the above-mentioned test counter-cases, the above-mentioned method also includes: executing each of the above-mentioned counter-case test scripts in sequence to obtain corresponding test results, and summarizing each of the above-mentioned test results into the above-mentioned total counter-case table according to the correspondence between the above-mentioned counter-case test scripts and the above-mentioned test results.

[0084] Specifically, the data quality rules are converted into a formatted document that can be recognized by the code, and then combined with the input items of the positive case to generate the corresponding executable script (counter-case) and counter-case list. Executing these scripts can obtain a full range of test results, thereby achieving full coverage of counter-cases for data quality rules and saving manpower and time costs.

[0085] The above-mentioned method for generating counter-cases based on data quality rules of the present application, firstly, uniformly format multiple initial data quality rules, obtain corresponding preliminary data quality rules, and integrate all preliminary data quality rules to obtain target data quality rules, the format of target data quality rules is a machine-recognizable format, and the target data quality rules are data rules for evaluating data correctness; then obtain the test positive case, and scan the fields in the test positive case, so as to generate a test counter-case and a corresponding counter-case test script according to the test positive case and the target data quality rule, wherein a test positive case corresponds to multiple test counter-cases, and the counter-case test script is the execution script of the corresponding test counter-case; finally, a total counter-case table is generated according to all the test counter-cases, and the total counter-case table includes all the test counter-cases and test result items. The method reduces human interference in assembly testing, improves test efficiency, saves test costs, supports writing rules in character, array, key-value pair formats, supports custom functions, has comprehensive coverage, and is flexible to write, and solves the problem that the method of writing counter-cases by testers in the prior art has large human interference factors, and the test cost is low and the test efficiency is low.

[0086] Example

[0087] Taking Jmeter as a test tool based on the Java programming language as an example, the method steps for automatically generating test counter-cases based on data quality rules and positive cases are as follows:

[0088] 1) Convert data quality rules into a formatted Excel document, such as Figure 3 As shown, there are 7 rules for 6 fields to be tested. From the test data in column F, we can see that the 7 rules will generate a total of 23 cases.

[0089] 2) The original test data is as follows Figure 4 As shown, since it is defined in advance that the case marked as "AT" will generate a data quality counter-case, the program will generate a counter-case based on the input of 001, and cases 002 and 003 will not participate. In case 001, field 7 to be tested has no corresponding data quality rule, so a counter-case will not be generated based on it;

[0090] Provide a positive case that differs from the other data quality counter-cases generated subsequently by only one field;

[0091] 3) Generate a test script containing 23 counter-cases based on the positive case, among which, 001-1 is a counter-case generated for the field 1 (field1) to be tested. According to the data quality rule, the value of the field1 field is replaced with the data in the data quality rule table to generate a counter-case; 001-2 is a second counter-case generated for the field 1 (field1) to be tested. According to the data quality rule, the value of the field1 field is replaced with the data in the data quality rule table to generate a counter-case; 001-6 is a second counter-case generated for the field 6 (field6) to be tested. According to the data quality rule, the value of the field6 field is increased by one digit to generate a counter-case, thereby testing the transaction control when filed6 is 9 digits (should be 8 digits); 001-7 is a second counter-case generated for the field 7 (field7) to be tested. According to the data quality rule, the value of the field7 field is reduced by one digit to generate a counter-case, thereby testing the transaction control when filed7 is 7 digits (should be 8 digits);

[0092] 4) Generate a case summary. When generating the test script, an Excel list of test cases will be generated to store the script test results and final archiving.

[0093] In some examples, the above method is based on the automatic generation of test counter-case systems based on data quality rules combined with positive cases, such as Figure 5 As shown, the above system includes a data quality rule conversion module, a case generation module, and a script execution module.

[0094] Among them, the rule conversion module is used to convert the original data quality rules into a formatted Excel document that can be recognized by the machine. The document includes the necessary customized content such as the Chinese name of the field, the English name, the scenario, the test method, the test data, and the data quality rules. The case generation module is used to use programming languages ​​(such as Java, Python, etc.) to scan the fields in the test data (positive case) and generate all data quality counter-case Excel and counter-case test scripts one by one according to the data quality rules. The quality detection module is used to use testing tools (such as Postman, Jmeter, etc.) or the company's automated testing platform to execute the counter-case test script, and summarize the test results in the data quality counter-case Excel to draw a detection conclusion.

[0095] In some instances, such as Figure 6 As shown, the components involved in this method include: test cases, data quality rules, programming languages, test script templates, test case scripts, test tools / automation platforms, databases, data quality counter-cases, test result sets, and case summary tables. The explanations of each component are as follows:

[0096] Test case: an original positive case used to scan and generate data quality counter-cases in combination with data quality rules. It can be marked to indicate which cases need to generate corresponding counter-cases, and the remaining cases are not processed.

[0097] Data quality rules: documents that explain the correctness of data based on documents such as data dictionaries.

[0098] Programming language: a language that can be recognized by the machine. In this application, it is mainly used to operate Excel documents and generate test scripts. It can be Java, Python, etc.

[0099] Test script template: a pre-written test script template for generating a test script. The generated counter-case test script is filled in based on the test script template.

[0100] Test case script: executable data quality case. After connecting to the database and starting the application server, execute the file to get the test results. It mainly includes request message, database connection address, assertion and other information.

[0101] Test tools / automation platforms: Test tools, such as Postman and Jmeter, are tools that can execute test scripts. Test tools and test scripts need to correspond, such as Jmeter corresponding to Jmeter test scripts. Automation platforms, like test tools, can be used to execute test scripts. The difference is that they can execute test scripts in batches and generate original test results.

[0102] Database: used to read and write data.

[0103] Data quality counter-cases: The set of cases generated by data quality rules.

[0104] Test result set: The result obtained by executing the test script. If the result is consistent with the expectation, it means that the control of the rule has been achieved. If it is inconsistent, it means that the control is not actually achieved. In this case, it is necessary to record and investigate the specific reasons why the code is not controlled.

[0105] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the method for generating counter-cases based on data quality rules of the present application will be described in detail below in combination with specific embodiments.

[0106] This embodiment relates to a specific method for generating counter-cases based on data quality rules, such as Figure 7 As shown, the following steps are included:

[0107] Step 1: Format data quality rules;

[0108] Step 2: Generate counter-case test scripts based on data quality rules;

[0109] Step 3: Execute the counter-case test script;

[0110] Step 4: Analyze the result file.

[0111] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0112] The present application embodiment also provides a kind of generation device of the counter-case based on data quality rule, it should be noted that the generation device of the counter-case based on data quality rule of the present application embodiment can be used to execute the generation method for the counter-case based on data quality rule provided by the present application embodiment. The device is used to implement the above-mentioned embodiment and preferred implementation mode, and the description has been made no more. As used below, the term "module" can realize the combination of software and / or hardware of predetermined function. Although the device described in the following embodiments is preferably realized by software, the realization of hardware, or the combination of software and hardware is also possible and conceived.

[0113] The following introduces a device for generating counter-cases based on data quality rules provided in an embodiment of the present application.

[0114] Figure 8 is a schematic diagram of a device for generating counter-cases based on data quality rules according to an embodiment of the present application. Figure 8 As shown, the device includes: a first processing unit 10, a second processing unit 20 and a third processing unit 30, the first processing unit 10 is used to uniformly format multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrate all the above preliminary data quality rules to obtain target data quality rules, the format of the above target data quality rules is a machine-recognizable format, and the above target data quality rules are data rules for evaluating data correctness; the second processing unit 20 is used to obtain a test positive case, and scan the fields in the test positive case to generate a test negative case and a corresponding negative case test script according to the above test positive case and the above target data quality rule, wherein one of the above test positive cases corresponds to multiple of the above test negative cases, and the above negative case test script is an execution script of the corresponding test negative case; the third processing unit 30 is used to generate a total negative case table according to all of the above test negative cases, and the above total negative case table includes all of the above test negative cases and test result items.

[0115] The above-mentioned data quality rule-based counter-case generation device of the present application includes: a first processing unit, a second processing unit and a third processing unit, the first processing unit is used to uniformly format multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrate all preliminary data quality rules to obtain target data quality rules, the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules for evaluating data correctness; the second processing unit is used to obtain a test positive case and scan the fields in the test positive case to generate a test counter-case and a corresponding counter-case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to multiple test counter-cases, and the counter-case test script is an execution script of the corresponding test counter-case; the third processing unit is used to generate a total counter-case table according to all the test counter-cases, and the total counter-case table includes all the test counter-cases and test result items. The device reduces human interference in assembly testing, improves testing efficiency, saves testing costs, supports writing rules in character, array, and key-value pair formats, supports custom functions, has comprehensive coverage, and is flexible to write. It solves the problem in the prior art that the method of writing counter-cases by testers has large human interference factors, low testing costs, and low testing efficiency.

[0116] In some instances, the second processing unit includes a first determination module and a first processing module, the first determination module is used to scan the input item fields of the above-mentioned test positive case, search the above-mentioned target data quality rules according to each of the above-mentioned input item fields, and determine whether there are test rules corresponding to the above-mentioned input item fields in the above-mentioned target data quality rules; the first processing module is used to determine the above-mentioned input item fields as fields to be replaced when there are test rules corresponding to the above-mentioned input item fields in the above-mentioned target data quality rules, and replace the above-mentioned fields to be replaced according to the above-mentioned test rules corresponding to the above-mentioned fields to be replaced, so as to obtain the above-mentioned test negative cases corresponding to the above-mentioned test positive cases. Cases are generated based on data quality rules, and the replacement method supports writing rules in three formats: characters, arrays, and key-value pairs. At the same time, functions can be customized, so as to achieve flexible writing and comprehensive coverage.

[0117] In some instances, the first processing module includes a second determination module and a second processing module, the second determination module is used to determine that the target data quality rules include character length rules and character format rules, the character length rules are used to constrain the character length of the field, and the character format rules are used to constrain the format of each character in the field; the second processing module is used to perform character length replacement and / or character format replacement on a certain character in the field to be replaced according to the character length rules and the character format rules, and obtain the test negative case corresponding to the test positive case. The replacement method can be used to replace a certain character in the field, with comprehensive coverage and flexible writing.

[0118] In some examples, the first processing module includes a third determination module and a third processing module, the third determination module is used to determine that the target data quality rule includes an array format rule, the array format rule is used to constrain the format of the overall character of the array field; the third processing module is used to replace the character format of the entire field to be replaced according to the array format rule, and obtain the test negative case corresponding to the test positive case. The replacement method can be used for the overall replacement of the field, with comprehensive coverage and flexible writing.

[0119] In some instances, the first processing module includes a fourth determination module, a fifth determination module and a fourth processing module, the fourth determination module is used to determine that the target data quality rule includes a key-value pair association rule, the key-value pair association rule is used to constrain the format of two interrelated fields; the fifth determination module is used to determine the first field and the second field, the first field and the second field are two interrelated fields to be replaced; the fourth processing module is used to replace characters in one of the first field and the second field according to the key-value pair association rule, and obtain the test negative case corresponding to the test positive case. The replacement method can be used for replacement when a field is associated with other fields, with comprehensive coverage and flexible writing.

[0120] In some instances, the target data quality rules are Excel documents, and the target data quality rules include at least: Chinese name of the field, English name of the field, field usage scenario, test method, test data, data format rules, and business-related information. The second processing unit also includes a fifth determination module and a sixth determination module. The fifth determination module is used to determine multiple test requirements, and the test requirements are test requirements for predefined fields; the sixth determination module is used to determine one or more of the above test positive cases according to all the above test requirements, wherein, when there is one test positive case, the test positive case meets all the above test requirements, and when there are multiple test positive cases, all of the above test positive cases meet all the above test requirements. In this way, all test requirements can be covered for effective testing.

[0121] In some examples, the device further includes a first summary module, which is used to generate a total counter-case table based on all the test counter-cases, execute each of the counter-case test scripts in turn, obtain corresponding test results, and summarize each of the test results into the total counter-case table based on the correspondence between the counter-case test scripts and the test results. The data quality rules are converted into a formatted document that can be recognized by the code, and then the corresponding executable scripts (counter-cases) and counter-case lists are generated in combination with the input items of the positive case. The execution of these scripts can obtain a full amount of test results, thereby achieving the effect of full coverage of counter-cases of the data quality rules, saving manpower and time costs.

[0122] The device for generating counter-cases based on data quality rules comprises a processor and a memory, wherein the processing units and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.

[0123] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to solve the problem that the method of writing counter-cases by testers in the prior art has large human interference factors, low test cost and low test efficiency.

[0124] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0125] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for generating counter-cases based on data quality rules.

[0126] Specifically, the method for generating counter-cases based on data quality rules includes:

[0127] Step S201, uniformly formatting multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrating all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules used to evaluate data correctness;

[0128] Specifically, the target data quality rules are documents that explain the correctness of data based on documents such as data dictionaries. Different data quality rules are set according to different test points that need to be tested. Generally, the target data quality rules include the test rules required for all test points.

[0129] Step S202, obtaining a test positive case, and scanning the fields in the test positive case, so as to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to a plurality of test negative cases, and the negative case test script is an execution script of the corresponding test negative case;

[0130] Specifically, negative cases are generated in batches by replacing fields in positive cases under the constraints of data quality rules; negative cases that meet the requirements of data quality rule control are generated based on existing positive cases, reducing repetitive work and saving time and labor costs.

[0131] Step S203: Generate a total counter-case table according to all the above test counter-cases, wherein the total counter-case table includes all the above test counter-cases and test result items.

[0132] Specifically, based on the existing positive cases, negative cases that meet the requirements of data quality rule control are generated to reduce repetitive work, save time and labor costs; the quality rule table is configured according to actual needs, supports writing rules in character, array, and key-value pair formats, supports custom functions, and has comprehensive coverage and flexible writing. There is no limit on programming languages, Java, Python, etc. are all acceptable, and programming languages ​​are just tools. There is no limit on testing tools, Postman, Jmeter, etc. are all acceptable. The test scripts generated by different testing tools are different, and you can choose according to your own needs and tool features. The data quality case documents (Excel version) they generate are the same.

[0133] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes the method for generating counter-cases based on data quality rules when running.

[0134] Specifically, the method for generating counter-cases based on data quality rules includes:

[0135] Step S201, uniformly formatting multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrating all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules used to evaluate data correctness;

[0136] Specifically, the target data quality rules are documents that explain the correctness of data based on documents such as data dictionaries. Different data quality rules are set according to different test points that need to be tested. Generally, the target data quality rules include the test rules required for all test points.

[0137] Step S202, obtaining a test positive case, and scanning the fields in the test positive case, so as to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to a plurality of test negative cases, and the negative case test script is an execution script of the corresponding test negative case;

[0138] Specifically, negative cases are generated in batches by replacing fields in positive cases under the constraints of data quality rules; negative cases that meet the requirements of data quality rule control are generated based on existing positive cases, reducing repetitive work and saving time and labor costs.

[0139] Step S203: Generate a total counter-case table according to all the above test counter-cases, wherein the total counter-case table includes all the above test counter-cases and test result items.

[0140] Specifically, based on the existing positive cases, negative cases that meet the requirements of data quality rule control are generated to reduce repetitive work, save time and labor costs; the quality rule table is configured according to actual needs, supports writing rules in character, array, and key-value pair formats, supports custom functions, and has comprehensive coverage and flexible writing. There is no limit on programming languages, Java, Python, etc. are all acceptable, and programming languages ​​are just tools. There is no limit on testing tools, Postman, Jmeter, etc. are all acceptable. The test scripts generated by different testing tools are different, and you can choose according to your own needs and tool features. The data quality case documents (Excel version) they generate are the same.

[0141] An embodiment of the present invention provides a device, the device including a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, at least the following steps are implemented:

[0142] Step S201, uniformly formatting multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrating all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules used to evaluate data correctness;

[0143] Step S202, obtaining a test positive case, and scanning the fields in the test positive case, so as to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to a plurality of test negative cases, and the negative case test script is an execution script of the corresponding test negative case;

[0144] Step S203: Generate a total counter-case table according to all the above test counter-cases, wherein the total counter-case table includes all the above test counter-cases and test result items.

[0145] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0146] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the following method steps:

[0147] Step S201, uniformly formatting multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrating all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules used to evaluate data correctness;

[0148] Step S202, obtaining a test positive case, and scanning the fields in the test positive case, so as to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to a plurality of test negative cases, and the negative case test script is an execution script of the corresponding test negative case;

[0149] Step S203: Generate a total counter-case table according to all the above test counter-cases, wherein the total counter-case table includes all the above test counter-cases and test result items.

[0150] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0151] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0152] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0153] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0154] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0155] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0156] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

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

[0158] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0159] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:

[0160] 1) The method for generating the counter-case based on the data quality rule of the present application is as follows: first, a plurality of initial data quality rules are uniformly formatted to obtain corresponding preliminary data quality rules, and all preliminary data quality rules are integrated to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules for evaluating the correctness of data; then, a test positive case is obtained, and the fields in the test positive case are scanned to generate a test counter-case and a corresponding counter-case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to multiple test counter-cases, and the counter-case test script is an execution script of the corresponding test counter-case; finally, a total counter-case table is generated according to all the test counter-cases, and the total counter-case table includes all the test counter-cases and test result items. The method reduces human interference in assembly testing, improves test efficiency, saves test costs, supports writing rules in character, array, and key-value pair formats, supports custom functions, has comprehensive coverage, and is flexible to write, and solves the problem that the method of writing counter-cases by testers in the prior art has large human interference factors, and has low test costs and low test efficiency.

[0161] 2) The above-mentioned data quality rule-based counter-case generation device of the present application includes: a first processing unit, a second processing unit and a third processing unit, the first processing unit is used to uniformly format multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrate all preliminary data quality rules to obtain target data quality rules, the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules used to evaluate data correctness; the second processing unit is used to obtain a test positive case and scan the fields in the test positive case to generate a test counter-case and a corresponding counter-case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to multiple test counter-cases, and the counter-case test script is an execution script of the corresponding test counter-case; the third processing unit is used to generate a total counter-case table based on all the test counter-cases, and the total counter-case table includes all the test counter-cases and test result items. The device reduces human interference in assembly testing, improves testing efficiency, saves testing costs, supports writing rules in character, array, and key-value pair formats, supports custom functions, has comprehensive coverage, and is flexible to write. It solves the problem in the prior art that the method of writing counter-cases by testers has large human interference factors, low testing costs, and low testing efficiency.

[0162] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for generating counter-cases based on data quality rules, characterized in that: include: Uniformly formatting multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrating all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules used to evaluate data correctness; Acquire a test positive case, and scan the fields in the test positive case to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to multiple test negative cases, and the negative case test script is an execution script of the corresponding test negative case; A total counter-case table is generated according to all the test counter-cases, and the total counter-case table includes all the test counter-cases and test result items.

2. The method according to claim 1, characterized in that Scanning the fields in the test positive case to generate a test counter case and a corresponding counter case test script according to the test positive case and the target data quality rule, including: Scan the input item fields of the test positive case, search the target data quality rules according to each of the input item fields, and determine whether there is a test rule corresponding to the input item field in the target data quality rule; When there is a test rule corresponding to the input item field in the target data quality rule, the input item field is determined as a field to be replaced, and the field to be replaced is replaced according to the test rule corresponding to the field to be replaced to obtain the test negative case corresponding to the test positive case.

3. The method according to claim 2, characterized in that According to the test rule corresponding to the field to be replaced, the field to be replaced is replaced to obtain the test negative case corresponding to the test positive case, including: Determining that the target data quality rule includes a character length rule and a character format rule, wherein the character length rule is used to constrain the character length of a field, and the character format rule is used to constrain the format of each character in the field; According to the character length rule and the character format rule, character length replacement and / or character format replacement is performed on a certain character in the field to be replaced to obtain the test negative case corresponding to the test positive case.

4. The method according to claim 2, characterized in that: According to the test rule corresponding to the field to be replaced, the field to be replaced is replaced to obtain the test negative case corresponding to the test positive case, including: Determining that the target data quality rule includes an array format rule, wherein the array format rule is used to constrain the format of the entire character of an array field; According to the array format rule, character format replacement is performed on the entire field to be replaced to obtain the test negative case corresponding to the test positive case.

5. The method according to claim 2, characterized in that: According to the test rule corresponding to the field to be replaced, the field to be replaced is replaced to obtain the test negative case corresponding to the test positive case, including: Determining that the target data quality rule includes a key-value pair association rule, wherein the key-value pair association rule is used to constrain the format of two mutually related fields; Determine a first field and a second field, where the first field and the second field are two mutually related fields to be replaced; According to the key-value pair association rule, characters of one of the first field and the second field are replaced to obtain the test negative case corresponding to the test positive case.

6. The method according to claim 1, characterized in that The target data quality rules are Excel documents, which at least include: Chinese name of the field, English name of the field, field usage scenario, test method, test data, data format rules, business related information, and obtain test positive cases, including: Determine a plurality of test requirements, wherein the test requirements are test requirements of predefined fields; One or more positive test cases are determined according to all the test requirements, wherein, when there is only one positive test case, the positive test case satisfies all the test requirements, and when there are multiple positive test cases, all the positive test cases satisfy all the test requirements.

7. The method according to any one of claims 1 to 6, characterized in that: After generating a total counter-case table according to all the test counter-cases, the method further comprises: Execute each of the counter-case test scripts in sequence to obtain a corresponding test result, and summarize each of the test results into the total counter-case table according to the corresponding relationship between the counter-case test script and the test result.

8. A device for generating counter-cases based on data quality rules, characterized in that: include: A first processing unit is used to uniformly format multiple initial data quality rules to obtain corresponding preliminary data quality rules, and integrate all the preliminary data quality rules to obtain target data quality rules, wherein the format of the target data quality rules is a machine-recognizable format, and the target data quality rules are data rules used to evaluate data correctness; A second processing unit is used to obtain a test positive case and scan the fields in the test positive case to generate a test negative case and a corresponding negative case test script according to the test positive case and the target data quality rule, wherein one test positive case corresponds to a plurality of test negative cases, and the negative case test script is an execution script of the corresponding test negative case; The third processing unit is used to generate a total counter-case table according to all the test counter-cases, wherein the total counter-case table includes all the test counter-cases and test result items.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for generating counter-cases based on data quality rules as described in any one of claims 1 to 7.

10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for generating counter-cases based on data quality rules for executing any one of claims 1 to 7.