Test parameter generation method, system, device, medium and software testing method
By parsing test scripts and software deployment documents, test parameter configuration files are automatically generated, solving the problem of low efficiency in manual configuration of test parameters in existing technologies and achieving efficient and reliable test parameter generation.
Patent Information
- Application Number
- CN202211042525.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-29
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-08-29
AI Technical Summary
In existing technologies, during the automated testing of cloud network systems, the acquisition of test parameters relies on manual extraction from LLD files and configuration into test scripts, resulting in high learning costs, low efficiency, and poor reliability.
By parsing the test script file, the test parameter set is obtained, and the first type of parameter values are obtained from the software deployment document. The second type of parameter values are generated using a preset parameter generation template, and finally, the test parameter configuration file is generated, thus achieving automated generation.
It improves the testing efficiency of testers, ensures the accuracy and consistency of test parameters, and supports rapid product delivery.
Smart Images

Figure CN115328797B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to a test parameter generation method, system, device, medium and software testing method. Background Art
[0002] During the application of the cloud network system, it is necessary to deploy and test cloud network products in sequence.
[0003] Since a large amount of repetitive product deployment work needs to be carried out, in order to improve deployment efficiency and reliability, an automated deployment tool is introduced. After the deployment is completed, a large amount of repetitive product testing work needs to be carried out. Manual test execution is inefficient and unreliable. Currently, an automated testing tool is introduced to improve the efficiency and reliability of testing.
[0004] The automated deployment and automated testing of cloud network products are also performed by deployment personnel and testers respectively. Before the automated deployment of cloud network products, deployment personnel will design and fill in the LLD (low level design, detailed design document) file. The LLD file includes the configuration and planning of the physical resources such as computing, network, storage, etc. of the cloud network system, the planning and design of system connection parameters, product login portals and users, etc.
[0005] When performing automated testing on a cloud network system, testers need to configure a parameter configuration file to generate a test script. This file configures all the parameters needed for testing. Some parameters are configured by system deployers during deployment.
[0006] Currently, these parameters are manually extracted from LLD by testers and then manually configured into the configuration file of the test script. However, LLD files are complex, with high learning costs and high requirements for testers. If the LLD files are not properly understood, wrong data will be obtained, which will seriously affect the test efficiency. Summary of the invention
[0007] In view of the problems in the prior art, the purpose of the present invention is to provide a test parameter generation method, system, device, medium and software testing method, so as to realize rapid and automatic generation of test parameter configuration files, thereby improving the testing efficiency of testers and facilitating the rapid delivery of products.
[0008] To achieve the above object, the present invention provides a method for generating test parameters, the method comprising the following steps:
[0009] Obtain test script files and software deployment documents;
[0010] Parsing the test script file to obtain a test parameter set; the test parameter set includes a first type of test parameters and a second type of test parameters;
[0011] Obtaining parameter values corresponding to the first type of test parameters from the software deployment document;
[0012] Using a preset parameter generation template to generate parameter values corresponding to the second type of test parameters;
[0013] A test parameter configuration file is generated based on the first category of test parameters, the second category of test parameters and their corresponding parameter values.
[0014] Optionally, obtaining parameter values corresponding to the first type of test parameters from the software deployment document includes:
[0015] Obtaining deployment parameters associated with the first type of test parameters from the software deployment document;
[0016] The deployment parameters are processed to obtain parameter values corresponding to the first type of test parameters.
[0017] Optionally, the first type of test parameters includes a test virtual machine IP address; and obtaining parameter values corresponding to the first type of test parameters from the software deployment document includes:
[0018] Obtaining the service subnet segment corresponding to the software to be tested from the software deployment document;
[0019] Based on the business subnet segment, an IP address of the test virtual machine is generated.
[0020] Optionally, before obtaining the parameter value corresponding to the first type of test parameter from the software deployment document, the method further comprises the steps of:
[0021] Obtaining a deployment parameter list in the software deployment document; the deployment parameter list includes multiple deployment parameters;
[0022] The test parameters in the test parameter set that have matching deployment parameters in the deployment parameter list are taken as first-category test parameters; and the remaining test parameters in the test parameter set are taken as second-category test parameters.
[0023] Optionally, the preset parameter generation template includes pre-configured different template parameters and corresponding parameter values; the step of using the preset parameter generation template to generate parameter values corresponding to the second type of test parameters includes:
[0024] Searching for template parameters matching the second type of test parameters in a preset parameter generation template;
[0025] The parameter value of the template parameter is used as the parameter value corresponding to the matched second-type test parameter.
[0026] Optionally, obtaining the test script file and the software deployment document includes:
[0027] Initialize the preset test script template library;
[0028] Displaying each test script template in the test script template library;
[0029] Receiving selection instructions for each of the test script templates, and determining the test script template corresponding to the current test requirement according to the selection instructions;
[0030] A test case is obtained, and each parameter value in the test case is associated with the parameter information in the test script template to generate a test script file.
[0031] Optionally, the software deployment document includes a detailed design document; and obtaining parameter values corresponding to the first type of test parameters from the software deployment document includes:
[0032] Obtain parameter values corresponding to the first type of test parameters from the detailed design document.
[0033] Optionally, the method further comprises the steps of:
[0034] When the number of the second-category test parameters is greater than the number of the first-category test parameters, the test parameter configuration file is modified.
[0035] Optionally, generating a test parameter configuration file based on the first type of test parameters, the second type of test parameters and their corresponding parameter values includes:
[0036] Generate an initial configuration file based on the first type of test parameters, the second type of test parameters and their corresponding parameter values;
[0037] The initial configuration file is formatted in YAML language to generate a test parameter configuration file.
[0038] To achieve the above object, the present invention also provides a software testing method, which comprises the steps of:
[0039] Based on the test parameter configuration file, the test script file is executed; the test parameter configuration file is generated by any of the test parameter generation methods described above.
[0040] The present invention also provides a test parameter generation system for implementing any of the above test parameter generation methods, the system comprising:
[0041] Script and document acquisition module, which acquires test script files and software deployment documents;
[0042] A test parameter set acquisition module parses the test script file to obtain a test parameter set; the test parameter set includes a first type of test parameters and a second type of test parameters;
[0043] A first parameter value extraction module, which obtains parameter values corresponding to the first type of test parameters from the software deployment document;
[0044] A second parameter value extraction module, using a preset parameter generation template to generate parameter values corresponding to the second type of test parameters; and
[0045] A parameter configuration file generating module generates a test parameter configuration file based on the first category test parameters, the second category test parameters and their corresponding parameter values.
[0046] The present invention also provides a test parameter generation device, comprising:
[0047] processor;
[0048] a memory in which an executable program of the processor is stored;
[0049] The processor is configured to execute any one of the steps of the above-mentioned test parameter generation method by executing the executable program.
[0050] The present invention also provides a computer-readable storage medium for storing a program, wherein the program, when executed by a processor, implements the steps of any one of the above-mentioned test parameter generation methods.
[0051] Compared with the prior art, the present invention has the following advantages and outstanding effects:
[0052] The test parameter generation method, system, device, medium and software testing method provided by the present invention parse the test script to obtain a test parameter list, that is, all the parameters required for testing; then obtain the values corresponding to different types of parameters from the software deployment document and the preset parameter generation template, so as to realize rapid and automatic generation of test parameter configuration files, which is beneficial to improving the testing efficiency of testers and thus facilitating the rapid delivery of products. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Other features, objectives and advantages of the present invention will become more apparent from a reading of the detailed description of non-limiting embodiments made with reference to the following accompanying drawings.
[0054] Figure 1 A schematic diagram of a method for generating test parameters disclosed in an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of a method for generating test parameters disclosed in another embodiment of the present invention;
[0056] Figure 3 A schematic diagram of a method for generating test parameters disclosed in another embodiment of the present invention;
[0057] Figure 4 A schematic diagram of a method for generating test parameters disclosed in another embodiment of the present invention;
[0058] Figure 5 A schematic diagram of a method for generating test parameters disclosed in another embodiment of the present invention;
[0059] Figure 6 A schematic diagram of the structure of a test parameter generation system disclosed in an embodiment of the present invention;
[0060] Figure 7 A schematic diagram of the structure of a test parameter generation system disclosed in another embodiment of the present invention;
[0061] Figure 8 A schematic diagram of the structure of a test parameter generation system disclosed in another embodiment of the present invention;
[0062] Fig. 9 A schematic diagram of the structure of a test parameter generation system disclosed in another embodiment of the present invention;
[0063] Fig.10 A schematic diagram of the structure of a test parameter generation system disclosed in another embodiment of the present invention;
[0064] Fig.11 A schematic diagram of the structure of a test parameter generating device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in the present application. The present application can also be implemented or applied through other different specific implementation methods, and the details in the present application can also be modified or changed in various ways according to different viewpoints and application systems without departing from the spirit of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0066] The following is a detailed description of the embodiments of the present application with reference to the accompanying drawings so that those skilled in the art can easily implement the present application. The present application can be embodied in a variety of different forms and is not limited to the embodiments described herein.
[0067] In the representations of the present application, the representations with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" etc. mean that the specific features, structures, materials or characteristics represented in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the represented specific features, structures, materials or characteristics may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples represented in the present application and the features of the different embodiments or examples, unless they contradict each other.
[0068] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the representation of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0069] In order to clearly describe the present application, components irrelevant to the description are omitted, and the same reference symbols are given to the same or similar components throughout the specification.
[0070] Throughout the specification, when a device is said to be "connected" to another device, this includes not only the case of "direct connection" but also the case of "indirect connection" by placing other elements therebetween. In addition, when a device is said to "include" a certain component, unless otherwise stated, it does not exclude other components, but means that other components may be included.
[0071] When a device is said to be "on" another device, it may be directly on the other device, but there may also be other devices between it. In contrast, when a device is said to be "directly" on another device, there are no other devices between it.
[0072] Although the terms first, second, etc. are used to represent various elements in some examples, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, the first interface and the second interface, etc. are represented. Moreover, as used in this article, the singular forms "one", "one" and "the" are intended to also include plural forms, unless there is an opposite indication in the context. It should be further understood that the terms "comprising" and "including" indicate the existence of features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the existence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Therefore, "A, B or C" or "A, B and / or C" means "any of the following: A; B; C; A and B; A and C; B and C; A, B and C". Only when the combination of elements, functions, steps or operations is inherently mutually exclusive in some way, will there be an exception to this definition.
[0073] The technical terms used herein are only used to refer to specific embodiments and are not intended to limit the present application. The singular form used herein also includes the plural form unless the sentence clearly indicates the contrary meaning. The meaning of "including" used in the specification is to specify specific characteristics, regions, integers, steps, operations, elements and / or components, and does not exclude the existence or addition of other characteristics, regions, integers, steps, operations, elements and / or components.
[0074] Although not defined differently, all terms, including technical and scientific terms used herein, have the same meaning as those generally understood by those skilled in the art to which this application belongs. Terms defined in commonly used dictionaries are additionally interpreted as having meanings consistent with the relevant technical literature and the contents of the current disclosure, and unless defined, shall not be overly interpreted as ideal or very formal meanings.
[0075] Example embodiments will now be described more fully in conjunction with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated description will be omitted.
[0076] like Figure 1 As shown, an embodiment of the present invention discloses a method for generating test parameters, the method comprising the following steps:
[0077] S110, obtain the test script file and the software deployment document. Specifically, the test script file is a script written for automated testing. When executing software testing, the test case can be executed based on the test script to perform automated testing. The examples in the test case can also be embedded in the test script, and the automated testing can be implemented by only executing the test script. The writing of the test script corresponds to the corresponding test case. Among them, the test case is a specific set of input data, operations or various environment settings and expected results provided to the tested system for implementing the test. The test case can be pre-configured.
[0078] In this embodiment, the software deployment document is a written software test document, which may include a detailed design document (i.e., an LLD document), but the present application is not limited thereto. In other embodiments, it may also include a software requirements specification, an outline design specification, and a structural design document.
[0079] S120, parse the above test script file to obtain a test parameter set. The above test parameter set includes a first type of test parameters and a second type of test parameters. Among them, the above test parameter set can be a test parameter list. The test parameter list contains all the parameters needed for testing, such as the configuration and planning of physical resources such as computing, network, storage, etc. of the cloud network system, system docking parameters, product login parameters, etc. Before performing automated testing, all parameters in the list need to be configured. The parameter values corresponding to all test parameters are recorded in the test parameter configuration file generated subsequently.
[0080] Among them, the parameter values corresponding to the first type of test parameters can be directly or indirectly obtained based on the software deployment document. The parameter values corresponding to the second type of test parameters cannot be directly or indirectly obtained based on the software deployment document. Therefore, in this embodiment, the parameter values corresponding to the second type of test parameters are generated using a preset parameter generation template.
[0081] S130, obtaining parameter values corresponding to the first type of test parameters from the software deployment document. In specific implementation, the parameter values corresponding to the first type of test parameters are obtained from the detailed design document of the software deployment document. For some parameters in the first type of test parameters, the parameter values can be directly obtained from the detailed design document, then the obtained parameter values are extracted and stored, and associated with the part of the parameters in the test parameter configuration file, such as stored in the form of key-value pairs.
[0082] For another part of the parameters in the first category of test parameters mentioned above, the parameter values cannot be directly obtained from the detailed design document, and only the associated parameters can be obtained from the LLD document. In this case, it is necessary to process the associated parameters or calculate based on the parameter values of the associated parameters to obtain the parameter values corresponding to the part of the parameters. Specifically, Figure 2 As shown, this step may include:
[0083] S131, obtaining deployment parameters associated with the first type of test parameters from the software deployment document.
[0084] S132: Process the above deployment parameters to obtain parameter values corresponding to the above first type of test parameters.
[0085] Exemplarily, the first type of test parameters include the IP address of the test virtual machine. Step S130 may include: obtaining the service subnet segment corresponding to the software to be tested from the software deployment document. Based on the service subnet segment, generating the IP address of the test virtual machine.
[0086] Specifically, during the automated deployment process, the network segment of the corresponding business subnet is configured, and the subnet segment includes the CIDR (Classless Inter-Domain Routing) and subnet mask of the subnet. If a test virtual machine is required during the test, an IP address needs to be generated during the automated test process for the test virtual machine to communicate in the subnet. In this case, the IP address needs to be calculated using the above-mentioned business subnet segment. Then the above-mentioned IP address is configured in the test parameter configuration file and stored.
[0087] The specific calculation process of obtaining the IP address by using the subnet segment can be implemented with reference to the prior art and will not be described in detail in this embodiment.
[0088] S140, use a preset parameter generation template to generate parameter values corresponding to the above-mentioned second category test parameters. Specifically, for the part of parameters that are in the above-mentioned test parameter set and do not have associated parameters in the LLD document, a preset parameter generation template is pre-configured. During testing, the required parameters are directly extracted from the preset parameter generation template, that is, the parameter values corresponding to the second category of test parameters are extracted, and then stored. Generally speaking, this part of parameters are parameters that are frequently used during testing. When generating a preset parameter generation template, it is possible to determine which parameters to add to the preset parameter generation template based on the types of all test products and the frequency of use of each parameter in this part of parameters during historical testing, thereby generating the above-mentioned preset parameter generation template.
[0089] For example, if you need to generate a test virtual machine during testing, you need to configure the test virtual machine's user name, password, host name and other basic information. This information can be pre-configured in the form of a preset parameter generation template, and then you can search for the corresponding template directly according to your needs to obtain the parameters.
[0090] S150, based on the first type of test parameters, the second type of test parameters and their corresponding parameter values, generate a test parameter configuration file. In specific implementation, this step S150 may include:
[0091] S151, generating an initial configuration file based on the first type of test parameters, the second type of test parameters and their corresponding parameter values.
[0092] S152, formatting the above initial configuration file based on the YAML language to generate a test parameter configuration file.
[0093] For example, a configuration file template can be searched from the configuration file template library, and the above test parameters and corresponding parameter values can be filled into the configuration file template to generate an initial configuration file. YAML is a serialization language used to write configuration files, which is highly readable and facilitates the smooth implementation of automated testing by testers.
[0094] In another embodiment of the present application, another method for generating test parameters is disclosed. Figure 1 On the basis of the corresponding embodiment, the preset parameter generation template includes different pre-configured template parameters and corresponding parameter values. In this embodiment, step S140 includes:
[0095] S141, searching for template parameters matching the second type of test parameters in the preset parameter generation template.
[0096] S142: Use the parameter value of the template parameter as the parameter value corresponding to the matching second type test parameter.
[0097] That is, the test parameters frequently used in testing this type of product can be pre-configured in the form of a preset parameter generation template. During testing, the required parameters are directly extracted from the preset parameter generation template, that is, the parameter values corresponding to the second type of test parameters are extracted and then stored.
[0098] In another embodiment of the present application, another method for generating test parameters is disclosed. Figure 3 As shown in the above Figure 1 On the basis of the corresponding embodiment, between step S120 and step S130, the following steps are further included:
[0099] S160, obtaining a deployment parameter list in the software deployment document. The deployment parameter list includes multiple deployment parameters. And
[0100] S170, taking the test parameters in the test parameter set that have matching deployment parameters in the deployment parameter list as first-category test parameters; taking the remaining test parameters in the test parameter set as second-category test parameters.
[0101] The first type of test parameters are test parameters for which there are matching objects in the above deployment parameter list. The second type of test parameters are test parameters for which there are no matching objects in the above deployment parameter list.
[0102] In another embodiment of the present application, another method for generating test parameters is disclosed. Figure 4 As shown in the above Figure 1 Based on the corresponding embodiment, step S110 includes:
[0103] S111, initializing a preset test script template library.
[0104] S112, displaying each test script template in the above test script template library.
[0105] S113, receiving selection instructions for each of the above test script templates, and determining the test script template corresponding to the current test requirement according to the above selection instructions.
[0106] S114, obtaining a test case and a software deployment document, associating each parameter value in the test case with the parameter information in the test script template, and generating a test script file.
[0107] That is, the execution examples in the test cases can be embedded in the test scripts for execution, and a test script file can be generated. In this way, you only need to execute the test scripts, and there is no need to execute the test cases through the test scripts. This makes the testing more efficient and facilitates the implementation of test deployment.
[0108] In another embodiment of the present application, another method for generating test parameters is disclosed. Figure 5 As shown in the above Figure 1 On the basis of the corresponding embodiment, the steps are also included:
[0109] S180: When the number of the second type of test parameters is greater than the number of the first type of test parameters, modify the test parameter configuration file.
[0110] Since the second type of test parameters are indirectly generated through the deployment parameter list, the accuracy of the test parameters is lower than that of the first type of test parameters. Through later correction, it is conducive to ensuring the smooth implementation of automated testing, while also helping to ensure the test pass rate and avoid unnecessary test errors.
[0111] In the specific implementation, the yaml file can be checked and adjusted as needed for the tester to generate the final configuration file. The configuration file of this test can also be modified by referring to the corresponding modification operations in the process of testing the same type of product in the historical test.
[0112] It should be noted that all the above embodiments disclosed in this application can be freely combined, and the technical solutions obtained after the combination are also within the protection scope of this application.
[0113] An embodiment of the present invention also discloses a software testing method. The software testing method comprises the above Figure 1 Based on the corresponding embodiment, the following steps are also included:
[0114] The test script file is executed based on a test parameter configuration file, wherein the test parameter configuration file is generated by the test parameter generation method disclosed in any of the above embodiments.
[0115] In some embodiments, the above steps include:
[0116] Detect the running status of the product equipment, and run the test script file when it is detected that the running status of the equipment is normal. This is conducive to ensuring the smooth implementation of automated testing, and at the same time, it is conducive to ensuring the test pass rate and avoiding unnecessary test errors.
[0117] like Figure 6 As shown, an embodiment of the present invention further discloses a test parameter generation system 6, the system comprising:
[0118] The script and document acquisition module 61 acquires test script files and software deployment documents.
[0119] The test parameter set acquisition module 62 parses the test script file to obtain a test parameter set, which includes a first type of test parameters and a second type of test parameters.
[0120] The first parameter value extraction module 63 obtains parameter values corresponding to the first type of test parameters from the software deployment document.
[0121] The second parameter value extraction module 64 uses a preset parameter generation template to generate parameter values corresponding to the second type of test parameters.
[0122] The parameter configuration file generating module 65 generates a test parameter configuration file based on the above-mentioned first-category test parameters, the above-mentioned second-category test parameters and their corresponding parameter values.
[0123] Specifically, a test script file is a script written for automated testing. When executing software testing, you can execute test cases based on the test script to perform automated testing. You can also embed examples in test cases into the test script, and only execute the test script to achieve automated testing. The writing of the test script corresponds to the corresponding test case.
[0124] In this embodiment, the above-mentioned software deployment document is a written software testing document, which may include a detailed design document (ie, an LLD document), but this application is not limited thereto.
[0125] Among them, the above-mentioned test parameter set can be a test parameter list. The test parameter list contains all the parameters needed for testing, such as the configuration and planning of physical resources such as computing, network, storage, etc. of the cloud network system, system docking parameters, product login parameters, etc. Before performing automated testing, all parameters in the list need to be configured. The parameter values corresponding to all test parameters are recorded in the test parameter configuration file generated subsequently.
[0126] Among them, the parameter values corresponding to the first type of test parameters can be directly or indirectly obtained based on the software deployment document. The parameter values corresponding to the second type of test parameters cannot be directly or indirectly obtained based on the software deployment document. Therefore, in this embodiment, the parameter values corresponding to the second type of test parameters are generated using a preset parameter generation template.
[0127] It can be understood that the test parameter generation system of the present invention also includes other existing functional modules that support the operation of the test parameter generation system. Figure 6 The test parameter generation system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0128] The test parameter generation system in this embodiment is used to implement the above-mentioned test parameter generation method. Therefore, the specific implementation steps of the test parameter generation system can refer to the above-mentioned description of the test parameter generation method, which will not be repeated here.
[0129] In the specific implementation, the parameter values corresponding to the above-mentioned first-category test parameters are obtained from the detailed design document of the software deployment document. For some parameters in the above-mentioned first-category test parameters, the parameter values can be directly obtained from the detailed design document, then the obtained parameter values are extracted and stored, and associated with the part of the parameters in the test parameter configuration file, for example, stored in the form of key-value pairs.
[0130] For another part of the parameters in the first category of test parameters mentioned above, the parameter values cannot be directly obtained from the detailed design document. Only the associated parameters can be obtained from the LLD document. It is necessary to process the associated parameters or calculate based on the parameter values of the associated parameters to obtain the parameter values corresponding to this part of the parameters.
[0131] For the parameters in the above test parameter set and without associated parameters in the LLD document, a preset parameter generation template is pre-configured. When testing, the required parameters are directly extracted from the preset parameter generation template, that is, the parameter values corresponding to the second type of test parameters are extracted and then stored.
[0132] For example, if you need to generate a test virtual machine during testing, you need to configure the test virtual machine's user name, password, host name and other basic information. This information can be pre-configured in the form of a preset parameter generation template, and then you can search for the corresponding template directly according to your needs to obtain the parameters.
[0133] The parameter configuration file generation module 65 can generate an initial configuration file based on the above-mentioned first-category test parameters, the above-mentioned second-category test parameters and their corresponding parameter values; and then format the above-mentioned initial configuration file based on the YAML language to generate a test parameter configuration file.
[0134] For example, a configuration file template can be searched from the configuration file template library, and the above test parameters and corresponding parameter values can be filled into the configuration file template to generate an initial configuration file. YAML is a serialization language used to write configuration files, which is highly readable and facilitates the smooth implementation of automated testing by testers.
[0135] like Figure 7 As shown, in another embodiment of the present application, another test parameter generation system 7 is disclosed. Figure 6 Based on the corresponding embodiment, the first parameter value extraction module 63 includes:
[0136] The first deployment parameter acquisition unit 631 acquires the deployment parameters associated with the first type of test parameters from the software deployment document.
[0137] The deployment parameter processing unit 632 processes the above deployment parameters to obtain parameter values corresponding to the above first type of test parameters.
[0138] Exemplarily, the first type of test parameters include the IP address of the test virtual machine. Step S130 may include: obtaining the service subnet segment corresponding to the software to be tested from the software deployment document. Based on the service subnet segment, generating the IP address of the test virtual machine.
[0139] Specifically, during the automated deployment process, the network segment of the corresponding business subnet is configured, and the subnet segment includes the CIDR (Classless Inter-Domain Routing) and subnet mask of the subnet. If a test virtual machine is required during the test, an IP address needs to be generated during the automated test process for the test virtual machine to communicate in the subnet. In this case, the IP address needs to be calculated using the above-mentioned business subnet segment. Then the above-mentioned IP address is configured in the test parameter configuration file and stored.
[0140] The specific calculation process of obtaining the IP address by using the subnet segment can be implemented with reference to the prior art and will not be described in detail in this embodiment.
[0141] like Figure 8 As shown, in another embodiment of the present application, another test parameter generation system 8 is disclosed. Figure 6 On the basis of the corresponding embodiment, it also includes:
[0142] The deployment parameter list acquisition module 66 acquires the deployment parameter list in the software deployment document. The deployment parameter list includes multiple deployment parameters.
[0143] The test parameter classification module 67 regards the test parameters in the test parameter set that have matching deployment parameters in the deployment parameter list as first-category test parameters; and regards the remaining test parameters in the test parameter set as second-category test parameters.
[0144] The first type of test parameters are test parameters for which there are matching objects in the above deployment parameter list. The second type of test parameters are test parameters for which there are no matching objects in the above deployment parameter list.
[0145] like Fig. 9 As shown, in another embodiment of the present application, another test parameter generation system 9 is disclosed. Figure 6 Based on the corresponding embodiment, the script and document acquisition module 61 includes:
[0146] The preset test script template library obtaining unit 611 initializes the preset test script template library.
[0147] The test script template library display unit 612 displays each test script template in the above test script template library.
[0148] The test script template selection unit 613 receives selection instructions for each of the above test script templates, and determines the test script template corresponding to the current test requirement according to the above selection instructions.
[0149] The test script file generating unit 614 obtains the test case and the software deployment document, associates each parameter value in the test case with the parameter information in the test script template, and generates a test script file.
[0150] like Fig.10 As shown, in another embodiment of the present application, another test parameter generation system 10 is disclosed. Figure 6 On the basis of the corresponding embodiment, it also includes:
[0151] The configuration file modification module 68 modifies the test parameter configuration file when the number of the second type of test parameters is greater than the number of the first type of test parameters.
[0152] Since the second type of test parameters are indirectly generated through the deployment parameter list, the accuracy of the test parameters is lower than that of the first type of test parameters. Through later correction, it is conducive to ensuring the smooth implementation of automated testing, while also helping to ensure the test pass rate and avoid unnecessary test errors.
[0153] In the specific implementation, the yaml file can be checked and adjusted as needed for the tester to generate the final configuration file. The configuration file of this test can also be modified by referring to the corresponding modification operations in the process of testing the same type of product in the historical test.
[0154] It should be noted that all the above embodiments disclosed in this application can be freely combined, and the technical solutions obtained after the combination are also within the protection scope of this application.
[0155] An embodiment of the present invention further discloses a test parameter generation device, including a processor and a memory, wherein the memory stores an executable program of the processor; the processor is configured to execute the steps in the above-mentioned test parameter generation method by executing the executable program. Fig.11 Schematic diagram of the structure of the test parameter generation device disclosed in the present invention. Fig.11 The electronic device 600 according to this embodiment of the present invention is described. Fig.11 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0156] like Fig.11 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.
[0157] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of various exemplary embodiments of the present invention described in the above-mentioned test parameter generation method part of this specification. For example, the processing unit 610 can execute the following steps: Figure 1 Follow the steps shown in .
[0158] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0159] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0160] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0161] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.
[0162] The present invention also discloses a computer-readable storage medium for storing a program, which implements the steps in the above-mentioned method for generating test parameters when executed. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present invention described in the above-mentioned method for generating test parameters in this specification.
[0163] As shown above, when the program of the computer-readable storage medium of this embodiment is executed, the test script is parsed to obtain a test parameter list, that is, all the parameters needed for testing; then the values corresponding to different types of parameters are obtained from the software deployment document and the preset parameter generation template, respectively, to achieve rapid and automatic generation of test parameter configuration files, which is beneficial to improving the testing efficiency of testers and thus facilitating the rapid delivery of products.
[0164] An embodiment of the present invention discloses a computer-readable storage medium. The storage medium is a program product for implementing the above method, which can be a portable compact disk read-only memory (CD-ROM) and includes program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0165] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable 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.
[0166] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0167] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0168] The test parameter generation method, system, device, medium and software testing method provided in the embodiments of the present invention parse the test script to obtain a test parameter list, that is, all the parameters required for testing; then obtain the values corresponding to different types of parameters from the software deployment document and the preset parameter generation template, so as to realize rapid and automatic generation of test parameter configuration files, which is beneficial to improving the testing efficiency of testers and thus facilitating the rapid delivery of products.
[0169] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.
Claims
1. A method for generating test parameters, characterized in that: The following steps are involved: Obtain test script files and software deployment documents; Parsing the test script file to obtain a test parameter set; the test parameter set includes a first type of test parameters and a second type of test parameters; Obtaining a deployment parameter list in the software deployment document; The deployment parameter list includes multiple deployment parameters; the test parameters in the test parameter set that have matching deployment parameters in the deployment parameter list are used as first-category test parameters; the remaining test parameters in the test parameter set are used as second-category test parameters; the first-category test parameters include the IP address of the test virtual machine, and the business subnet segment corresponding to the software to be tested is obtained from the software deployment document; based on the business subnet segment, the IP address of the test virtual machine is generated; The preset parameter generation template includes different pre-configured template parameters and corresponding parameter values; searching the preset parameter generation template for template parameters that match the second type of test parameters; and using the parameter values of the template parameters as the parameter values corresponding to the matched second type of test parameters; A test parameter configuration file is generated based on the first category of test parameters, the second category of test parameters and their corresponding parameter values.
2. The method for generating test parameters according to claim 1, characterized in that: The obtaining of the test script file and software deployment document includes: Initialize the preset test script template library; Displaying each test script template in the test script template library; Receiving selection instructions for each of the test script templates, and determining the test script template corresponding to the current test requirement according to the selection instructions; A test case is obtained, and each parameter value in the test case is associated with the parameter information in the test script template to generate a test script file.
3. The method for generating test parameters according to claim 1, characterized in that: The software deployment document includes a detailed design document; and obtaining parameter values corresponding to the first type of test parameters from the software deployment document includes: Obtain parameter values corresponding to the first type of test parameters from the detailed design document.
4. The method for generating test parameters according to claim 1, characterized in that: The method further comprises the steps of: When the number of the second-category test parameters is greater than the number of the first-category test parameters, the test parameter configuration file is modified.
5. The method for generating test parameters according to claim 1, characterized in that: The generating a test parameter configuration file based on the first type of test parameters, the second type of test parameters and their corresponding parameter values includes: Generate an initial configuration file based on the first type of test parameters, the second type of test parameters and their corresponding parameter values; The initial configuration file is formatted in YAML language to generate a test parameter configuration file.
6. A software testing method, characterized in that: The method comprises the steps of: Based on the test parameter configuration file, the test script file is executed; the test parameter configuration file is generated by the test parameter generation method described in any one of claims 1 to 5.
7. A test parameter generation system, used to implement the test parameter generation method according to claim 1, characterized in that: The system comprises: Script and document acquisition module, which acquires test script files and software deployment documents; A test parameter set acquisition module parses the test script file to obtain a test parameter set; the test parameter set includes a first type of test parameters and a second type of test parameters; The first parameter value extraction module obtains a deployment parameter list in the software deployment document; the deployment parameter list includes multiple deployment parameters; the test parameters in the test parameter set that have matching deployment parameters in the deployment parameter list are used as first-category test parameters; the remaining test parameters in the test parameter set are used as second-category test parameters; the first-category test parameters include a test virtual machine IP address, and the business subnet segment corresponding to the software to be tested is obtained from the software deployment document; based on the business subnet segment, the IP address of the test virtual machine is generated; A second parameter value extraction module, wherein the preset parameter generation template includes different pre-configured template parameters and corresponding parameter values; searching the preset parameter generation template for template parameters that match the second type of test parameters; and using the parameter values of the template parameters as the parameter values corresponding to the matched second type of test parameters; and A parameter configuration file generating module generates a test parameter configuration file based on the first category test parameters, the second category test parameters and their corresponding parameter values.
8. A test parameter generation device, characterized in that: include: processor; a memory in which an executable program of the processor is stored; The processor is configured to execute the steps of the method for generating test parameters according to any one of claims 1 to 5 by executing the executable program.
9. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the method for generating test parameters described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Parameter generation method and device for test case and terminal equipment
CN111338958A
Test data generation method and device
CN113342647A
System and method for testing application code
US20130055213A1
