CN111309586A - Command testing method, device and storage medium thereof - Google Patents
Command testing method, device and storage medium thereof Download PDFInfo
- Publication number
- CN111309586A CN111309586A CN201811519824.4A CN201811519824A CN111309586A CN 111309586 A CN111309586 A CN 111309586A CN 201811519824 A CN201811519824 A CN 201811519824A CN 111309586 A CN111309586 A CN 111309586A
- Authority
- CN
- China
- Prior art keywords
- command
- library
- product
- information
- configuration
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 156
- 238000000034 method Methods 0.000 claims abstract description 33
- 238000004590 computer program Methods 0.000 claims description 5
- 238000004891 communication Methods 0.000 abstract description 7
- 238000010998 test method Methods 0.000 abstract 1
- 230000008569 process Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 230000002093 peripheral effect Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012827 research and development Methods 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The invention provides a command testing method, a command testing device and a storage medium thereof, and relates to the technical field of data communication command testing. The command test method comprises the following steps: sending a device identification instruction to a tested device, and receiving current device information returned by the tested device; determining that the current equipment information is matched with input equipment information in an equipment information base; searching a command library for a configuration command matched with the tested device based on the current device information; and issuing the configuration command to the tested equipment to obtain a command test result of the tested equipment for running the configuration command. The method identifies the tested equipment based on the equipment information base, and issues the configuration command matched with the tested equipment in the command base to the tested equipment for testing, so that the manual operation steps are reduced, and the command testing efficiency is improved.
Description
Technical Field
The invention relates to the technical field of data communication command testing, in particular to a command testing method, a command testing device and a storage medium thereof.
Background
The existing data communication field has the characteristics of numerous product lines, great product function difference with the product lines, different product versions and the like, and if the command is manually recorded in the command test, the workload is huge and human errors exist. Research and development personnel need to test each product one by one when performing command testing, and under the condition of continuous iterative updating of versions, a great deal of manpower is consumed for each round of command verification, and the problems of command testing omission and the like are caused by the manpower testing.
Disclosure of Invention
In view of this, embodiments of the present invention provide a command testing method, a command testing apparatus, and a storage medium thereof, so as to solve the problem of low testing efficiency caused by manually recording commands in the prior art.
In a first aspect, an embodiment of the present invention provides a command testing method, where the command testing method includes: sending a device identification instruction to a tested device, and receiving current device information returned by the tested device; determining that the current equipment information is matched with input equipment information in an equipment information base; searching a command library for a configuration command matched with the tested device based on the current device information; and issuing the configuration command to the tested equipment to obtain a command test result of the tested equipment for running the configuration command.
According to the embodiment, after the current equipment information of the tested equipment is matched with the equipment information in the equipment information base, the corresponding configuration command is automatically acquired based on the matched equipment information, and the configuration command is issued, so that the configuration command is prevented from being manually recorded, and the efficiency and accuracy of command testing are improved.
In summary of the first aspect, the device information base includes a product line base and/or a product base and/or a version base, and before the determining that the current device information matches the entered device information in the device information base, the method further includes: creating the equipment information base; sending the equipment identification instruction to the tested reference equipment, and receiving reference equipment information returned by the tested reference equipment; and sequentially inputting the information serving as the input equipment into the product line library and/or the product library and/or the version library on the basis of product line information and/or product information and/or version information in the reference equipment information.
The embodiment creates the equipment information base comprising the product line base, the product base and the version base so as to verify the corresponding information base of the tested equipment when equipment matching is carried out on the basis of the equipment information base and the current equipment information, thereby improving the accuracy and the accuracy of equipment matching.
Summarizing the first aspect, the command library comprises a common command library and/or a product line command library and/or a product command library and/or a version command library, the common command library is used for storing common commands of all products, the product line command library comprises a product line command sub-library used for storing respective common commands of different types of product lines, the product order library comprises a product order sub-library for storing respective common orders of different models of products, the version command library comprises a version command sub-library used for storing different versions of respective common commands, the priorities of the common command library, the product line command library, the product command library and the version command library are sequentially reduced, before the searching for a configuration command matching the device under test in a command library based on the current device information, the method further comprises: creating the command library, and importing a configuration command to the command library; and storing the configuration commands in the command library or distributing the configuration commands to a command sub-library corresponding to the next priority level according to the sequence of the priority levels from high to low based on the respective command distribution rules of the common command library and/or the product line command library and/or the product command library and/or the version command library.
The command library created in the above embodiment includes a common command library, and a product line command library, a product command library, and a version command library corresponding to the product line library, the product library, and the version library in the product information library, and configuration commands for all products, products of the same product line, products of the same product, and versions are stored in a hierarchical manner through the product line command library, the product command library, and the version command library in the common command library, so that the efficiency and accuracy of issuing commands are improved.
In summary of the first aspect, before the storing the configuration command in the command library or distributing the configuration command to the next-priority corresponding command sub-library based on the respective command distribution rules of the common command library and/or the product-line command library and/or the product command library and/or the version command library, respectively, the method further includes: and formulating a command distribution rule for distinguishing product lines in the common command library, formulating a command distribution rule for distinguishing products in the product line command library, and formulating a command distribution rule for distinguishing versions in the product command library.
The above embodiments respectively formulate the command distribution rules for the common command library, the product line command library, the product command library and the version command library, thereby being capable of accurately and efficiently distributing configuration commands of all levels.
In summary of the first aspect, after the creating the command library, the command testing method further includes: setting the configuration commands in the public command library to be executed by all tested devices, associating different product line types in the product line library with corresponding product line command sub-libraries, associating different product models in the product library with corresponding product command sub-libraries, and associating different version numbers in the version library with corresponding version command sub-libraries.
In summary of the first aspect, the searching for the configuration command matching the device under test in the command library based on the current device information includes: and determining a product line command sub-library, a product command sub-library and a version command sub-library respectively associated with the product line type, the product model and the version number of the tested device based on the product line information, the product information and the version information in the current device information, and taking the configuration commands in the public command library and the associated product line command sub-library, product command sub-library and version command sub-library as configuration commands matched with the tested device.
In summary of the first aspect, the issuing the configuration command to the device under test includes: and according to the sequence of the priority from high to low, issuing configuration commands in a public command library and a product line command sub-library, a product command sub-library and a version command sub-library which are associated with the product line type, the product model and the version number of the tested equipment to the tested equipment in sequence. .
In the embodiment, based on the association relationship among the product line library, the product library and the version library, and the product line command sub-library, the product command sub-library and the version command sub-library in sequence, the configuration commands in the associated product line command sub-library, product command sub-library and version command sub-library are directly issued to the tested equipment according to the matching result of the tested equipment in the product line library, the product library and the version library, so that the issuing efficiency and accuracy of the configuration commands in each command sub-library are improved.
In summary of the first aspect, the obtaining a command test result of the device under test running the configuration command includes: and when the return value of the configuration command operated by the tested device is not obtained, determining that the test result of the configuration command is a pass test, when the return value is obtained, determining that the test result of the configuration command is a fail test, and recording the configuration command which does not pass the test in a test log file.
In a second aspect, an embodiment of the present invention provides a command testing apparatus, where the command testing apparatus includes: the device information acquisition module is used for sending a device identification instruction to the tested device and receiving current device information returned by the tested device; the equipment information matching module is used for determining that the current equipment information is matched with the input equipment information in the equipment information base; the configuration command matching module is used for searching a configuration command matched with the tested equipment in a command library based on the current equipment information; and the test execution module is used for issuing the configuration command to the tested equipment and acquiring a command test result of the tested equipment for running the configuration command.
In summary of the second aspect, the command testing apparatus further includes an equipment information base creating module, where the equipment information base creating module includes: an equipment information base initial creating unit, configured to create the equipment information base; the equipment information acquisition unit is used for sending the equipment identification instruction to the tested reference equipment and receiving reference equipment information returned by the tested reference equipment; and the equipment information entry unit is used for sequentially entering the information serving as the entry equipment into the product line library and/or the product library and/or the version library on the basis of the product line information and/or the product information and/or the version information in the reference equipment information.
In summary of the second aspect, the command testing apparatus further includes a command library creating module, which includes: the command library initial creating unit is used for creating the command library and importing a configuration command to the command library; and the command distribution unit is used for storing the configuration commands in the command library or distributing the configuration commands to a command sub-library corresponding to the next priority level according to the order of the priority levels from high to low based on the respective command distribution rules of the common command library and/or the product line command library and/or the product command library and/or the version command library.
In summary of the second aspect, the command library creating module further includes: the distribution rule making unit is used for making a command distribution rule for distinguishing product lines in the common command library, making a command distribution rule for distinguishing products in the product line command library, and making a command distribution rule for distinguishing versions in the product command library.
In summary of the second aspect, the command testing apparatus further includes: and the association module is used for setting the configuration command in the public command library to be executed by all the tested devices, associating different product line types in the product line library with the corresponding product line command sub-libraries, associating different product models in the product library with the corresponding product command sub-libraries, and associating different version numbers in the version library with the corresponding version command sub-libraries.
In a second aspect, the configuration command matching module is further configured to determine, based on the product line information, the product information, and the version information in the current device information, a product line command sub-library, a product command sub-library, and a version command sub-library respectively associated with a product line type, a product model, and a version number of the device under test, and use configuration commands in the common command library and the associated product line command sub-library, product command sub-library, and version command sub-library as configuration commands matched with the device under test.
In a second aspect, the test execution module is further configured to issue configuration commands in a common command library, and a product line command sub-library, a product command sub-library, and a version command sub-library associated with the product line type, the product model, and the version number of the device under test to the device under test in sequence according to the priority from high to low.
In a second aspect, the test execution module is further configured to determine that the test result of the configuration command is a pass test when the return value of the device under test for running the configuration command is not obtained, determine that the test result of the configuration command is a fail test when the return value is obtained, and record the configuration command that fails the test in the test log file.
In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium, where computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the steps in the method in any aspect are performed.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flowchart illustrating a command testing method according to a first embodiment of the present invention;
fig. 2 is a schematic flowchart of a step of establishing an equipment information base according to a first embodiment of the present invention;
FIG. 3 is a flowchart illustrating a command library creating step according to a first embodiment of the present invention;
FIG. 4 is a block diagram of a command testing apparatus 100 according to a second embodiment of the present invention;
fig. 5 is a block diagram of an electronic device 200 applicable to the embodiment of the present application according to a third embodiment of the present invention.
Icon: 100-command test device; 110-a device information acquisition module; 120-device information matching module; 130-configuration command matching module; 140-a test execution module; 200-an electronic device; 201-a memory; 202-a memory controller; 203-a processor; 204-peripheral interface; 205-input-output unit; 206-an audio unit; 207-display unit.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
First embodiment
The applicant finds that product lines are very abundant in the data communication field nowadays, the same product line can be distinguished due to the difference of product architectures, and even products with the same model can be greatly distinguished due to the difference of versions. When a developer performs command testing, it is difficult to quickly identify differences and perform command testing on data communication products with such large differences, and how to provide a quick and accurate command testing method is urgent.
In order to solve the above problem, a first embodiment of the present invention provides a command testing method, where specific product information is determined according to a product and a version in a testing device, and a configuration command is automatically matched and a test is issued in a linkage command library manner, so as to improve the efficiency of command testing. It should be understood that the execution subject of the command testing method may be a computer, a smart terminal, a cloud processor, or other processing device with logical operation capability.
Referring to fig. 1, fig. 1 is a schematic flow chart of a command testing method according to a first embodiment of the present invention, which includes the following specific steps:
step S12: and sending a device identification instruction to the tested device, and receiving current device information returned by the tested device.
The device to be tested in this embodiment may be a router, a switch, a Passive Optical Network (PON) device, or other data communication related devices.
The current device information in this step may include at least one of product line information, product information, version information, manufacturer information, and the like of the device.
Step S14: and determining that the current equipment information is matched with the input equipment information in the equipment information base.
The matching between the current device information and the entered device information in this embodiment may be that fields representing the device information are completely the same or corresponding, or may refer to that classification fields partially representing the device information are the same or corresponding.
Step S16: and searching a command library for a configuration command matched with the tested equipment based on the current equipment information.
In this embodiment, after determining, in the command library, a device corresponding to the current device information in the device information library, and when performing search matching of the configuration command in the command library, all the configuration commands in the command sub-library corresponding to the device may be directly used as matched configuration commands.
Step S18: and issuing a configuration command to the tested equipment to obtain a command test result of the tested equipment running the configuration command.
According to the command testing method provided by the embodiment of the invention, after the current equipment information of the tested equipment is matched with the equipment information in the equipment information base, the corresponding configuration command is automatically obtained based on the matched equipment information, and the configuration command is issued, so that the whole process does not need manual participation, the requirement of continuously integrating the command testing in the current mainstream command testing is met, meanwhile, errors possibly existing in manual testing are avoided through automatic testing, the accuracy is high, the automatic command testing efficiency is far higher than that of manual testing, and the workload of research and development personnel can be greatly reduced.
As an alternative implementation manner for step S12, the specific flow of step "sending a device identification instruction to a device under test" may be as follows: and sending a device identification command 'show system devInfo' and 'show version' to the tested device. Correspondingly, the specific flow of the step "receiving the current device information returned by the device under test" may be as follows: capturing a key field ' product Type ' of echoing information returned by the tested equipment aiming at ' show system devInfo ', and acquiring product line information of the current equipment, such as ' product Type: route ", where route represents a ROUTER product line; capturing a key field ' Hardware Model ' of echoing information returned by the tested equipment for the ' show version ', and acquiring product information of the current equipment, such as ' Hardware Model: MP7500 "(MP 7500 is a specific router product model); capturing a key field ' Software Version ' of echoing information returned by the tested equipment for the ' show Version ', and acquiring product information of the current equipment, such as ' Software Version: 8.5.0".
It should be understood that the device under test needs to be identified by the device information base when step S14 is executed, and therefore, the present embodiment also needs to establish the device information base before step S14. Referring to fig. 2, fig. 2 is a schematic flow chart illustrating a step of establishing an equipment information base according to a first embodiment of the present invention, where the step of establishing the equipment information base may specifically be as follows:
step S13.1: an equipment information base is created.
The device information base in this embodiment may be SQL, MYSQL, or other databases with multi-level entry storage functions. Meanwhile, the equipment information in the equipment information base can be stored in the formats of documents, tables and the like so as to be convenient to read and modify.
Step S13.2: and sending the equipment identification instruction to the tested reference equipment, and receiving reference equipment information returned by the tested reference equipment.
The process of automatically acquiring the current device information in this embodiment may be: and issuing equipment identification instructions of 'show system devInfo' and 'show version' to the tested reference equipment. Correspondingly, capturing a key field ' product Type ' for echoing information returned by the tested reference device aiming at the ' showsystem devInfo ', and acquiring product line information of the current device, such as ' product Type: route ", where route represents a ROUTER product line; capturing a key field ' Hardware Model ' of echoing information returned by the tested reference equipment for the ' show version ', and acquiring product information of the current equipment, such as ' Hardware Model: MP7500 "; capturing a key field ' Software Version ' of echoing information returned by the tested benchmark device for the ' show Version ', and acquiring product information of the current device, such as ' Software Version: 8.5.0".
Step S13.3: and sequentially inputting the information serving as input equipment into the product line library and/or the product library and/or the version library based on the product line information and/or the product information and/or the version information in the reference equipment information.
Continuing with the example in step S13.2, this step will be described as "product Type: the route 'is used as product line information to be recorded into a product line library, and the' Hardware Model: MP7500 is used as product information to be recorded into a product library, and the Software Version: 8.5.0' is entered into the version repository as version information.
In the embodiment, the equipment information base including the product line base, the product base and the version base is created, so that the equipment matching is performed on the tested reference equipment based on the equipment information base and the current equipment information, and the accuracy of equipment matching are improved.
For step S14, the product line information "product Type: ROUTER ", product information" HardwareModel: MP7500 "and Version information" Software Version: and 8.5.0' is respectively matched with the equipment information recorded in the product line library, the product library and the version library in the equipment information library, and if the matching is successful, a configuration command is waited to be issued. The matching mode can be based on field coincidence degree or classification mark, and the field coincidence refers to the obtained product information' Hardware Model: MP7500X "and entry device information" Hardware Model: MP7500 "match when overlapped, the classification mark may be based on the acquired product information" Hardware Model: the field features or other indicia contained in MP7500 "categorize it as a product library.
As an alternative embodiment, matching failure information is returned when the current device information matching at step S14 fails to prompt the user whether to add the device information to the device information base. Further, the device information is automatically entered into the device information repository by means of step S13.2 when the user chooses to add the device information to the device information repository, which the user may subsequently enter manually when the user chooses not to add the device information to the device information repository.
It should be appreciated that a command library for storing and issuing configuration commands may also need to be created before step S16 is executed. Referring to fig. 3, fig. 3 is a schematic flow chart of a command library establishing step according to a first embodiment of the present invention, where the command library establishing step may specifically be as follows:
step S15.1: and creating a command library, and importing the configuration commands into the command library.
The command library comprises a common command library and/or a product line command library and/or a product command library and/or a version command library. The common command library is used for storing common commands of all products, the product line command library comprises a product line command sub-library used for storing respective common commands of different types of product lines, the product command library comprises a product command sub-library used for storing respective common commands of different models of products, and the version command library comprises a version command sub-library used for storing respective common commands of different versions of the products. For example, "product Type: the product line command sub-library corresponding to route "has a command for" product Type: route "configuration command for product line," Hardware Model: the product command sub-library corresponding to MP7500 "has a command for" Hardware Model: MP7500 "configuration command for product," Software Version: 8.5.0196(R) "the corresponding Version command sub-library is available for Software Version: 8.5.0196(R) "version of the configuration command.
The priorities of the public command library, the product line command library, the product command library and the version command library are sequentially reduced.
Step S15.2: and storing the configuration commands in the command library or distributing the configuration commands to a command sub-library corresponding to the next priority level according to the order of the priority levels from high to low based on the respective command distribution rules of the common command library and/or the product line command library and/or the product command library and/or the version command library.
The present embodiment may be to enter the configuration commands in a manner of alphabetical sorting and associative traversal one by one, such as inputting the character "a? Acquiring a command set at the beginning of the alpha letter by command association, then associating the associated configuration commands step by step until a matching command end keyword is ended "< CR >", recording the acquired configuration commands, and so on, acquiring the configuration commands one by one and uploading the configuration commands to a public command library, and typing "< CR > < CR >" in the public command library after the recording of all the configuration commands is finished to represent that the recording is ended. If the subsequent configuration command is increased, the tail < CR > < CR > mark is cleared first and then the new addition is started, and the tail is marked with < CR > < CR > after the new addition is finished. And if the configuration command to be entered already exists in the command library in the entering process, ignoring the entering process and continuing to associate with the next configuration command.
After the configuration commands are recorded into the public command library, the public command library respectively sends the configuration commands recorded into the public command library to the corresponding product line command sub-libraries based on the command distribution rules of the public command library, and the configuration commands which are not matched with the corresponding command distribution rules are stored in the public command library. And each product line command sub-library in the product line command library respectively sends the configuration commands recorded in the sub-library to the corresponding product command sub-libraries based on the command distribution rules of the sub-library, and the configuration commands which are not matched with the corresponding command distribution rules are stored in the sub-library. And each product command sub-library in the product command library respectively sends the configuration commands recorded in the library to the corresponding version command sub-libraries based on the command distribution rules of the library, and the configuration commands which are not matched with the corresponding command distribution rules are stored in the library.
The command distribution rule of each library in the command library can be that the configuration command is issued step by step according to the matched keywords in the configuration command. For example, the common command library may formulate command distribution rules for distributing the product lines to the corresponding product line command sub-libraries based on keywords such as "ce 1", "vlan", etc., each product line command sub-library may formulate command distribution rules for distributing the products to the corresponding product command sub-library based on keywords such as "ipfix", "mpls", etc., and each product command sub-library may formulate command distribution rules for distributing the products to the corresponding version command sub-libraries based on keywords such as "bgp", "nsr", "irmp".
As an optional implementation manner, in this embodiment, each level of sub-library in the device information library may be associated with each level of sub-library corresponding to the command library, that is, the configuration command in the common command library is set to be executed by all the devices to be tested, different product line types in the product line library are associated with the corresponding product line command sub-library, different product models in the product library are associated with the corresponding product command sub-library, and different version numbers in the version library are associated with the corresponding version command sub-library. And if the tested device is determined to correspond to the Router product line library, the MP7500 product library and the 8.5.0 version library in the device information base based on the current device information, the associated product line command sub-library is the Router, the product command sub-library is the MP7500X and the version command sub-library is 8.5.0.
After the association between the device information library and the command library is completed, in step S16, the configuration commands in the common command library and the product line command sub-library, the product command sub-library and the version command sub-library corresponding to the device under test may be directly used as the configuration commands of the device under test based on the association relationship.
Further, in order to meet the project or special requirement of the user, the present embodiment may further enable the user to manually select a sub library of a single or multiple command libraries to issue the configuration command, thereby implementing an individual test for a certain product line command, a certain product command, or a certain version command. The specific mode can be as follows: marking parameters of a public command library as pub, marking parameters of a product line command library as prodL, marking parameters of a product command library as prod and marking parameters of a version command library as ver by marking parameters of all sub libraries in a command library; if only the common command needs to be tested during execution, only the common command library parameter pub needs to be added, and the like, the effect of executing a single command library is realized by configuring different parameters.
Aiming at the step S18, the common command library and the corresponding configuration commands of the product line command sub-library, the product command sub-library and the version command sub-library are sequentially issued to the tested device, and the configuration command of the next command sub-library is sent after the matching ending key word < CR > < CR > is sent after the configuration command of one command sub-library is sent each time.
Further, when the return value after the configuration command is run by the device to be tested is not obtained, the test result of the configuration command is determined to be a pass test, when the return value is obtained, the test result of the configuration command is determined to be a fail test, and the configuration command which does not pass the test is recorded in the test log file. And simultaneously, after all matched configuration commands are executed, generating an output document to be provided for a tester to confirm.
In this embodiment, when determining whether the configuration command passes, specifically, the name of the device under test is uniformly modified to be the DUT for test result confirmation, the command library issues commands in the library one by one to the device under test, if the issued command does not return a value, the test of the configuration command passes, and if the issued command returns a% Invalid input detected field, the test of the configuration command fails.
The command testing method provided by the embodiment of the invention can automatically identify the tested equipment and then acquire the matched configuration command from the command library, can quickly identify the information of the tested equipment through the equipment information library, can acquire the matched command library and the configuration command from the confirmed tested equipment through the linkage of the equipment information library and the command library and return the test result, releases the test labor, shortens the test period, and realizes the command multiplexing and avoids the command repeated entry through the command library classification method. The mode of realizing automatic input aiming at equipment information and configuration commands lightens the manpower input pressure, realizes the automatic distribution of commands for the test equipment after identification, reduces the manual intervention, improves the test efficiency, reduces the manual error, and simultaneously the added selector switch can be tested according to the requirement to avoid the condition of comprehensive coverage every time, thereby improving the test flexibility and efficiency.
Second embodiment
In order to cooperate with the command testing method provided in the first embodiment of the present invention, a command testing apparatus 100 is further provided in the second embodiment of the present invention.
Referring to fig. 4, fig. 4 is a block diagram illustrating a command testing apparatus 100 according to a second embodiment of the present invention.
The command test apparatus 100 includes a device information acquisition module 110, a device information matching module 120, a configuration command matching module 130, and a test execution module 140.
The device information obtaining module 110 is configured to send a device identification instruction to the device under test, and receive current device information returned by the device under test.
And the device information matching module 120 is configured to determine that the current device information matches the logged device information in the device information base.
And a configuration command matching module 130, configured to search the command library for a configuration command matching the device under test based on the current device information.
The test execution module 140 is configured to issue a configuration command to the device under test, and obtain a command test result of the device under test running the configuration command.
As an optional implementation manner, the command testing apparatus 100 in this embodiment further includes an equipment information base creating module, where the equipment information base creating module includes an equipment information base initial creating unit, an equipment information obtaining unit, and an equipment information entry unit.
And the device information base initial creating unit is used for creating the device information base.
And the equipment information acquisition unit is used for sending an equipment identification instruction to the tested reference equipment and receiving reference equipment information returned by the tested reference equipment.
And the equipment information entry unit is used for sequentially entering the product line library and/or the product library and/or the version library as entry equipment information based on the product line information and/or the product information and/or the version information in the reference equipment information.
As an optional implementation manner, the command testing apparatus 100 in this embodiment further includes a command library creating module, and the command library creating module includes a command library initial creating unit and a command distributing unit.
And the command library initial creating unit is used for creating a command library and importing the configuration command into the command library.
And the command distribution unit is used for storing the configuration commands in the command library or distributing the configuration commands to the command sub-library corresponding to the next priority level according to the priority level from high to low based on the respective command distribution rules of the common command library and/or the product line command library and/or the product command library and/or the version command library.
The command library creating module may further include a distribution rule making unit configured to make a command distribution rule for distinguishing a product line in the common command library, a command distribution rule for distinguishing a product in the product line command library, and a command distribution rule for distinguishing a version in the product command library.
As an optional implementation manner, the command testing apparatus 100 in this embodiment further includes an association module, configured to set the configuration command in the common command library to be executed by all devices to be tested, associate different product line types in the product line library with corresponding product line command sub-libraries, associate different product models in the product library with corresponding product command sub-libraries, and associate different version numbers in the version library with corresponding version command sub-libraries.
The configuration command matching module 130 is specifically configured to determine, based on the product line information, the product information, and the version information in the current device information, a product line command sub-library, a product command sub-library, and a version command sub-library respectively associated with a product line type, a product model, and a version number of the device under test, and use configuration commands in the common command library and the associated product line command sub-library, product command sub-library, and version command sub-library as configuration commands matched with the device under test.
The test execution module 140 is specifically configured to issue configuration commands in the common command library, the product line command sub-library, the product command sub-library, and the version command sub-library, which are associated with the product line type, the product model, and the version number of the device under test, to the device under test in sequence from high to low according to the priority. And meanwhile, the test result of the configuration command is determined to be a pass test when the return value of the configuration command operated by the tested device is not obtained, the test result of the configuration command is a fail test when the return value is obtained, and the configuration command which does not pass the test is recorded in the test log file.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method, and will not be described in too much detail herein.
Third embodiment
Referring to fig. 5, fig. 5 is a block diagram of an electronic device 200 applicable to the embodiment of the present application according to a third embodiment of the present invention. The electronic device 200 provided by the present embodiment may include a command testing apparatus 100, a memory 201, a memory controller 202, a processor 203, a peripheral interface 204, an input/output unit 205, an audio unit 206, and a display unit 207.
The memory 201, the memory controller 202, the processor 203, the peripheral interface 204, the input/output unit 205, the audio unit 206, and the display unit 207 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The command test apparatus 100 includes at least one software function module which may be stored in the memory 201 in the form of software or firmware (firmware) or solidified in an Operating System (OS) of the command test apparatus 100. The processor 203 is used to execute executable modules stored in the memory 201, such as software functional modules or computer programs included in the command test apparatus 100.
The Memory 201 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 201 is used for storing a program, the processor 203 executes the program after receiving an execution instruction, and the method executed by the server defined by the flow process disclosed in any of the foregoing embodiments of the present invention may be applied to the processor 203, or implemented by the processor 203.
The processor 203 may be an integrated circuit chip having signal processing capabilities. The Processor 203 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor 203 may be any conventional processor or the like.
The peripheral interface 204 couples various input/output devices to the processor 203 as well as to the memory 201. In some embodiments, the peripheral interface 204, the processor 203, and the memory controller 202 may be implemented in a single chip. In other examples, they may be implemented separately from the individual chips.
The input and output unit 205 is used for providing input data for a user to realize the interaction of the user with the server (or the local terminal). The input/output unit 205 may be, but is not limited to, a mouse, a keyboard, and the like.
The audio unit 206 provides an audio interface to the user, which may include one or more microphones, one or more speakers, and audio circuitry.
The display unit 207 provides an interactive interface (e.g., a user operation interface) between the electronic device 200 and a user or is used to display image data for user reference. In this embodiment, the display unit 207 may be a liquid crystal display or a touch display. In the case of a touch display, the display can be a capacitive touch screen or a resistive touch screen, which supports single-point and multi-point touch operations. Supporting single-point and multi-point touch operations means that the touch display can sense touch operations from one or more locations on the touch display at the same time, and the sensed touch operations are sent to the processor 203 for calculation and processing.
It is to be understood that the configuration shown in fig. 5 is merely exemplary, and the electronic device 200 may include more or fewer components than shown in fig. 5, or may have a different configuration than shown in fig. 5. The components shown in fig. 5 may be implemented in hardware, software, or a combination thereof.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method, and will not be described in too much detail herein.
In summary, embodiments of the present invention provide a command testing method, an apparatus, and a storage medium thereof, in which after matching current device information of a device under test with device information in a device information base, a corresponding configuration command is automatically obtained based on the matched device information, and the configuration command is issued, so that manual entry of the configuration command is avoided, and efficiency and accuracy of command testing are improved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Claims (10)
1. A command testing method, the method comprising:
sending a device identification instruction to a tested device, and receiving current device information returned by the tested device;
determining that the current equipment information is matched with input equipment information in an equipment information base;
searching a command library for a configuration command matched with the tested device based on the current device information;
and issuing the configuration command to the tested equipment to obtain a test result of the tested equipment running the configuration command.
2. The command testing method of claim 1, wherein the device information base comprises a product line base and/or a product base and/or a version base, and prior to the determining that the current device information matches entered device information in the device information base, the method further comprises:
creating the equipment information base;
sending the equipment identification instruction to the tested reference equipment, and receiving reference equipment information returned by the tested reference equipment;
and sequentially inputting the information serving as the input equipment into the product line library and/or the product library and/or the version library on the basis of product line information and/or product information and/or version information in the reference equipment information.
3. The command testing method of claim 2, wherein the command library comprises a common command library and/or a product line command library and/or a product command library and/or a version command library, the common command library is used for storing common commands of all products, the product line command library comprises a product line command sub-library used for storing respective common commands of different types of product lines, the product command library comprises a product command sub-library used for storing respective common commands of different models of products, the version command library comprises a version command sub-library used for storing respective common commands of different versions of versions, the priorities of the common command library, the product line command library, the product command library and the version command library are sequentially reduced, before searching the command library for configuration commands matching the tested device based on the current device information, the method further comprises the following steps:
creating the command library, and importing a configuration command to the command library;
and storing the configuration commands in the command library or distributing the configuration commands to a command sub-library corresponding to the next priority level according to the sequence of the priority levels from high to low based on the respective command distribution rules of the common command library and/or the product line command library and/or the product command library and/or the version command library.
4. The command testing method of claim 3, wherein before said storing the configuration commands in the command library or distributing the configuration commands to the next-priority corresponding command sub-library based on respective command distribution rules of the common command library and/or the product-line command library and/or the product command library and/or the version command library, respectively, the method further comprises:
and formulating a command distribution rule for distinguishing product lines in the common command library, formulating a command distribution rule for distinguishing products in the product line command library, and formulating a command distribution rule for distinguishing versions in the product command library.
5. The command testing method of claim 3, wherein after said creating the command library, the command testing method further comprises:
setting the configuration commands in the public command library to be executed by all tested devices, associating different product line types in the product line library with corresponding product line command sub-libraries, associating different product models in the product library with corresponding product command sub-libraries, and associating different version numbers in the version library with corresponding version command sub-libraries.
6. The command testing method of claim 5, wherein searching a command library for a configuration command matching the device under test based on the current device information comprises:
and determining a product line command sub-library, a product command sub-library and a version command sub-library respectively associated with the product line type, the product model and the version number of the tested device based on the product line information, the product information and the version information in the current device information, and taking the configuration commands in the public command library and the associated product line command sub-library, product command sub-library and version command sub-library as configuration commands matched with the tested device.
7. The command testing method of claim 6, wherein said issuing the configuration command to the device under test comprises:
and according to the sequence of the priority from high to low, issuing configuration commands in a public command library and a product line command sub-library, a product command sub-library and a version command sub-library which are associated with the product line type, the product model and the version number of the tested equipment to the tested equipment in sequence.
8. The command testing method of claim 1, wherein the obtaining of the test result of the device under test running the configuration command comprises:
and when the return value of the configuration command operated by the tested device is not obtained, determining that the test result of the configuration command is a pass test, when the return value is obtained, determining that the test result of the configuration command is a fail test, and recording the configuration command which does not pass the test in a test log file.
9. A command testing apparatus, the apparatus comprising:
the device information acquisition module is used for sending a device identification instruction to the tested device and receiving current device information returned by the tested device;
the equipment information matching module is used for determining that the current equipment information is matched with the input equipment information in the equipment information base;
the configuration command matching module is used for searching a configuration command matched with the tested equipment in a command library based on the current equipment information;
and the test execution module is used for issuing the configuration command to the tested equipment and acquiring the test result of the tested equipment for running the configuration command.
10. A computer-readable storage medium having computer program instructions stored thereon which, when read and executed by a processor, perform the steps of the method of any of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811519824.4A CN111309586B (en) | 2018-12-12 | 2018-12-12 | Command testing method and device and storage medium thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811519824.4A CN111309586B (en) | 2018-12-12 | 2018-12-12 | Command testing method and device and storage medium thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111309586A true CN111309586A (en) | 2020-06-19 |
CN111309586B CN111309586B (en) | 2024-07-19 |
Family
ID=71154262
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811519824.4A Active CN111309586B (en) | 2018-12-12 | 2018-12-12 | Command testing method and device and storage medium thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111309586B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112068531A (en) * | 2020-09-08 | 2020-12-11 | 上海星融汽车科技有限公司 | Vehicle data stream reading method and system and diagnostic equipment |
CN112685322A (en) * | 2021-01-12 | 2021-04-20 | 武汉思普崚技术有限公司 | Customized test method, device and system |
CN112799889A (en) * | 2020-12-30 | 2021-05-14 | 杭州涂鸦信息技术有限公司 | Flash chip test method and related device |
CN112905493A (en) * | 2021-04-07 | 2021-06-04 | 南京大学 | Structured fuzzy test method based on conversion test |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002086710A2 (en) * | 2001-04-24 | 2002-10-31 | Wvhtc Foundation | Software suitability testing system |
CN101128007A (en) * | 2007-09-21 | 2008-02-20 | 中兴通讯股份有限公司 | Testing method for mobile communication terminal |
US20100229155A1 (en) * | 2009-03-09 | 2010-09-09 | Pandiyan Adiyapatham | Lifecycle management of automated testing |
CN105224459A (en) * | 2015-10-21 | 2016-01-06 | 浪潮电子信息产业股份有限公司 | Method for testing reading and writing BIOS configuration function of BMC through OEM command under LINUX platform |
CN105760299A (en) * | 2016-02-18 | 2016-07-13 | 云南电网有限责任公司电力科学研究院 | Full-automatic script test method based on intelligent substation |
CN106161126A (en) * | 2015-04-07 | 2016-11-23 | 中兴通讯股份有限公司 | The test processing method of alarm and device |
CN107341109A (en) * | 2017-07-07 | 2017-11-10 | 中国银行股份有限公司 | The generation method and system of a kind of test data |
-
2018
- 2018-12-12 CN CN201811519824.4A patent/CN111309586B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002086710A2 (en) * | 2001-04-24 | 2002-10-31 | Wvhtc Foundation | Software suitability testing system |
CN101128007A (en) * | 2007-09-21 | 2008-02-20 | 中兴通讯股份有限公司 | Testing method for mobile communication terminal |
US20100229155A1 (en) * | 2009-03-09 | 2010-09-09 | Pandiyan Adiyapatham | Lifecycle management of automated testing |
CN106161126A (en) * | 2015-04-07 | 2016-11-23 | 中兴通讯股份有限公司 | The test processing method of alarm and device |
CN105224459A (en) * | 2015-10-21 | 2016-01-06 | 浪潮电子信息产业股份有限公司 | Method for testing reading and writing BIOS configuration function of BMC through OEM command under LINUX platform |
CN105760299A (en) * | 2016-02-18 | 2016-07-13 | 云南电网有限责任公司电力科学研究院 | Full-automatic script test method based on intelligent substation |
CN107341109A (en) * | 2017-07-07 | 2017-11-10 | 中国银行股份有限公司 | The generation method and system of a kind of test data |
Non-Patent Citations (1)
Title |
---|
JOSIEL NEUMANN KUK等: "Product selection based on upper confidence bound MOEA/D-DRA for testing software product lines", 2016 IEEE CONGRESS ON EVOLUTIONARY COMPUTATION (CEC), 21 November 2016 (2016-11-21), pages 4135 - 4142 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112068531A (en) * | 2020-09-08 | 2020-12-11 | 上海星融汽车科技有限公司 | Vehicle data stream reading method and system and diagnostic equipment |
CN112068531B (en) * | 2020-09-08 | 2021-05-07 | 上海星融汽车科技有限公司 | Vehicle data stream reading method and system and diagnostic equipment |
CN112799889A (en) * | 2020-12-30 | 2021-05-14 | 杭州涂鸦信息技术有限公司 | Flash chip test method and related device |
CN112685322A (en) * | 2021-01-12 | 2021-04-20 | 武汉思普崚技术有限公司 | Customized test method, device and system |
CN112685322B (en) * | 2021-01-12 | 2022-10-04 | 武汉思普崚技术有限公司 | Customized test method, device and system |
CN112905493A (en) * | 2021-04-07 | 2021-06-04 | 南京大学 | Structured fuzzy test method based on conversion test |
Also Published As
Publication number | Publication date |
---|---|
CN111309586B (en) | 2024-07-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111309586B (en) | Command testing method and device and storage medium thereof | |
WO2018000607A1 (en) | Method and electronic apparatus for identifying test case failure causes | |
CN111291024A (en) | Data processing method and device, electronic equipment and storage medium | |
US20130041900A1 (en) | Script Reuse and Duplicate Detection | |
CN109783346B (en) | Keyword-driven automatic testing method and device and terminal equipment | |
US20160259631A1 (en) | Method and system for realizing software development tasks | |
WO2012079836A1 (en) | Method and system for creating and processing a data rule, data processing program, and computer program product | |
CN111061733B (en) | Data processing method, device, electronic equipment and computer readable storage medium | |
CN111159016A (en) | Standard detection method and device | |
CN111737148A (en) | Automatic regression testing method and device, computer equipment and storage medium | |
US20170091082A1 (en) | Test db data generation apparatus | |
CN114168565B (en) | Backtracking test method, device and system of business rule model and decision engine | |
CN108897765A (en) | A kind of batch data introduction method and its system | |
CN109828902B (en) | Interface parameter determining method and device, electronic equipment and storage medium | |
CN112199483B (en) | Information input assisting method and device, electronic equipment and storage medium | |
US10726178B1 (en) | Functional logic cone signature generation for circuit analysis | |
JP5206268B2 (en) | Rule creation program, rule creation method and rule creation device | |
US20190265954A1 (en) | Apparatus and method for assisting discovery of design pattern in model development environment using flow diagram | |
CN111309370B (en) | Version number directed graph ordering auditing method and system for multi-project multi-system environment | |
CN110737642B (en) | Database information analysis method, database information analysis device, computer device and storage medium | |
CN108509347B (en) | Equivalent variant identification method and device | |
JP5487078B2 (en) | Software asset management method and apparatus | |
US11561979B2 (en) | Dynamically detecting and correcting errors in queries | |
CN111158746B (en) | Method and device for acquiring call relationship | |
CN116010349B (en) | Metadata-based data checking method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |