Automatic test method, electronic equipment and storage medium
Through the automatic testing method, the configuration information of the device to be tested and the configuration parameters entered by the user on the target page are obtained, and the command line configuration operation instructions are generated, which solves the problem that testers in the existing technology need to conduct command line and WEBUI tests at the same time, and realizes the Efficient automated testing.
Patent Information
- Application Number
- CN202411705808.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-02-18
AI Technical Summary
In the prior art, testers need to test the command line and WEBUI at the same time, which is cumbersome and inefficient.
Provide an automatic testing method, by obtaining the configuration information of the device to be tested and the configuration parameters entered by the user on the target page, determining the command line configuration format corresponding to the configuration parameters, generating command line configuration operation instructions, and realizing command line configuration of the device to be tested test.
It realizes automatic synchronization of WEBUI tests, simplifies the test process, improves testing efficiency, and avoids missed testing problems caused by waste of resources and human operation errors.
Smart Images

Figure CN119473907A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of command line testing, and in particular to an automatic testing method, electronic equipment and storage medium. Background Art
[0002] At present, mainstream online behavior management products provide multiple management methods. Common management methods are: 1. Web User Interface (WEBUI) management method, that is, access the network address of the Internet behavior management product through a browser, and perform relevant configuration operations on the Internet behavior management product through page visualization graphics.
[0003] 2. Command Line Interface (CLI) management method, that is, connecting to the Internet behavior management product through the telnet protocol, ssh protocol, or console serial port, and performing relevant configuration operations on the Internet behavior management product through command line operations.
[0004] Therefore, all functions in the Internet behavior management product can be operated and configured through the WEBUI or command line. In daily testing work, testers need to perform the same test on the command line in addition to testing one of the functions of the Internet behavior management product in the WEBUI. Otherwise, the function can only be operated in the WEBUI and cannot be operated through the command line, or there will be some failures in the command line operation, resulting in management failure. Manual testing of the command line and WEBUI at the same time is cumbersome and inefficient. Summary of the invention
[0005] In view of this, it is necessary to provide an automatic testing method, an electronic device and a storage medium to solve the problem of manual testing of command lines and WEBUI at the same time in the prior art, which is cumbersome and inefficient.
[0006] In order to solve the above problems, in a first aspect, the present invention provides an automatic testing method, comprising: Acquire first configuration information and second configuration information of a device under test and configuration parameters input when performing a configuration operation on the device under test through a target page of the device under test; wherein the first configuration information includes the configuration of the device under test before the configuration operation; and the second configuration information includes the configuration of the device under test after the configuration operation; Determining a command line configuration format corresponding to the configuration parameter according to a difference between the second configuration information and the first configuration information; Generate a command line configuration operation instruction according to the configuration parameters and the command line configuration format; A command line configuration test is performed on the device to be tested according to the command line configuration operation instruction.
[0007] Optionally, the acquiring of configuration parameters input when performing a configuration operation on the device to be tested through a target page of the device to be tested includes: Acquire a first operation action of a user on a target page of the device to be tested, and perform a first match between the first operation action and a preset first operation action list; If the first matching is successful, start receiving the configuration parameters input by the user, obtain the second operation action of the user on the target page of the device to be tested, and perform a second matching between the second operation action and a preset second operation action list; If the second match is successful, then stop receiving the configuration parameters input by the user.
[0008] Optionally, determining a command line configuration format corresponding to the configuration parameter according to a difference between the second configuration information and the first configuration information includes: When the configuration operation is completed, obtaining configuration operation result information displayed on the page of the device to be tested; the configuration operation result information includes operation success or operation failure; When the configuration operation result information indicates that the operation is successful, a command line configuration format corresponding to the configuration parameter is determined according to a difference between the second configuration information and the first configuration information.
[0009] Optionally, the method further includes: After obtaining the configuration operation result information, determining whether the second configuration information is different from the first configuration information; When the configuration operation result information indicates that the operation is successful, and there is no difference between the second configuration information and the first configuration information, or when the configuration operation result information indicates that the operation is failed, and there is a difference between the second configuration information and the first configuration information, it is determined that there is a fault in the configuration operation; Generates fault prompt information.
[0010] Optionally, the configuration operation includes multiple times, and each configuration operation type is the same; when the configuration operation result information indicates that the operation is successful, determining the command line configuration format corresponding to the configuration parameter according to the difference between the second configuration information and the first configuration information includes: The configuration operation when the configuration operation result information is successful is used as the target configuration operation; Determining a command line configuration format corresponding to the configuration parameter according to a difference between the first target configuration information obtained before the target configuration operation and the second target configuration information obtained after the target configuration operation; Generating a command line configuration operation instruction according to the configuration parameters and the command line configuration format includes: Generating a plurality of groups of command line configuration operation instructions respectively according to the configuration parameters of each configuration operation and the command line configuration format; The performing a command line configuration test on the device to be tested by using the command line configuration operation instruction includes: Perform multiple groups of command line configuration tests on the devices to be tested respectively according to the multiple groups of command line configuration operation instructions.
[0011] Optionally, the method further includes: The configuration parameters of each configuration operation are associated with the command line configuration format.
[0012] Optionally, the method further includes: Generate at least one set of supplementary configuration parameters by learning the configuration parameters of each configuration operation; Generate at least one set of supplementary command line configuration operation instructions according to the at least one set of supplementary configuration parameters and the command line configuration format; A command line configuration test is performed on the device to be tested according to the supplementary command line configuration operation instruction.
[0013] Optionally, the method further includes: After the user logs in to the device to be tested, the operation navigation information of the user on the page of the device to be tested is obtained in real time; When the first matching is successful, stop acquiring the operation navigation information; When the command line configuration test is completed, a command line test report is generated; the command line test report includes a target access path of the target page, and the target access path is generated according to the operation navigation information.
[0014] In a second aspect, the present invention further provides an electronic device comprising a memory and a processor, wherein the memory is used to store programs; the processor is coupled to the memory and is used to execute the programs stored in the memory to implement the steps in any one of the automatic testing methods described above.
[0015] In a third aspect, the present invention further provides a computer-readable storage medium for storing a computer-readable program, wherein the program or instructions, when executed by a processor, can implement the steps in any one of the above-mentioned automatic testing methods.
[0016] The beneficial effects of the present invention are: The present invention monitors the configuration operation of the user on the target page, and obtains the first configuration information of the device to be tested before the configuration operation, the second configuration information of the device to be tested after the configuration operation, and the configuration parameters input by the user when performing the configuration operation on the device to be tested through the target page of the device to be tested; according to the difference between the second configuration information and the first configuration information, the command line configuration format corresponding to the configuration parameter is determined; according to the configuration parameter and the command line configuration format, a command line configuration operation instruction is generated; and according to the command line configuration operation instruction, a command line configuration test of the device to be tested is implemented. That is, according to the configuration operation test (WEBUI test) performed by the user on the target page, the command line test can be synchronously and automatically implemented.
[0017] Through automated command line testing, we can effectively avoid missed tests due to lack of experience or human errors, and improve the quality of testing. It can greatly simplify the current complex testing process, reduce repetitive work, greatly improve testing efficiency, and avoid waste of resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of a flow chart of an embodiment of the automatic testing method provided by the present invention; Figure 2 A schematic diagram of a target page provided by the present invention; Figure 3 A flowchart of another embodiment of the automatic testing method provided by the present invention. DETAILED DESCRIPTION
[0019] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0020] In the description of the embodiments of the present invention, unless otherwise specified, "multiple" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0021] The terms "first", "second", etc., involved in the embodiments of the present invention are used to distinguish similar objects, but are not used to describe a specific order or sequence, nor are they used to indicate or imply their relative importance or implicitly indicate the number of technical features indicated. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more.
[0022] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0023] Although the WEBUI operation and the command line operation can ultimately achieve the same configuration operation, the configuration delivery principles are different: WEBUI is configured through HTML and sent to the xmld process of the device, so that the WEBUI configuration is successfully sent; the command line is sent to the vty process of the device after the command line operation, so that the command line configuration is successfully sent.
[0024] Although both can implement the same configuration delivery, the configuration delivery principles are different. Therefore, during daily testing, testers need to take into account both WEBUI configuration delivery testing and command line configuration delivery testing to prevent the situation where the function can only be operated in the WEBUI and cannot be operated through the command line, or that there are some bugs in the command line operation that cause management failure.
[0025] Under the existing technology, testers have the following problems when testing new functions: 1. You need to retest the content items that have been tested in WEBUI in the command line; 2. Single parameter range testing in command line testing is more complicated than testing in WEBUI; 3. Currently, there are tens of thousands of actionable items on the Internet behavior management product page, and coverage testing is very labor-intensive; 4. After the command line operation configuration is completed, it is usually necessary to verify whether the configuration is correct through WEBUI.
[0026] In view of the above problems, the present invention proposes an automatic testing method to overcome the above problems.
[0027] Reference Figure 1, shows a flow chart of an embodiment of the automatic testing method provided by the present invention, the method comprising: S101, obtaining first configuration information and second configuration information of a device to be tested and configuration parameters input when performing a configuration operation on the device to be tested through a target page of the device to be tested; wherein the first configuration information includes the configuration of the device to be tested before the configuration operation; and the second configuration information includes the configuration of the device to be tested after the configuration operation.
[0028] The present invention can be implemented by an automatic testing tool, which can be an automatic testing application program or an automatic testing device.
[0029] The device to be tested may be a device that requires both WEBUI testing and command line testing, for example, an Internet behavior management device.
[0030] When a user logs in to the device under test, the automatic test tool can execute the displayrunning command in the command line to obtain the first configuration information of the device under test before the configuration operation starts. After obtaining the first configuration information, the first configuration information can be stored in default_config.
[0031] After the user logs in to the device under test, he can jump to the target page of the device under test through the navigation link, and enter the configuration parameters on the target page to perform configuration operations on the device under test. The target page can be a page that can perform configuration operations on the device under test.
[0032] When it is detected that the user is performing or has completed a configuration operation, the automatic test tool can obtain the configuration parameters input by the user, and when it is detected that the user has completed a configuration operation, the automatic test tool can execute the display running command again on the command line to obtain the second configuration information of the device to be tested after the configuration operation is completed. After obtaining the second configuration information, the second configuration information can be stored in running_config.
[0033] S102: Determine a command line configuration format corresponding to the configuration parameter according to a difference between the second configuration information and the first configuration information.
[0034] When the operation is successful, the configuration of the device to be tested will change. Therefore, by comparing the difference between the second configuration information and the first configuration information, the command line configuration operation information corresponding to the above configuration operation can be obtained; the command line configuration operation information includes variables and parameters. The command line configuration format can be obtained according to the variables and parameters.
[0035] For example, by comparing the second configuration information with the first configuration information, it is found that the difference between the second configuration information and the first configuration information is as follows: address new_address description right_address ip subnet 1.1.1.0 / 24 ip range 2.1.1.1 2.1.1.200 ip address 3.1.1.1 ip domain www.test.com exclude ip address 4.1.1.1 Taking address new_address as an example, address is a variable and new_address is a parameter. According to the above differences, the command line configuration format can be determined as: "name=address [parameter]" "description=description [parameter]" "network=ip subnet [parameter]" "range=ip range [parameter]" "host=ipaddress [parameter]" "domain=ip domain [parameter]" "conf_exclude_hidden=exclude ipaddress [parameter]".
[0036] S103, generating a command line configuration operation instruction according to the configuration parameters and the command line configuration format.
[0037] Substitute the configuration parameters into the command line configuration format. For example, substitute the configuration parameters into the corresponding position of [parameter] in the above command line configuration format to generate the command line configuration operation instruction.
[0038] S104: Perform a command line configuration test on the device to be tested according to the command line configuration operation instruction.
[0039] Run the command line configuration operation instructions to perform command line configuration test on the device to be tested.
[0040] The present invention monitors the configuration operation of the user on the target page, and obtains the first configuration information of the device to be tested before the configuration operation, the second configuration information of the device to be tested after the configuration operation, and the configuration parameters input by the user when performing the configuration operation on the device to be tested through the target page of the device to be tested; according to the difference between the second configuration information and the first configuration information, the command line configuration format corresponding to the configuration parameter is determined; according to the configuration parameter and the command line configuration format, a command line configuration operation instruction is generated; and according to the command line configuration operation instruction, a command line configuration test of the device to be tested is implemented. That is, the command line test can be synchronously and automatically implemented according to the user's WEBUI test.
[0041] Through automated command line testing, we can effectively avoid missed tests due to lack of experience or human errors, and improve the quality of testing. It can greatly simplify the current complex testing process, reduce repetitive work, greatly improve testing efficiency, and avoid waste of resources.
[0042] In one embodiment, S101 may specifically include: obtaining a first operation action of a user on a target page of the device to be tested, and performing a first matching of the first operation action with a preset first operation action list; if the first matching is successful, starting to receive configuration parameters input by the user, and obtaining a second operation action of the user on the target page of the device to be tested, and performing a second matching of the second operation action with a preset second operation action list; if the second matching is successful, stopping receiving configuration parameters input by the user.
[0043] When the first match succeeds, it is determined that the user has started to configure the device to be tested, and the configuration parameters input by the user can be received at this time. When the second match succeeds, it is determined that the user has completed the configuration operation of the device to be tested, and the configuration parameters input by the user can be stopped at this time.
[0044] For example, the first operation action list may include operation actions such as "create", "edit", "delete", "submit", "enable", "disable" and "move", etc. The second operation action list may include operation actions such as "submit".
[0045] When the user's first operation action on the target page is a "new" action, the first operation action matches the operation actions in the first operation action list, and the configuration parameters input by the user can be received at this time. After starting to receive the configuration parameters input by the user, the user's second operation action can be obtained. When the second operation action is a "submit" action, the second operation action matches the operation actions in the second operation action list, and the configuration parameters input by the user can be stopped at this time.
[0046] In one embodiment, S104 may specifically include: when the configuration operation is completed, obtaining configuration operation result information displayed on the page of the device to be tested; the configuration operation result information includes operation success or operation failure; when the configuration operation result information is that the operation is successful, determining the command line configuration format corresponding to the configuration parameters based on the difference between the second configuration information and the first configuration information.
[0047] When the configuration operation is completed, for example, when the user performs a "submit" action, the configuration operation result information will be displayed on the page of the device to be tested, and the configuration operation result information includes whether the operation is successful or failed. When the configuration operation result information indicates that the operation is successful, the second configuration information will be different from the first configuration information. At this time, the command line configuration format corresponding to the configuration parameter can be determined based on the difference between the second configuration information and the first configuration information.
[0048] When the configuration operation result information indicates that the operation failed, the second configuration information will not be different from the first configuration information, and S104 does not need to be performed at this time.
[0049] In one embodiment, the automatic testing method also includes: after obtaining the configuration operation result information, determining whether there is a difference between the second configuration information and the first configuration information; when the configuration operation result information is that the operation is successful, and there is no difference between the second configuration information and the first configuration information, or when the configuration operation result information is that the operation fails, and there is a difference between the second configuration information and the first configuration information, determining that there is a fault in the configuration operation; at this time, a fault prompt information can be generated to prompt the user, and the configuration parameters used by the faulty configuration operation are not used to substitute into the command line configuration format to generate command line configuration operation instructions.
[0050] When the configuration operation result information indicates that the operation is successful and there is a difference between the second configuration information and the first configuration information, or when the configuration operation result information indicates that the operation fails and there is no difference between the second configuration information and the first configuration information, it is determined that there is no fault in the configuration operation. When it is determined that there is no fault in the configuration operation, S104 can be performed normally.
[0051] In one embodiment, the configuration operation includes multiple times, and each configuration operation type is the same; when the configuration operation result information indicates that the operation is successful, the step of determining the command line configuration format corresponding to the configuration parameter according to the difference between the second configuration information and the first configuration information may specifically include: The configuration operation when the configuration operation result information is successful is used as the target configuration operation; The command line configuration format corresponding to the configuration parameter is determined according to a difference between the target first configuration information obtained before the target configuration operation and the target second configuration information obtained after the target configuration operation.
[0052] When the configuration operation result information indicates that the operation failed, there is no difference between the second configuration information and the first configuration information, and the command line configuration format corresponding to the configuration parameter cannot be determined according to the second configuration information and the first configuration information.
[0053] Therefore, in this embodiment, only when the configuration operation result information indicates that the operation is successful, the configuration operation with the successful operation is used as the target configuration operation, and the command line configuration format corresponding to the configuration parameters is determined based on the difference between the target first configuration information obtained before the target configuration operation and the target second configuration information obtained after the target configuration operation.
[0054] The configuration operation includes multiple times. Because their types are the same, no matter whether the configuration operation result information corresponding to the configuration operation is a success or a failure, the corresponding command line configuration format is the same. Therefore, among multiple configuration operations of the same type, as long as there is a target configuration operation among the multiple configuration operations, the command line configuration format corresponding to the configuration parameters of each configuration operation can be determined according to the difference between the target first configuration information obtained before the target configuration operation and the target second configuration information obtained after the target configuration operation.
[0055] The same type may refer to the same object and the same operation items on the object. For example, multiple configuration operations of the same type may all be new operations on address objects, and the difference between multiple configuration operations of the same type is only that the configuration parameters of the address object are different, such as different configured domain names, network addresses, etc.
[0056] In this embodiment, the step of generating command line configuration operation instructions according to the configuration parameters and the command line configuration format may specifically include: generating multiple groups of command line configuration operation instructions respectively according to the configuration parameters and the command line configuration format of each configuration operation. And the step of performing command line configuration test on the device to be tested through the command line configuration operation instructions may specifically include: performing multiple groups of command line configuration tests on the device to be tested respectively according to the multiple groups of command line configuration operation instructions.
[0057] In one embodiment, the automatic testing method may further include: associating the configuration parameters of each configuration operation with the command line configuration format so as to generate command line configuration operation instructions based on the configuration parameters of each configuration operation and the command line configuration format, and so that the automatic testing tool can learn the configuration parameters of each configuration operation of the same type.
[0058] In one embodiment, the automatic testing method may also include: generating at least one set of supplementary configuration parameters by learning the configuration parameters of each configuration operation; generating at least one set of supplementary command line configuration operation instructions based on the at least one set of supplementary configuration parameters and the command line configuration format; and performing a command line configuration test on the device to be tested based on the supplementary command line configuration operation instructions.
[0059] The automatic testing tool can learn the configuration parameters of each configuration operation, obtain the configuration range of the configuration parameters, and generate supplementary configuration parameters based on the configuration range.
[0060] In one embodiment, the automatic testing method may also include: when the user logs in to the device to be tested, obtaining the user's operation navigation information on the page of the device to be tested in real time; when the first match is successful, stop obtaining the operation navigation information; when the command line configuration test is completed, generate a command line test report; the command line test report includes the target access path of the target page, and the target access path is generated according to the operation navigation information.
[0061] The operation navigation information may include page access records, user operation information on the page, etc. Before the first match is successful, the user's operation navigation information on the page of the device to be tested may be obtained in real time. After the first match is successful, the user's operation navigation information on the page of the device to be tested may be stopped from being obtained, and the configuration parameters input by the user may be obtained instead.
[0062] To facilitate understanding of the present invention, a complete embodiment is used below to illustrate the solution of the present invention.
[0063] Step 1: The automatic test tool uses webdriver to automatically open the browser and access the device under test according to the IP address of the device under test. The automatic test tool logs into the device under test according to the username / password. After the automatic test tool detects that a tester is using and correctly connecting to the device under test, it executes the display running command in the command line to obtain the first configuration information of the device under test and stores the first configuration information in the default_config information.
[0064] Step 2: After the tester successfully logs in to the device to be tested, the automatic testing tool begins to capture the tester's operation navigation information on the page and stores the operation navigation information in the Main_content list to record the target navigation location (the access path of the target page).
[0065] 1. The tester enters the target page by clicking the navigation link with the mouse. The automatic testing tool can obtain the root node information of the target page through the clicked HTML page: For example, the root node information is: Policy Configuration .
[0066] After the automatic test tool reads the page information of the device to be tested, it automatically stores the text content in the read information in the Main_content list: Main_content={ Policy Configuration} 2. Then, the tester clicks on the left tree content information, and the automatic testing tool can obtain the left tree information of the target page through the clicked HTML page: Address Object 3. The automatic testing tool combines the obtained root node information with the left tree information to generate the access path of the target page: For example, the access path is: Main_content_ test(address object)={'Policy configuration' 'Address object'} The access path of the target page is used to display in the test report generated after the command line configuration test is completed.
[0067] Step 3: After the tester enters the target page, he performs a normal WEBUI test, and the automatic testing tool captures the WEBUI test information. In this embodiment, the target page is the management page of the address object, and the WEBUI test is a new test of the address object.
[0068] 1. In the automatic test tool, there is a default matching operation object match_object = ['New', 'Edit', 'Delete', 'Submit', 'Enable', 'Disable', 'Move'], etc. When the tester performs a new test of the address object through the target page, the tester clicks the New button, and the automatic test tool can obtain the target page operation information through the clicked HTML page (consistent with step 2). For example, the target page operation information is: New Type: button; Text content is: New; The automatic test tool gets the text content and compares it with the list of matching operation objects one by one. If the comparison is successful, it is determined that the current button click is to prepare for the configuration operation test, and the subsequent operation is the configuration delivery of the test object. At this time, the recording of the operation navigation information of step 2 is ended, and the configuration delivery content is ready to be received. If the comparison fails, it is determined that the current configuration operation test is not being prepared, but other operations are being performed. After loading the text content into Main_content_ test (address object) = {'Policy configuration' 'Address object' 'Address group object'}, wait for the operation again and re-match the operation object.
[0069] Taking the successful comparison as an example, the current operation information is stored in the operation_content list: Operation_content={'Operation type': 'New'} And start to receive configuration parameters until the tester clicks the "Submit" button to send the configuration (the method is similar to clicking the New button mentioned above), then end the configuration parameter reception and obtain the page pop-up box information "Operation failed, operation successful".
[0070] The WEBUI test information captured by the automatic test tool includes forward test information and reverse test information. Forward test information refers to the page pop-up box information (configuration operation test result) for the configuration operation that is successful, and reverse test information refers to the page pop-up box information for the configuration operation that is failed. After being obtained, the forward test information and reverse test information can be incrementally stored in the operation_content list.
[0071] For example: Operation_content={ 'Operation Type': 'New' 'Operation content': ' name=address_name&description=address_des&network=1.1.1.0 / 33&range=2.1.1.1-2.1.1.100&host=3.1.1.1&domain= www.test.com&conf_exclude_hidden=4.1.1.1' 'Operation result': 'Operation failed' } Operation_content={ 'Operation Type': 'New' 'Operation content': ' name=address_name&description=address_des&network=1.1.1.0 / 24&range=2.1.1.1-2.1.1.100&host=3.1.1.1&domain= www.test.com&conf_exclude_hidden=4.1.1.1' 'Operation result': 'Operation successful' } 2. Regardless of whether the collected operation result is: operation success or operation failure, after the current operation information is collected, execute the display running command on the command line to obtain the current running configuration file running_config, and compare the default_config in step 1 with the running_config: ①. If default_config is exactly the same as running_config, it means that the configuration delivery failed, and the corresponding operation result in Operation_content must be operation failure, otherwise it is considered that there is a bug.
[0072] ② If default_config is inconsistent with running_config, it means that the configuration is successfully delivered, and the corresponding operation result in operation_content must be successful, otherwise it is considered that there is a bug. If the configuration is successfully delivered, the inconsistent content in default_config and running_config is filtered out and stored in Difference_value.
[0073] For example, the inconsistencies are: address address_name description address_des ip subnet 1.1.1.0 / 24 ip range 2.1.1.1 2.1.1.200 ip address 3.1.1.1 ip domain www.test.com exclude ip address 4.1.1.1 Step 4: Determine the command line configuration format based on Difference_value.
[0074] 1. Use the collection information whose operation result in operation_content is successful; Operation_content={ 'Operation Type': 'New' 'Operation content': ' name=address_name&description=address_des&network=1.1.1.0 / 24&range=2.1.1.1-2.1.1.100&host=3.1.1.1&domain= www.test.com&conf_exclude_hidden=4.1.1.1' 'Operation result': 'Operation successful' } 2. Filter out the operation content in operation_content and get: name=address_name&description=address_des&network=1.1.1.0 / 24&range=2.1.1.1-2.1.1.100&host=3.1.1.1&domain= www.test.com&conf_exclude_hidden=4.1.1.1& 3. Extract the data between = and & in the filtered operation content, which is the configuration parameter value of the WEBUI test. Compare the configuration parameter value with Difference_value line by line to obtain the command line configuration format of the configuration parameter: For example: In name=address_name&, value is address_name. The configuration command in different_value is: address address_name. Delete the value of the command. The remaining "address" represents the configuration command address [parameter]. That is, you can get the configuration method of the configuration parameter in the command line: "address [parameter]" Similarly, the command line configuration format of other configuration parameters is obtained in the above way, and the result is: parameter_infor = "name=address [parameter]" "description=description [parameter]" "network=ipsubnet [parameter]" "range=ip range [parameter]" "host=ip address [parameter]" "domain=ipdomain [parameter]" "conf_exclude_hidden=exclude ip address [parameter]" Step 5: Generate command line configuration operation instructions according to the configuration parameters and command line configuration format, and perform command line configuration test on the device to be tested according to the command line configuration operation instructions.
[0075] After obtaining the command line configuration format corresponding to the configuration parameters, associate the above collected operation_content with parameter_infor, and fill the configuration parameters in operation_content into the [parameters] of parameter_infor, so that forward and reverse test data can be sent to the device to be tested: For example: clitest={ 'Operation Type': 'New' 'Operation content': 'address address_name, description address_des, ip subnet 1.1.1.0 / 24, iprange 2.1.1.1 2.1.1.200, ip address 3.1.1.1, ip domain www.test.com, exclude ipaddress 4.1.1.1' 'Operation result': 'Operation successful' } { 'Operation Type': 'New' 'Operation content': 'address address_name, description address_des, ip subnet 1.1.1.0 / 33, iprange 2.1.1.1 2.1.1.200, ip address 3.1.1.1, ip domain www.test.com, exclude ipaddress 4.1.1.1' 'Operation result': 'Operation failed' } Adapt the test data to the command line to get: Test_cli=[ 'new', 'address new_address', 'description error _address', 'ipsubnet 1.1.1.0 / 33', 'operation failed' 'new', 'address new_address', 'description error _address', 'ipsubnet 1.1.1.0 / 0', 'operation failed' 'new', 'address new_address', 'description error _address', 'ipsubnet', 'operation failed' 'new', 'address new_address', 'description error _address', 'ipsubnet 256.1.1.0 / 0', 'operation failed' 'new', 'address new_address', 'description error _address', 'ipsubnet 1.1.@.0 / 24', 'operation failed' 'New', 'address new_address', 'description right _address', 'ipsubnet 1.1.1.0 / 24', 'Operation successful' 'New', 'address new_address', 'description right _address', 'ipsubnet 1.1.1.1 / 32', 'Operation successful' ] The automatic testing tool can perform command line testing in full accordance with the WEBUI configuration method, and the command line test results must be consistent with the WEBUI test results.
[0076] Step 6: Automatic testing is based on autonomous learning of configuration parameters.
[0077] After the automatic test tool obtains all the reverse and forward configuration parameters, it can obtain the configuration range of all configuration parameters. The automatic test tool can automatically generate divergent command line test solutions through self-learning, so as to perform command line testing more reliably. It can also resolve the problems of missed tests and inaccurate tests that are prone to occur in the existing manual testing process, and effectively improve the accuracy of the test results. For example: Config_variables=[ 'new', 'new_address', 'error_address', '1.1.1.0 / 33', 'Operation failed', 'new', 'new_address', 'error_address', '1.1.1.0 / 0', 'Operation failed', 'new', 'new_address', 'error_address', '', 'Operation failed', 'new', 'new_address', 'error_address', '256.1.1.0 / 0', 'Operation failed', 'new', 'new_address', 'error_address', '1.1.@.0 / 24', 'Operation failed', 'new', 'new_address', 'right _address', '1.1.1.0 / 24', 'Operation successful', 'New', 'new_address', 'right _address', '1.1.1.1 / 32', 'Operation successful', ] Self-learning parameter range: 1. Input range 1-32 characters; 2. Mask range 1-32; 3. IP address range 1-255; 4. Special characters are not allowed; Automatically generate divergent command line test scenarios: Config_variables_ai=[ 'New', 'new_address', 'error_address', '1.1.1.0 / 2', 'Operation successful', 'New', 'new_address', 'error_address', '1.1.1.0 / 3', 'Operation successful', 'New', 'new_address', 'error_address', '1.1.1.0 / 4', 'Operation successful', 'new', 'new_address', 'error_address', '1.1.1.! / 4', 'Operation failed', 'New', 'new_address', 'error_address', '100.1.1.1 / 10', 'Operation successful', ] Step 7: Generate a test report.
[0078] The test report can include the access path of the target page, WEBUI test results, command line test results, etc.
[0079] The beneficial effects of this embodiment include: 1. This automatic testing tool combines WEB configuration request with command line operation to ensure that all test content information of front-end page test and back-end command line test are completely consistent. It effectively avoids the situation that testers miss tests due to lack of experience or human error.
[0080] 2. It greatly simplifies the current complex test process, reduces repetitive work, greatly improves the work efficiency of the overall test team, and avoids waste of resources. At the same time, it fundamentally solves the problem of manual operation errors caused by repeated switching.
[0081] 3. It effectively reduces the complexity of existing tests and reduces manual intervention. The complex, difficult and problematic operations are completed by automatic testing tools, which further reduces the cost and resource consumption of manual testing and effectively improves the quality of testing.
[0082] 4. Successfully solved the dilemma of subsequent maintenance. When full coverage testing is required again in the future, the command line test content obtained from the previous test analysis can be directly reused, which not only ensures the consistency of the test results, but also resolves the problems of missed tests and inaccurate tests that are prone to occur in the existing manual testing process, and effectively improves the accuracy of the test results.
[0083] 5. Through patented self-learning and automatic generation of command line test solutions, the test coverage is effectively expanded, the test investment resources are maximized, and the test efficiency is improved.
[0084] In one embodiment, the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the steps of any one of the automatic testing methods described above are implemented.
[0085] In one embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor, the steps of any one of the automatic testing methods described above are implemented.
[0086] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0087] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. An automatic testing method, characterized in that: include: Acquire first configuration information and second configuration information of a device under test and configuration parameters input when performing a configuration operation on the device under test through a target page of the device under test; wherein the first configuration information includes the configuration of the device under test before the configuration operation; and the second configuration information includes the configuration of the device under test after the configuration operation; Determining a command line configuration format corresponding to the configuration parameter according to a difference between the second configuration information and the first configuration information; Generate a command line configuration operation instruction according to the configuration parameters and the command line configuration format; A command line configuration test is performed on the device to be tested according to the command line configuration operation instruction.
2. The automatic testing method according to claim 1, characterized in that: The obtaining of the configuration parameters input when the configuration operation is performed on the device to be tested through the target page of the device to be tested includes: Acquire a first operation action of a user on a target page of the device to be tested, and perform a first match between the first operation action and a preset first operation action list; If the first matching is successful, start receiving the configuration parameters input by the user, obtain the second operation action of the user on the target page of the device to be tested, and perform a second matching between the second operation action and a preset second operation action list; If the second match is successful, then stop receiving the configuration parameters input by the user.
3. The automatic testing method according to claim 1, characterized in that: The determining, according to the difference between the second configuration information and the first configuration information, a command line configuration format corresponding to the configuration parameter includes: When the configuration operation is completed, obtaining configuration operation result information displayed on the page of the device to be tested; the configuration operation result information includes operation success or operation failure; When the configuration operation result information indicates that the operation is successful, a command line configuration format corresponding to the configuration parameter is determined according to a difference between the second configuration information and the first configuration information.
4. The automatic testing method according to claim 3, characterized in that: The method further comprises: After obtaining the configuration operation result information, determining whether the second configuration information is different from the first configuration information; When the configuration operation result information indicates that the operation is successful, and there is no difference between the second configuration information and the first configuration information, or when the configuration operation result information indicates that the operation is failed, and there is a difference between the second configuration information and the first configuration information, it is determined that there is a fault in the configuration operation; Generates fault prompt information.
5. The automatic testing method according to claim 3, characterized in that: The configuration operation includes multiple times, and each configuration operation type is the same; when the configuration operation result information indicates that the operation is successful, determining the command line configuration format corresponding to the configuration parameter according to the difference between the second configuration information and the first configuration information, including: The configuration operation when the configuration operation result information is successful is used as the target configuration operation; Determining a command line configuration format corresponding to the configuration parameter according to a difference between the first target configuration information obtained before the target configuration operation and the second target configuration information obtained after the target configuration operation; Generating a command line configuration operation instruction according to the configuration parameters and the command line configuration format includes: Generating a plurality of groups of command line configuration operation instructions respectively according to the configuration parameters of each configuration operation and the command line configuration format; The performing a command line configuration test on the device to be tested by using the command line configuration operation instruction includes: Perform multiple groups of command line configuration tests on the devices to be tested respectively according to the multiple groups of command line configuration operation instructions.
6. The automatic testing method according to claim 5, characterized in that: The method further comprises: The configuration parameters of each configuration operation are associated with the command line configuration format.
7. The automatic testing method according to claim 5, characterized in that: The method further comprises: Generate at least one set of supplementary configuration parameters by learning the configuration parameters of each configuration operation; Generate at least one set of supplementary command line configuration operation instructions according to the at least one set of supplementary configuration parameters and the command line configuration format; A command line configuration test is performed on the device to be tested according to the supplementary command line configuration operation instruction.
8. The automatic testing method according to claim 2, characterized in that: The method further comprises: After the user logs in to the device to be tested, the operation navigation information of the user on the page of the device to be tested is obtained in real time; When the first matching is successful, stop acquiring the operation navigation information; When the command line configuration test is completed, a command line test report is generated; the command line test report includes a target access path of the target page, and the target access path is generated according to the operation navigation information.
9. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the automatic testing method described in any one of claims 1 to 8 above.
10. A computer-readable storage medium, characterized in that: Used to store a computer-readable program, wherein when the program or instruction is executed by a processor, the steps in the automatic testing method described in any one of claims 1 to 8 can be implemented.