Automatic parameterization method and device for interface test after system migration, equipment and medium
By automatically extracting and matching test-related parameters, automatic parameterization of process scenario testing after application system migration is realized, solving the problem of automatic context parameter transfer in post-migration interface testing, and improving testing efficiency and accuracy.
Patent Information
- Application Number
- CN202410876781.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-10-01
AI Technical Summary
After the application system is migrated, a large number of context interface parameter configurations are required during process scenario testing, resulting in long-term parameter adaptation for testers, which consumes a lot of time and cost. Moreover, it is difficult to realize automatic parameter transfer with existing technology, which reduces the efficiency of interface testing.
By obtaining the recorded baseline report and candidate test cases corresponding to the test interface of the target migration system, using preset parameter acquisition rules to automatically extract test-related parameters, perform context similarity matching and automatic parameter replacement, determine the target test cases, and achieve automatic parameterization.
It improves the accuracy and efficiency of automatic parameterization, reduces the amount of matching data, prevents erroneous automatic parameterization, improves the efficiency of interface testing, and enables efficient testing of the Xinchuang system after migration.
Smart Images

Figure CN118733466A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology innovation system testing, and in particular to a method, device, equipment and medium for automatic parameterization of interface testing after system migration. Background Art
[0002] Xinchuang system is a series of information technology systems based on domestic software and hardware established in the context of information technology application innovation in order to achieve independent control in the field of information technology and safeguard national information security. In order to ensure information security, it is necessary to migrate the developed application system to the information technology system based on domestic software and hardware and run it on a domestic operating system. In order to ensure that the application system runs normally, has complete functions and meets performance standards in the new system after migration, it is necessary to test each interface of the migrated application system to ensure that the functions of each interface are consistent with those before migration, and that no new errors or defects are introduced due to the migration process. In the process of interface testing, a large amount of context interface parameter configuration work is required for process scenario testing, which requires testers to adapt parameters for a long time, consuming a lot of time and cost. Summary of the invention
[0003] The present invention provides a method, device, equipment and medium for automatic parameterization of interface test after system migration, so as to solve the technical problem of automatic context parameter transmission in process scenario test after application system migration in the prior art.
[0004] According to one aspect of the present invention, there is provided a method for automatic parameterization of interface testing after system migration, comprising:
[0005] Obtain a recorded baseline report and at least one candidate test case corresponding to a test interface of a target migration system;
[0006] Automatically extract parameters from the recorded baseline report using preset parameter acquisition rules to obtain test-related parameters;
[0007] Performing context similarity matching between the test association parameters and the test request information of each candidate test case to determine an associated test case;
[0008] Automatically replace the parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case.
[0009] According to another aspect of the present invention, there is provided an automatic parameterization device for interface testing after system migration, comprising:
[0010] A data acquisition module, used to acquire a recorded baseline report and at least one candidate test case corresponding to a test interface of a target migration system;
[0011] An automatic parameterization extraction module, used to automatically extract parameters from the recorded baseline report according to preset parameter acquisition rules to obtain test-related parameters;
[0012] An automatic parameterized matching module, used to perform context similarity matching with the test request information of each candidate test case according to the test association parameters, and determine the associated test case;
[0013] The automatic parameterization replacement module is used to automatically replace the parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to the at least one processor; wherein,
[0017] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for automatic parameterization of system post-migration interface testing according to any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions for enabling a processor to implement the method for automatic parameterization of post-migration interface testing of a system as described in any embodiment of the present invention when the computer instructions are executed.
[0019] The technical solution of the embodiment of the present invention can effectively improve the accuracy of automatic parameterization by obtaining a recorded baseline report and at least one candidate test case corresponding to the test interface of the target migration system, and using the recorded baseline report as the basis for automatic parameterization of the candidate test case; automatically extracting parameters in the recorded baseline report through preset parameter acquisition rules to obtain test-related parameters, and obtaining test-related parameters in the recorded baseline report, and only using test-related parameters during automatic parameterization, effectively reducing the amount of matching data and improving the efficiency of data matching; performing context similarity matching with the test-related parameters and the test request information of each candidate test case to determine the associated test case, and the similarity matching of the test-related parameters can only perform automatic parameterization on the scenario test case with a context-related relationship, which can improve the accuracy of automatic parameterization and prevent erroneous automatic parameterization from reducing the test efficiency of the interface; automatically replacing the test request information of the associated test case based on the test-related parameters to determine the target test case, and automatically replacing the associated test case with the test-related parameters to improve the efficiency of the staff in setting the scenario test case, thereby solving the technical problem of automatic context parameter transmission in the process scenario test after the application system is migrated in the prior art. It achieves efficient testing of application systems after migration and improves the efficiency of interface testing.
[0020] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 A flowchart of a method for automatic parameterization of interface testing after system migration is provided for an embodiment of the present invention;
[0023] Figure 2 A flow chart of interface testing of a target migration system is disclosed;
[0024] Figure 3 A flowchart of another method for automatic parameterization of interface testing after system migration provided by an embodiment of the present invention;
[0025] Figure 4A schematic diagram of the structure of an automatic parameterization device for post-system migration interface testing provided by an embodiment of the present invention;
[0026] Figure 5 A schematic structural diagram of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Figure 1 A flowchart of a method for automatic parameterization of interface testing after system migration is provided for an embodiment of the present invention. This embodiment can be applied to the case of performing functional testing on interfaces in a trusted innovation system after system migration. The method can be executed by an automatic parameterization device for interface testing after system migration. The automatic parameterization device for interface testing after system migration can be implemented in the form of hardware and / or software. The automatic parameterization device for interface testing after system migration can be configured in an electronic device. Figure 1 As shown, the method includes:
[0030] Optionally, after migrating the original system to the trusted innovation system, a target migration system is obtained after migration in the trusted innovation system. Then, each functional interface of the original system needs to be tested to ensure that the functions of each functional interface of the original system are normal and consistent in the target migration system after migration.
[0031] Figure 2 A flow chart of interface testing of a target migration system is disclosed; Figure 2As shown: the relevant data of the scenario test cases of the target migration system can be obtained by recording the functional interfaces of the original system in the working environment of the proxy service simulating the original system, and the operation flow of the functional interfaces of the original system is recorded by the proxy service, and the obtained data is synchronized in real time to the preset use case library, and then the data is associated with the scenario test cases through the use case library, and then the playback function is used to request the target migration system to replay the scenario test cases, so as to realize the test of the target migration system and obtain a test report.
[0032] S110: Obtain a recorded baseline report corresponding to a test interface of a target migration system and at least one candidate test case.
[0033] Among them, the test interface can be the functional interface of the target migration system that needs to be tested. It should be noted that since the target migration system is the application system in the information creation system obtained by migrating the original system, each functional interface of the target migration system needs to be tested, and each functional interface of the target migration system can be set as a test interface.
[0034] Among them, the recorded baseline report can be a detailed test report generated based on the baseline recorded data. The recorded baseline report can summarize the baseline recording process, and the recorded baseline report can be used as an important reference in the test process. It should be noted that baseline recording is a comprehensive and detailed request and response information recording process of the test interface when testing the test interface. In the baseline recording, the standard information of each test interface under the expected working conditions can be captured. In the baseline recording process, the request information, response information, response time and abnormal conditions of the test interface can be captured.
[0035] Optionally, the recording baseline report usually includes the functional description of each test interface, request information and response information, key verification points of the response information, difference analysis of expected results and conclusion suggestions.
[0036] Among them, the candidate test cases can be scenario test cases designed and developed for the test interface; the candidate test cases can test the functions, business scenarios and problem risks of the test interface. It should be noted that there are multiple candidate test cases developed for the test interface, and the parameters of each candidate test case have context dependencies and associations.
[0037] Optionally, the candidate test cases may be recorded according to the test interface of the original system, may be developed and designed based on the recorded baseline report, or may be automatically simulated based on the recorded baseline report through a neural network model and / or a big data model.
[0038] Specifically, when performing parameter automation on the target migration system, it is necessary to obtain a recorded baseline report corresponding to a test interface of the target migration system and at least one candidate test case.
[0039] S120: Automatically extract parameters from the recorded baseline report using preset parameter acquisition rules to obtain test-related parameters.
[0040] The preset parameter acquisition rule may be a pre-set rule for extracting request information and response information in the recorded baseline report.
[0041] The test association parameters may be data of context association and dependency between candidate test cases during the test interface test process.
[0042] Optionally, since in the test interface, each candidate test case has contextual association and dependent data, which is the request information and response information of the test interface, the request information and response information in the baseline test report can be identified through preset parameter acquisition rules, and the identified request information and response information are automatically extracted from the baseline test report to obtain test-related parameters.
[0043] Optionally, the test associated parameters include request header information and request body information of the request information, and response result information of the response information, and the request header information, request body information and response result information are key-value pair data structures (key-value), the request header information includes a request header identification key and a request header value; the request body information includes a request body identification key and a request body value; the response result information includes a response result identification key and a response result value.
[0044] S130: Perform context similarity matching between the test association parameters and the test request information of each candidate test case to determine an associated test case.
[0045] The test request information may be request information and response information set in the candidate test case for testing the test interface.
[0046] Among them, the associated test case can be a scenario test case in the candidate test case that has context dependency and association with the test associated parameters. It should be noted that in the process of matching each candidate test case through the test associated parameters, if the candidate test case has context dependency and association with the test associated parameters, then this candidate test case is used as an associated test case and matches the next candidate test case; if the candidate test case has no context dependency and association with the test associated parameters, then this candidate test case is not processed, and the next candidate test case is directly matched until all candidate test cases are fully matched. Therefore, there may be no associated test case for the test associated parameters corresponding to a test interface, or there may be multiple associated test cases. For test interfaces that do not have associated test cases, there is no need to automatically parameterize the candidate test cases, and the candidate test cases are directly used to test the test interface.
[0047] Specifically, after the test association parameters are obtained, context similarity matching is performed between the test association parameters and the test request information of each candidate test case, and the successfully matched candidate test case is used as the associated test case.
[0048] S140: Automatically replace parameters of the test request information of the associated test case based on the test associated parameters to determine a target test case.
[0049] The target test case may be a scenario test case obtained by replacing the test request information and response information of the associated test case with the test associated parameters. It should be noted that the request information and response information of the test request information of the target test case are key-value pair structures. When the parameters are automatically replaced, the request information and response information of the test request information are replaced.
[0050] Specifically, after determining the associated test cases, the test request information of the associated test cases can be automatically parameterized through the test association test, by automatically replacing the request information and response information in the test request information. After the automatic parameter replacement, the request information and response information reference the test association parameters to obtain the target test cases.
[0051] Optionally, in another optional embodiment of the present invention, before obtaining the recorded baseline report corresponding to the test interface of the target migration system and at least one candidate test case, the method further includes:
[0052] Obtain a use case library of the original system corresponding to the target migration system, and obtain scenario test cases of the test interface of the target migration system from the use case library; perform baseline recording of the test interface through the scenario test cases to obtain recorded test data; perform recording process analysis and verification on the recorded test data, and generate a recording baseline report based on the recorded test data when the recording process of the recorded test data is correct.
[0053] The use case library may be a database pre-set to store scenario test cases corresponding to the target migration system. The recorded test data may be data obtained by performing baseline recording on the test interface of the target migration system.
[0054] Optionally, when recording the test interface through baseline recording, the staff is required to test and record the test interface according to the recording process of baseline recording. It should be noted that the recording process of baseline recording can be to select an automated testing tool, build a test environment corresponding to the test interface, set a recording target, turn on the recording mode in the automated testing tool, set the corresponding recording setting parameters, start baseline recording, perform the interactive operations corresponding to the baseline recording, and verify the corresponding data, stop recording when the recording is completed, and obtain the recorded test data.
[0055] Optionally, after obtaining the recording test data, the recording process is analyzed and verified on the recording test data to detect whether the recording process is correct. If there are no errors in the data and operations in the recording process, the recording process is considered to be a correct recording process.
[0056] Specifically, obtain the use case library of the original system corresponding to the target migration system, obtain the scenario test case used for baseline recording in the use case library, perform baseline recording of the test interface through the scenario test case to obtain recorded test data, and perform recording analysis and verification on the recorded test data obtained by the baseline recording. If the recording process of the recorded test data is correct, generate a recording baseline report based on the recorded test data; if the recording process of the recorded test data is incorrect, re-record the test interface through the scenario test case until a recorded baseline report is obtained.
[0057] The technical solution of the embodiment of the present invention can effectively improve the accuracy of automatic parameterization by obtaining a recorded baseline report and at least one candidate test case corresponding to the test interface of the target migration system, and using the recorded baseline report as the basis for automatic parameterization of the candidate test case; automatically extracting parameters in the recorded baseline report through preset parameter acquisition rules to obtain test-related parameters, and obtaining test-related parameters in the recorded baseline report, and only using test-related parameters when performing automatic parameterization, effectively reducing the amount of matching data and improving the efficiency of data matching; performing context similarity matching with the test-related parameters and the test request information of each of the candidate test cases to determine the associated test cases, and the similarity matching of the test-related parameters can only perform automatic parameterization on the scenario test cases with contextual associations, which can improve the accuracy of automatic parameterization and prevent erroneous automatic parameterization from reducing the test efficiency of the interface; automatically replacing the test request information of the associated test case based on the test-related parameters to determine the target test case, and automatically replacing the associated test case with the test-related parameters to improve the efficiency of the staff in setting scenario test cases, thereby solving the technical problem of automatic context parameter transmission in the process scenario test after the application system is migrated in the prior art. It achieves efficient testing of application systems after migration and improves the efficiency of interface testing.
[0058] Figure 3 This is a flowchart of another method for automatic parameterization of interface testing after system migration provided by an embodiment of the present invention. The relationship between this embodiment and the above embodiment is to specifically explain the specific process of realizing automatic parameterization by testing associated parameters. Figure 3 As shown, the method includes:
[0059] S310: Obtain a recorded baseline report corresponding to a test interface of a target migration system and at least one candidate test case.
[0060] S320: Automatically extract parameters from the recorded baseline report using preset parameter acquisition rules to obtain test-related parameters.
[0061] S330: Perform context similarity matching on the test request information of each of the candidate test cases according to the request header information, the request body information and the response result information to determine the associated test case.
[0062] Specifically, when performing context similarity matching on each candidate test case through test association parameters, since the context relationship between each candidate test case and the recorded baseline report is different, the request header information, request body information and response result information are used in sequence to perform context similarity matching, so that all the associated test cases in the candidate test cases can be obtained, thereby improving the accuracy of context similarity matching.
[0063] Optionally, in another optional embodiment of the present invention, performing context similarity matching on the test request information of each candidate test case according to the request header information, the request body information and the response result information to determine the associated test case includes:
[0064] The request header identification key and request header value of the request header information, the request body identification key and request body value of the request body information, and the response result identification key and response result value of the response result information are respectively matched with the test request information in each of the candidate test cases for context similarity; if there is a successful match between the test request information in the candidate test case and the request header identification key and request header value of the request header information, the request body identification key and request body value of the request body information, and / or the response result identification key and response result value of the response result information, the successfully matched candidate test case is used as an associated test case.
[0065] Optionally, during context similarity matching, context similarity matching is performed between the request header identification key and the request header value of the request header information and the test request information in each of the candidate test cases to determine whether the request information in the test request information is the same as the request header identification key and the request header value; if the request information in the test request information contains request header information that is the same as the request header identification key and the request header value, the candidate test case is determined to be an associated test case, and context similarity matching is continued to be performed between the request information and the response information in the test request information through the request body identification key and the request body value of the request body information; if the request information of the associated test case contains information that is the same as the request body identification key and the request body value of the request body information, context similarity matching is performed between the response result identification key and the response result of the response result information and the response information in the test request information; if the response information of the associated test case contains information that is the same as the response result identification key and the response result of the response result information, it is determined that the function of the associated test case can be a regression test, and the associated test case used for regression testing can be directly used as a target test case.
[0066] Optionally, during context similarity matching, context similarity matching is performed between the request header identification key and the request header value of the request header information and the test request information in each of the candidate test cases to determine whether the request information in the test request information is the same as the request header identification key and the request header value; if the request information in the test request information does not contain request header information that is the same as the request header identification key and the request header value, context similarity matching is continued with the request body identification key and the request body value of the request body information and the request information and response information in the test request information; if neither the request information nor the response information of the candidate test case contains information that is the same as the request body identification key and the request body value of the request body information, context similarity matching is performed with the request information and response information in the test request information through the response result identification key and the response result of the response result information; if the request information of the candidate test case has the same response result identification key and the response result as the response result information, the candidate test case is determined as an associated test case. Exemplarily, when the response result information of the test-associated parameter is referenced by the request header information of the associated test case, the response result information is a temporary token of the system, and the associated test case references the temporary token as a security credential and uses the temporary token as the request header information. In another scenario, when the response result information of the test-associated parameter is referenced by the request body information of the associated test case, the response result information can also be the user's account balance, and the associated test case is used to consume the account balance. By referencing the consumption account balance and using the temporary token as the request body information, the account balance can be consumed.
[0067] Optionally, during context similarity matching, context similarity matching is performed between the request header identification key and the request header value of the request header information and the test request information in each of the candidate test cases to determine whether the request information in the test request information is the same as the request header identification key and the request header value; if the request information in the test request information contains request header information that is the same as the request header identification key and the request header value, the candidate test case is determined as an associated test case, and context similarity matching is continued to be performed between the request information and the response information in the test request information through the request body identification key and the request body value of the request body information; if the request information of the associated test case does not contain information that is the same as the request body identification key and the request body value of the request body information, context similarity matching is performed between the response result identification key and the response result of the response result information and the response information in the test request information; if the response information of the associated test case does not contain the same response result identification key and the response result as the response result information, it is determined that the function of the associated test case can be dependent on the same communication standard. Exemplarily, the scenario for testing associated parameters can be user login, the request header information is a communication authentication statement, the request header information and response result information are the account and password, and the response result is an access token. The associated test case is a user adding an item to a shopping cart, then the request header information of the associated test case includes a communication authentication statement, and the request header information and response result information are the item identifier added to the shopping cart and the successful addition message.
[0068] Optionally, during context similarity matching, context similarity matching is performed with the request header identification key and request header value of the request header information and the test request information in each of the candidate test cases to determine whether the request information in the test request information is the same as the request header identification key and request header value; if the request information in the test request information contains request header information that is the same as the request header identification key and request header value, the candidate test case is determined as an associated test case, and context similarity matching is continued with the request body identification key and request body value of the request body information and the request information and response information in the test request information; if the response information of the associated test case contains information that is the same as the request body identification key and request body value of the request body information, the function of the associated test case is considered to be a context-dependent test. Exemplarily, the test association parameters are:
[0069] The request header identification key and request header value of the request header information are {"Accept"; "application / json"};
[0070] The request body identification key and request body value of the request body information are {"p_id"; "123"};
[0071] The response result identification key and response result value of the response result information are {"username"; "123"};
[0072] The test request information of the candidate test case is:
[0073] The request header identification key and request header value of the request header information are {"Accept"; "application / json"};
[0074] The request body identification key and request body value of the request body information are {"username"; "123"};
[0075] The response result identification key and response result value of the response result information are {"info"; "exists"};
[0076] Among them, if the request header information of the test association parameters is the same as the request header information in the test request information of the candidate test case, and the response result information of the test association parameters is the same as the request body information in the test request information of the candidate test case, the candidate test case is determined as an associated test case, and the function is a context-dependent test.
[0077] Optionally, during context similarity matching, context similarity matching is performed between the request header identification key and the request header value of the request header information and the test request information in each of the candidate test cases to determine whether the request information in the test request information is the same as the request header identification key and the request header value; if the request information in the test request information does not contain request header information that is the same as the request header identification key and the request header value, context similarity matching is continued between the request body identification key and the request body value of the request body information and the request information and response information in the test request information; if the request information of the associated test case contains information that is the same as the request body identification key and the request body value of the request body information, the candidate test case is determined to be an associated test case; then context similarity matching is continued between the response result identification key and the response result value of the response result information and the response information of the associated test case; if the response information of the associated test case does not contain information that is the same as the response result identification key and the response result value of the response result information, the function of the associated test case is considered to be a context dependency. Exemplarily, the scenario for testing associated parameters is querying account balances, the request body information is account identification information, and the associated test case is transferring money between accounts. Then, the request header information and response result information of the associated test case are different from the test associated parameters, and the request body information of the associated test case is the same as the request body information of the test associated parameters, both of which are account identification information.
[0078] Optionally, during context similarity matching, context similarity matching is performed between the request header identification key and the request header value of the request header information and the test request information in each of the candidate test cases to determine whether the request information in the test request information is the same as the request header identification key and the request header value; if the request information in the test request information does not contain request header information that is the same as the request header identification key and the request header value, context similarity matching is continued with the request information and response information in the test request information through the request body identification key and the request body value of the request body information; if the request information of the associated test case contains information that is the same as the request body identification key and the request body value of the request body information, the candidate test case is determined to be an associated test case; then context similarity matching is continued with the response result identification key and the response result value of the response result information and the response information of the associated test case; if the response information of the associated test case contains information that is the same as the response result identification key and the response result value of the response result information, the function of the associated test case is considered to be a context dependency. Exemplarily, the scenario for testing associated parameters is user registration, the request body information and response result information are account and password, and the associated test case is creating an order. Then, the request header information of the associated test case is different from the test associated parameters, and the request body information and response result information of the associated test case are the same as the request body information and response result information of the test associated parameters, which are both account and password.
[0079] Optionally, during context similarity matching, context similarity matching is performed between the request header identification key and request header value of the request header information and the test request information in each of the candidate test cases to determine whether the request information in the test request information is the same as the request header identification key and request header value; if the request information in the test request information does not contain request header information that is identical to the request header identification key and request header value, context similarity matching is continued between the request body identification key and request body value of the request body information and the request information and response information in the test request information; if the request information of the associated test case does not contain information that is identical to the request body identification key and request body value of the request body information, context similarity matching is continued between the response result identification key and response result value of the response result information and the response information of the associated test case; if the response information of the associated test case does not contain information that is identical to the response result identification key and response result value of the response result information, the candidate test case is matched and identified with the test associated information, and the next candidate test case is matched.
[0080] S340, assigning the request header information, request body information and response result information to the step post-variables of the test interface; automatically replacing the parameters of the test request information of the associated test case based on the step post-variables to determine the target test case.
[0081] Among them, the step post-variable can be variable data used for subsequent tests in the test interface.
[0082] Specifically, after determining that the test associated parameters exist with associated test cases, the request header information, request body information and response result information are assigned to the step post-variables of the test interface, the associated test cases are automatically parameterized through the step post-variables, and the step post-variables are used to automatically replace the request information and response information in the test request information. After the automatic parameter replacement, the request information and response information reference the step post-variables to obtain the target test case.
[0083] Optionally, in another optional embodiment of the present invention, automatically replacing parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case includes:
[0084] The step post-position variable is added to a preset variable management function. When the test interface is tested through the associated test case, the step post-position variable is referenced through the variable management function. Based on the step post-position variable, the test request information of the associated test case is automatically replaced with a variable to obtain a target test case corresponding to the test interface.
[0085] Among them, the preset variable management function can be a function for managing variables pre-set by the automated testing tool in the automated test. It should be noted that the preset variable management function can set the step post-variables in the test process of the test interface, can realize the dynamic addition, management and deletion of the step post-variables, and the variable management function can support the dynamic transfer, environment switching and reuse of the step post-variables in the test process. Exemplarily, the automated testing tools may include tools such as Postman tool, JMeter tool, SoapUI tool, Pytest+Requests tool and Selenium tool.
[0086] Specifically, by adding a step post-position variable to a pre-set variable management function, when the test interface is tested through an associated test case, the step post-position variable is referenced through the variable management function; based on the step post-position variable, the test request information of the associated test case is automatically replaced with a variable to obtain a target test case corresponding to the test interface.
[0087] The automatic parameterization method for interface testing after system migration provided in the embodiment of the present invention can automatically parameterize scenario test cases with contextual associations by matching test association parameters with the test request information of each candidate test case, and can quickly implement automatic parameter replacement by referencing step post-variables, thereby improving the efficiency of staff in setting scenario test cases and the efficiency of automatic parameterization of test interfaces.
[0088] Optionally, another method for automatic parameterization of interface testing after system migration provided by an embodiment of the present invention obtains a baseline report through automatic parameterization program scanning, obtains request header information, request body information and response result information of the recorded baseline report, and then performs variable matching with candidate test cases according to the request header information, request body information and response result information. After the match is successful, the request header information, request body information and response result information of the baseline report are added as post-step variables in the variable management function, and the target test case is obtained through variable replacement. The embodiment of the present invention can quickly realize automatic parameter replacement, improve the efficiency of staff in setting scenario test cases, and improve the efficiency of automatic parameterization of test interfaces.
[0089] Figure 4 A schematic diagram of the structure of an automatic parameterization device for post-system migration interface testing provided by an embodiment of the present invention. Figure 4 As shown, the device includes: a data acquisition module 410, an automatic parameterization extraction module 420, an automatic parameterization matching module 430 and an automatic parameterization replacement module 440.
[0090] A data acquisition module 410 is used to acquire a recorded baseline report and at least one candidate test case corresponding to a test interface of a target migration system;
[0091] An automatic parameterization extraction module 420, configured to automatically extract parameters from the recorded baseline report according to a preset parameter acquisition rule to obtain test-related parameters;
[0092] The automatic parameterized matching module 430 is used to perform context similarity matching with the test request information of each candidate test case according to the test associated parameters to determine the associated test case;
[0093] The automatic parameterization replacement module 440 is used to automatically replace the parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case.
[0094] The technical solution of the embodiment of the present invention can effectively improve the accuracy of automatic parameterization by obtaining a recorded baseline report and at least one candidate test case corresponding to the test interface of the target migration system, and using the recorded baseline report as the basis for automatic parameterization of the candidate test case; automatically extracting parameters in the recorded baseline report through preset parameter acquisition rules to obtain test-related parameters, and obtaining test-related parameters in the recorded baseline report, and only using test-related parameters during automatic parameterization, effectively reducing the amount of matching data and improving the efficiency of data matching; performing context similarity matching with the test-related parameters and the test request information of each of the candidate test cases to determine the associated test cases, and performing automatic parameterization only for scenario test cases with contextual associations based on the similarity matching of the test-related parameters, which can improve the accuracy of automatic parameterization and prevent erroneous automatic parameterization from reducing the test efficiency of the interface; automatically replacing parameters of the test request information of the associated test case based on the test-related parameters to determine the target test case, and automatically replacing parameters of the associated test case through the test-related parameters to improve the efficiency of staff in setting scenario test cases, thereby solving the technical problem of automatic context parameter transmission in process scenario testing in the prior art. It achieves efficient testing of interfaces in the migrated information and innovation system and improves the efficiency of interface testing.
[0095] Optionally, the automatic parameterization extraction module is specifically used for: the test associated parameters include request header information, request body information and response result information; wherein the request header information includes a request header identification key and a request header value; the request body information includes a request body identification key and a request body value; the response result information includes a response result identification key and a response result value.
[0096] Optionally, the automatic parameterized matching module is specifically used for:
[0097] Context similarity matching is performed on the test request information of each candidate test case according to the request header information, the request body information and the response result information to determine the associated test case.
[0098] Optionally, the automatic parameterized matching module is further used for:
[0099] The request header identification key and request header value of the request header information, the request body identification key and request body value of the request body information, and the response result identification key and response result value of the response result information are respectively matched with the test request information in each of the candidate test cases for context similarity; if there is a successful match between the test request information in the candidate test case and the request header identification key and request header value of the request header information, the request body identification key and request body value of the request body information, and the response result identification key and response result value of the response result information, the successfully matched candidate test case is used as an associated test case.
[0100] Optionally, the automatic parameterization replacement module is specifically used for:
[0101] Assigning the request header information, request body information and response result information to the post-step variables of the test interface;
[0102] Automatically replace parameters of the test request information of the associated test case based on the step post-variable to determine the target test case.
[0103] Optionally, the automatic parameterization replacement module is further used to:
[0104] Adding the step post-variable to a preset variable management function, and when testing the test interface through the associated test case, referencing the step post-variable through the variable management function;
[0105] Automatic variable replacement is performed on the test request information of the associated test case based on the step post-variable to obtain a target test case corresponding to the test interface.
[0106] Optionally, the device further comprises: a use case library data request module, a baseline recording module and a data verification module; wherein:
[0107] The use case library data request module is used to obtain the use case library of the original system corresponding to the target migration system, and obtain the scenario test cases of the test interface of the target migration system from the use case library;
[0108] The baseline recording module is used to perform baseline recording on the test interface through the scenario test case to obtain recorded test data;
[0109] The data verification module is used to perform recording process analysis and verification on the recording test data, and generate a recording baseline report based on the recording test data when the recording process of the recording test data is correct.
[0110] The automatic parameterization device for post-system migration interface testing provided by the embodiment of the present invention can execute the automatic parameterization method for post-system migration interface testing provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0111] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their modes are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0112] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0113] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer grid such as the Internet and / or various telecommunication grids.
[0114] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the automatic parameterization method for interface testing after system migration.
[0115] In some embodiments, the system post-migration interface test automatic parameterization method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the system post-migration interface test automatic parameterization method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the system post-migration interface test automatic parameterization method in any other appropriate manner (for example, by means of firmware).
[0116] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0117] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the modes / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0118] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0119] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0120] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a grid browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication grid). Examples of communication grids include: a local area network (LAN), a wide area network (WAN), a blockchain grid, and the Internet.
[0121] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication grid. The client and server relationship is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0122] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0123] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the method steps for automatically parameterizing the system post-migration interface test provided in any embodiment of the present invention are implemented. The method includes:
[0124] Obtain a recorded baseline report and at least one candidate test case corresponding to a test interface of a target migration system;
[0125] Automatically extract parameters from the recorded baseline report using preset parameter acquisition rules to obtain test-related parameters;
[0126] Performing context similarity matching between the test association parameters and the test request information of each candidate test case to determine an associated test case;
[0127] Based on the test association parameters, the test request information of the associated test case is automatically replaced with parameters to determine the target test case. The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0128] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0129] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0130] Computer program code for performing the operation of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of grid, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0131] It should be understood by those skilled in the art that the above modules or steps of the present invention can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a grid composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, 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.
[0132] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0133] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An automatic parameterization method for interface testing after system migration, It is characterized in that include: Obtain a recorded baseline report and at least one candidate test case corresponding to a test interface of a target migration system; Automatically extract parameters from the recorded baseline report using preset parameter acquisition rules to obtain test-related parameters; Performing context similarity matching between the test association parameters and the test request information of each candidate test case to determine an associated test case; Automatically replace the parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case.
2. The method according to claim 1, It is characterized in that The test associated parameters include request header information, request body information and response result information; wherein the request header information includes a request header identification key and a request header value; the request body information includes a request body identification key and a request body value; and the response result information includes a response result identification key and a response result value.
3. The method according to claim 2, It is characterized in that The determining of the associated test case by performing context similarity matching on the test association parameter and the test request information of each candidate test case comprises: Context similarity matching is performed on the test request information of each candidate test case according to the request header information, the request body information and the response result information to determine the associated test case.
4. The method according to claim 3, It is characterized in that The performing context similarity matching on the test request information of each candidate test case according to the request header information, the request body information and the response result information to determine the associated test case includes: The request header identification key and request header value of the request header information, the request body identification key and request body value of the request body information, and the response result identification key and response result value of the response result information are respectively matched with the test request information in each of the candidate test cases for context similarity; if there is a successful match between the test request information in the candidate test case and the request header identification key and request header value of the request header information, the request body identification key and request body value of the request body information, and / or the response result identification key and response result value of the response result information, the successfully matched candidate test case is used as an associated test case.
5. The method according to claim 4, It is characterized in that The automatically replacing the parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case includes: Assigning the request header information, request body information and response result information to the post-step variables of the test interface; Automatically replace parameters of the test request information of the associated test case based on the step post-variable to determine the target test case.
6. The method according to claim 5, It is characterized in that The step of automatically replacing parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case includes: Adding the step post-variable to a preset variable management function, and when testing the test interface through the associated test case, referencing the step post-variable through the variable management function; Automatic variable replacement is performed on the test request information of the associated test case based on the step post-variable to obtain a target test case corresponding to the test interface.
7. The method according to claim 1, It is characterized in that Before obtaining the recording baseline report and at least one candidate test case corresponding to the test interface of the target migration system, the method further includes: Obtain a use case library of the original system corresponding to the target migration system, and obtain scenario test cases of the test interface of the target migration system from the use case library; Perform baseline recording of the test interface through the scenario test case to obtain recorded test data; A recording process analysis and verification is performed on the recording test data, and when the recording process of the recording test data is correct, a recording baseline report is generated according to the recording test data.
8. An automatic parameterization device for interface testing after system migration, It is characterized in that include: A data acquisition module, used to acquire a recorded baseline report and at least one candidate test case corresponding to a test interface of a target migration system; An automatic parameterization extraction module, used to automatically extract parameters from the recorded baseline report according to preset parameter acquisition rules to obtain test-related parameters; An automatic parameterized matching module, used to perform context similarity matching with the test request information of each candidate test case according to the test association parameters, and determine the associated test case; The automatic parameterization replacement module is used to automatically replace the parameters of the test request information of the associated test case based on the test associated parameters to determine the target test case.
9. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method for automatic parameterization of system post-migration interface testing according to any one of claims 1-7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for automatic parameterization of system post-migration interface testing according to any one of claims 1 to 7 when executed.
