CN113485928A - Automatic testing method and device for switch - Google Patents

Automatic testing method and device for switch Download PDF

Info

Publication number
CN113485928A
CN113485928A CN202110780078.XA CN202110780078A CN113485928A CN 113485928 A CN113485928 A CN 113485928A CN 202110780078 A CN202110780078 A CN 202110780078A CN 113485928 A CN113485928 A CN 113485928A
Authority
CN
China
Prior art keywords
switch
jenkins
test
node
task
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.)
Pending
Application number
CN202110780078.XA
Other languages
Chinese (zh)
Inventor
胡雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Cisco Networking Technology Co Ltd
Original Assignee
Inspur Cisco Networking Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Inspur Cisco Networking Technology Co Ltd filed Critical Inspur Cisco Networking Technology Co Ltd
Priority to CN202110780078.XA priority Critical patent/CN113485928A/en
Publication of CN113485928A publication Critical patent/CN113485928A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/368Test management for test version control, e.g. updating test cases to a new software version
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable

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)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application discloses an automatic testing method and device for a switch, wherein the method comprises the following steps: responding to the received switch test parameters, and determining a test case set of the switch; acquiring a switch software version to be tested based on a switch software version path; constructing a Jenkins test task based on the test case set and the software version of the switch; and acquiring the state information of the Jenkins test task in real time and displaying the state information on the front-end interface in real time. The technical problems that the learning cost of operators is increased and the software testing quality is reduced when the switchboard is directly tested by using a Jenkins tool are solved. The use threshold of the platform user can be reduced, and the learning cost of the platform user is reduced.

Description

Automatic testing method and device for switch
Technical Field
The application relates to the field of software testing, in particular to an automatic testing method and device for a switch.
Background
Software testing is a process of operating a program under specified conditions to discover bugs, to measure software quality, and to evaluate whether it meets design requirements. In some large software development processes, the testing activity takes a lot of time and cost, if manual testing is used, the testing efficiency is very low, and the testing tool can perform part of the testing design, implementation, execution and comparison work. By using the testing tool, the purpose of improving the testing efficiency can be achieved.
The Jenkins tool is a popular automatic continuous integration management tool at present, and very rich plug-in management tools such as Gitlab, python and shell are integrated inside the Jenkins tool. However, due to the complexity of operation and environment deployment, there is a certain learning cost and maintenance cost for operators and administrators, and the operators need to spend a lot of time and effort on learning how to operate Jenkins tool, and cannot concentrate on analyzing test reports and test data. And the method also has the risk of operation errors and reduces the quality of software testing by relying on manual creation of Jenkins switch tasks, selection of test case sets and writing of test scripts.
Disclosure of Invention
The embodiment of the application provides an automatic testing method and device for a switch, which are used for solving the following technical problems: the direct use of the Jenkins tool to test the switch can increase the learning cost of operators and reduce the software testing quality.
The embodiment of the application adopts the following technical scheme:
in one aspect, an embodiment of the present application provides an automatic testing method for a switch, where the method includes: responding to the received switch test parameters, and determining a test case set of the switch; acquiring a switch software version to be tested based on a storage path of the switch software version; constructing a Jenkins test task based on the test case set and the switch software version; and acquiring the state information of the Jenkins test task in real time and displaying the state information in real time.
In a possible implementation manner, the determining a set of switch test cases in response to the received switch test parameters specifically includes: based on the tree data structure, all the functional modules in the switch software are assembled into a tree structure; each functional module corresponds to one node in the tree structure; marking each node in the tree structure by a numerical subscript; based on the switch test parameters, searching corresponding nodes in the tree structure to obtain names of a plurality of functional modules to be tested; wherein the switch test parameters include one or more of the digital indices; and combining the names of the functional modules to be tested into a test case set of the switch.
In a feasible implementation manner, based on the switch test parameters, searching for corresponding nodes in the tree structure to obtain names of a plurality of functional modules to be tested, specifically including: stacking the root node of the tree structure; after each stacking operation, judging whether the digital subscript of the last stacked node is matched with the switch test parameter; under the condition of no match, acquiring all child nodes of the last pushed node; and stacking the first sub-node of the last stacked node, performing the next circulation until the digital subscript of the last stacked node is matched with the switch test parameter, and returning the name of the functional module corresponding to the last stacked node.
In one possible embodiment, before obtaining all child nodes of the last pushed node, the method further comprises: under the condition that the child node does not exist in the last pushed node, the last pushed node is pushed out, the next node of the pushed node is pushed, and circulation is carried out until the child node exists in the last pushed node; and the next node is the node corresponding to the popped node after the digital subscript of the node is added with one.
According to the embodiment of the application, the functional modules of the switch are assembled through the tree structure, the functional modules are marked by a key-value keyword marking method, the switch functional modules to be tested are quickly searched by adopting a recursive algorithm, a test case set can be automatically determined, the test case set does not need to be manually assembled, and the workload of workers is reduced. And the functional modules of the switch are assembled through the tree structure, so that the correlation among the functional modules can be maintained.
In a feasible implementation manner, constructing a Jenkins test task based on the test case suite and the switch software version specifically includes: acquiring a construction parameter based on a starting instruction; wherein the build parameters include at least one or more of: switch topology configuration information, switch port configuration information and builder information; determining a plurality of functional modules needing to be tested in the switch software version based on the test case set; and constructing Jenkins test tasks for the functional modules based on the construction parameters.
In a possible implementation manner, before constructing Jenkins test tasks for the plurality of functional modules based on the construction parameters, the method further includes: determining whether Jenkins pipeline tasks corresponding to the construction parameters exist or not; calling a python Jenkins API under the condition that Jenkins pipeline tasks corresponding to the construction parameters do not exist, copying a pre-created Jenkins pipeline task template, and generating corresponding Jenkins pipeline tasks; and constructing the Jenkins test task through the Jenkins pipeline task.
In one possible embodiment, in constructing the Jenkins test task, the method further comprises: and responding to the stopping operation or the executing operation of the front end, stopping the Jenkins test task by calling a python Jenkins API (application programming interface), or reconstructing the Jenkins test task which is abnormally stopped.
In a possible implementation manner, after constructing Jenkins test tasks based on the test case suite and the switch software version, the method further includes: under the condition that more than one Jenkins test tasks are performed simultaneously, the construction numbers of all Jenkins test tasks are regularly matched through a preset regular expression; creating a corresponding thread for each construction number; and starting and executing the threads in sequence based on a preset time interval.
In a feasible implementation manner, the acquiring and displaying the state information of the Jenkins test task in real time specifically includes: calling a python Jenkins sAPI interface to obtain the state information of the Jenkins test task in real time; wherein the status information comprises at least one or more of: constructing state information, progress information, parameter information and constructor information; and displaying the acquired state information of each Jenkins test task in a real-time visual manner.
On the other hand, the embodiment of the present application further provides an automatic testing apparatus for a switch, including: the data control module is used for determining a test case set of the switch based on the received switch test parameters; acquiring the switch software version to be tested based on the switch software version path; the Jenkins control module is used for constructing a Jenkins test task based on the test case set and the switch software version; and the front-end control module is used for acquiring the state information of the Jenkins test task in real time and displaying the state information on a front-end interface in real time.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects:
the automatic test platform of switch that this application embodiment provided need not the manual switch test task of establishing of platform user, compiles test script and manual selection test case set, and above operation all can be accomplished by the automatic test platform of switch automatically, and the platform user only need carry out simple interface operation can, can reduce platform user's use threshold and learning cost. The automatic test platform of switch that this application provided uses python multithreading technique to realize that a plurality of test tasks go on simultaneously, promote efficiency of software testing. The Jenkins task state is rapidly acquired in real time and displayed on a front-end interface, so that a front-end user can conveniently check and manage Jenkins test tasks.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort. In the drawings:
fig. 1 is a schematic structural diagram of an automatic testing apparatus for a switch according to an embodiment of the present disclosure;
fig. 2 is a flowchart of an automated testing method for a switch according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a tree structure according to an embodiment of the present disclosure;
fig. 4 is a flowchart of a recursive algorithm for finding a functional module according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides an automatic testing method and device for a switch.
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any inventive step based on the embodiments of the present disclosure, shall fall within the scope of protection of the present application.
Fig. 1 is a schematic structural diagram of an automatic testing apparatus for a switch provided in the present application, and as shown in fig. 1, the automatic testing apparatus for a switch 100 includes a front-end control module 110, a data control module 120, and a Jenkins control module 130.
The front-end control module 110 is configured to provide a visual interface, so that a platform user can conveniently check the state information of the Jenkins test task through the visual interface, and the platform user can conveniently control the execution flow of the Jenkins test task through the visual interface. The method can also be used for displaying test reports and test data, and is convenient for developers or testers to analyze test results. The front-end control module 110 may be an autonomously designed WEB site, and the visual interface may be a UI interface, so the front-end control module 110 may also be referred to as a WEB control layer.
The data control module 120 is configured to perform corresponding data processing operations according to the request or data sent by the front-end control module 110, where the data processing operations that the data control module 120 may perform include, but are not limited to, generating a test case set, obtaining state information of Jenkins test tasks, and the like. The data control module 120 may also be referred to as a data control layer.
The Jenkins control module 130 is configured to establish or stop a Jenkins test task, connect the switch hardware device and the test instrument through the python and the shell script, initialize the test environment, issue a command to execute a test case set, generate a test report and upload a test log to the front-end control module 110. The Jenkins control module 130 may be a Jenkins server. The Jenkins control module 130 may also be referred to as a Jenkins control layer.
This application adopts the thought of layered design, adopt mainstream Element-ui + Vue js + Django + Uwsgi front and back end separation frame, the automatic tool of deployment of Jenkins simultaneously, realize the automatic testing arrangement of switch based on Jenkins, the automatic testing arrangement of switch in this application is the automatic testing platform of switch promptly, the platform user only needs to carry out simple operation in front end control module 110, all bottom logics are all accomplished at the background by data control module 120 and Jenkins control module 130, it how to establish Jenkins test task to need not the deep study of platform user, how to select the test case set and how to compile the test script, save platform user's time and learning cost, reduce the use threshold of platform.
The present application may implement an automatic testing method for a switch through the automatic testing apparatus for a switch shown in fig. 1, as shown in fig. 2, the automatic testing method for a switch specifically includes steps S201 to S207:
s201, before each test task is executed, the automatic switch test device detects a test environment.
Specifically, before the automatic switch testing device executes a switch testing task, a developer needs to deploy Element-ui + vue.js + Django + Uwsgi front-end and back-end separated framework environments in the device. And then deploying a test environment of the Jenkins server, wherein the test environment mainly comprises master-slave node configuration, creation of a switchboard Jenkins pipeline task template (Jenkins pipeline task template), a pipeline groovy task script and the like.
Further, before carrying out the switch test task each time, the automatic switch test device firstly detects the test environment of the Jenkins server through the detection script, if the test environment is normal, the switch test task is continued, and if the test environment is abnormal, an alarm is sent out to remind a developer to repair the test environment. In general, after the test environment is deployed once, manual maintenance is not needed any more, and manual solution is needed only when an abnormal condition occurs.
S202, the automatic testing device of the switch determines a testing case set of the switch based on the received testing parameters of the switch.
Specifically, when the automatic testing device for the switch is developed, because many functional modules are in the switch software and certain correlation exists among the functional modules, in order to quickly find the designated functional modules and reflect the correlation among the functional modules, the data control module assembles all the functional modules in the switch software into a tree structure according to the correlation among the functional modules based on the tree data structure, and each functional module corresponds to one node in the tree structure. Each node in the tree structure is then labeled with a numerical subscript by the key-value keyword labeling method.
As a possible implementation manner, as shown in fig. 3, the root node of the tree structure is "all", that is, all nodes, nodes in the second layer and the third layer of the tree structure respectively correspond to function modules of the switch, names of the function modules are stored, different function modules of the switch correspond to codes for implementing different switch functions in the switch software, for example, "Port isolation" is a Port isolation module, and codes for implementing the Port isolation function in the switch software are stored. And performing one-to-one correspondence by using a Key-value keyword marking method, using the digital subscript as a keyword Key, and using the name of the functional module stored in each node in the tree structure as a value. By searching the digital subscript, the name of the functional module stored in the node corresponding to the keyword can be returned.
It should be noted that fig. 3 only shows an assembly schematic diagram of a part of functional modules, and does not include all functional modules, and the solution in the present application is to assemble all functional modules of a switch into a tree structure, and fig. 2 is only an example, and cannot be used to limit the specific content of the tree structure proposed in the present application.
Further, the front-end control module receives switch test parameters input by a tester, wherein the switch test parameters comprise one or more digital subscripts. And the data control module searches nodes corresponding to the switch test parameters in the tree structure through a recursive algorithm so as to obtain the names of a plurality of functional modules to be tested. And combining the names of a plurality of functional modules to be tested into a test case set of the switch. And if the switch test parameters comprise a plurality of digital subscripts, sequentially inputting the plurality of digital subscripts into an algorithm for searching, and searching a functional module corresponding to one digital subscript and then searching a functional module corresponding to another digital subscript.
In an embodiment, if the switch test parameters input by the tester are 4, 9, and 14, the front-end control module sends the received switch test parameters to the data control module, and the data control module sequentially searches a value corresponding to Key4, a value corresponding to Key9, and a value corresponding to Key14 in the tree structure through a recursive algorithm, as shown in fig. 3, the finally found values are "Port", "PBR", "Port Mirror", that is, three function modules, namely, "Port", "PBR", and "Port Mirror", are function modules that need to be tested. The data control module combines the Port, the PBR and the Port Mirror into a test case set of the switch in an array form.
As a possible implementation, a recursive algorithm for finding the functional module runs on the data control module, as shown in fig. 4. The method specifically comprises the following steps:
and S401, stacking the root nodes of the tree structure, and setting i as a numerical subscript of the root nodes. At this time, the root node is the last node to be pushed.
S402, judging whether i is matched with the switch test parameter to be searched, namely whether i is equal to the switch test parameter to be searched, if so, executing S408. If not, S403 is executed.
And S403, judging whether the node which is finally pushed into the stack has a child node, and if so, executing S404. If not, go to step S406.
S404, traversing and acquiring all child nodes of the node which is finally pushed.
S405, stacking the first child node of the last stacked node, and repeating S402 with i being the numerical subscript of the first child node.
S406, popping the node which is pushed to the stack finally.
S407, if i is i +1, the node with the numerical index i at this time is stacked, and S402 is repeated to loop.
And S408, returning the name of the functional module corresponding to the node which is finally pushed into the stack, and ending the searching process.
In an embodiment, as shown in fig. 3 and 4, if a function module name corresponding to a node with a numerical index of 6 needs to be searched, after 6 is input into the algorithm, a root node "all" is first stacked, and at this time, there is only one root node "all" in the stack, and i is set to be the numerical index 1 of the root node. And if i is not equal to 6, continuously judging whether the root node has a child node or not. Since the root node "all" has child nodes, all the child nodes "L2", "L3" and "Port" of the root node are obtained, and then the first child node "L2" is stacked, at this time, the root node "all" and the child node "L2" exist in the stack, and "L2" is the last stacked node, and a numerical subscript 2 of "L2" is set. Continuing to determine whether i equals 6, since i does not equal 6 at this time, it is again determined whether a child node exists for node "L2". Since child nodes exist in "L2", all child nodes "acl", "arp", "mstp", "mlag" of "L2" are traversed and acquired. The first child node "acl" of "L2" is pushed, i is set to 5, and then it is determined again whether i is equal to 6. Since i is not equal to 6, it is determined whether a child node exists for node "acl". Since "acl" has no child node, pop "acl" and set i to i +1, i to 6. And then, stacking the node 'arp' with the subscript of 6, wherein the node which is finally stacked is 'arp', continuously judging whether i is equal to 6, and returning the name of the functional module corresponding to the node which is finally stacked, namely 'arp', because i is equal to 6 and the matching is successful.
It should be noted that the above embodiment is only a design idea of a recursive algorithm, and is not used to limit a specific implementation manner and a specific implementation code of the algorithm.
And S203, after the test case set is determined, the automatic switch testing device acquires the switch software version to be tested based on the switch software version path.
Specifically, after the environment deployment is completed, the tester uploads the switch software version to be tested to the FTP server, and records a path for storing the switch software version. After the test case is prepared, the tester fills the storage path of the software version of the switch and the topological configuration information of the switch in the corresponding position in the visual interface in the front-end control module, and clicks the corresponding button to start a Jenkins test task. And after receiving the starting instruction, the data control module acquires the switch software version to be tested according to the received storage path of the switch software version.
S204, the automatic testing device of the switch judges whether Jenkins pipeline tasks exist in the Jenkins server or not, and if not, a Jenkins pipeline task template is copied.
Specifically, after a Jenkins test task is started, the Jenkins control module detects whether a Jenkins pipeline task (Jenkins pipeline task) corresponding to the Jenkins test task exists in a Jenkins server or not, and if the Jenkins pipeline task exists, the Jenkins test task is constructed based on the Jenkins pipeline task. If not, calling a python Jenkins API interface to quickly copy a Jenkins pipeline task template pre-created during environment deployment to generate a Jenkins pipeline task.
S205, the automatic testing device of the switch constructs a Jenkins testing task based on a testing case set and a software version of the switch.
Specifically, the Jenkins control module executes the prepared test case set, tests the functional module codes corresponding to the test case set in the switch software version, and constructs a Jenkins test task.
As a feasible implementation mode, the Jenkins control module can simultaneously run a plurality of Jenkins test tasks by creating a plurality of threads, and the plurality of Jenkins test tasks adopt a queue waiting mechanism. Under the condition that more than one Jenkins test task is performed simultaneously, construction numbers of all Jenkins test tasks are regularly matched through a preset regular expression, a corresponding thread is created for each construction number, and then the threads are sequentially started and executed based on a preset time interval. For example, the last thread is started 0.5 seconds later and then the next thread is started, so that each thread can be guaranteed to be executed. In addition, a thread for constructing the Jenkins test task is a main thread, a sub-thread can be generated due to certain operations of a tester at the front end in the execution process of the main thread, and the main thread and the sub-thread are guaranteed to be coordinated through a thread synchronization method.
In one embodiment, a tester can control the Jenkins control module to interrupt the Jenkins test task being constructed at any time at the front-end control module, or reconstruct the interrupted Jenkins test task.
S206, the automatic testing device of the switch acquires the state information of the Jenkins testing task in real time and displays the state information on the front-end interface in real time.
Specifically, the front-end control module sends an axios request to the data control module to request to acquire the state information of the Jenkins test task. The data control module receives the request and is connected with the Jenkins control module through a python Jenkins API interface. The Jenkins control module regularly matches all construction numbers in the Jenkins test task through the python regular expression, and creates and starts a corresponding thread according to the acquired construction numbers. And the data control module calls python JenkinsAPI to acquire the state information of each thread, packages the state information into json format and sends the json format to the front-end control module. The state information at least comprises construction state information, construction progress information, construction parameter information, constructor information and the like, wherein the construction state information specifically comprises finished (idle), construction (building) and hanging (hanging). And the front-end control module displays the received json data on a visual interface for a tester to check. It should be noted that the front-end control module can quickly refresh the acquired state information in a short time, and ensure that the state information of Jenkins constructed in the background is displayed on the visual interface in real time.
And S207, the automatic testing device of the switch generates a test report and uploads the test report to a front-end interface, and the mail is pushed to a responsible person.
Specifically, after the Jenkins test task is constructed, the Jenkins control module uploads a test report to the front-end control module and writes data obtained by the test into the database, wherein the data obtained by the test comprise switch software version information, a task executor, modules tested by the Jenkins test task, switch topology configuration information, switch port configuration information, a test report and the like. And the corresponding tester is informed by the mail, at the moment, the tester/developer accesses, the front-end control module is used for carrying out data statistics and analysis, if a certain functional module fails to operate, the reason causing the operation failure is checked, and possible reasons comprise script problems, environmental problems (Jenkins and testing instruments), switch software bugs and the like.
Furthermore, after the data analysis of the tester is finished, the front-end control module stores all analysis results into the database, so that the next data analysis and the screening of the test case set are facilitated.
Further, the automatic testing device of the switch judges whether a tester restarts the Jenkins testing task, if so, the Jenkins testing task is reconstructed, and the testing and the analysis are carried out again to form a task closed loop.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art to which the embodiments of the present application pertain. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for automated testing of a switch, the method comprising:
responding to the received switch test parameters, and determining a test case set of the switch;
acquiring a switch software version to be tested based on a storage path of the switch software version;
constructing a Jenkins test task based on the test case set and the switch software version;
and acquiring the state information of the Jenkins test task in real time and displaying the state information in real time.
2. The method according to claim 1, wherein the determining a set of switch test cases in response to the received switch test parameters specifically includes:
based on the tree data structure, all the functional modules in the switch software are assembled into a tree structure; each functional module corresponds to one node in the tree structure;
marking each node in the tree structure by a numerical subscript;
based on the switch test parameters, searching corresponding nodes in the tree structure to obtain names of a plurality of functional modules to be tested; wherein the switch test parameters include one or more of the digital indices;
and combining the names of the functional modules to be tested into a test case set of the switch.
3. The method according to claim 2, wherein, based on the switch test parameters, the corresponding nodes are searched in the tree structure to obtain names of a plurality of functional modules to be tested, and the method specifically comprises:
stacking the root node of the tree structure;
after each stacking operation, judging whether the digital subscript of the last stacked node is matched with the switch test parameter;
under the condition of no match, acquiring all child nodes of the last pushed node;
and stacking the first sub-node of the last stacked node, performing the next circulation until the digital subscript of the last stacked node is matched with the switch test parameter, and returning the name of the functional module corresponding to the last stacked node.
4. The method of claim 3, wherein before retrieving all child nodes of the last pushed node, the method further comprises:
under the condition that the child node does not exist in the last pushed node, the last pushed node is pushed out, the next node of the pushed node is pushed, and circulation is carried out until the child node exists in the last pushed node; and the next node is the node corresponding to the popped node after the digital subscript of the node is added with one.
5. The method according to claim 1, wherein a Jenkins test task is constructed based on the test case suite and the switch software version, and specifically comprises:
acquiring a construction parameter based on a starting instruction; wherein the build parameters include at least one or more of: switch topology configuration information, switch port configuration information and builder information;
determining a plurality of functional modules needing to be tested in the switch software version based on the test case set;
and constructing Jenkins test tasks for the functional modules based on the construction parameters.
6. The method for automatically testing the switch according to claim 5, wherein before the Jenkins test tasks for the plurality of functional modules are constructed based on the construction parameters, the method further comprises:
determining whether Jenkins pipeline tasks corresponding to the construction parameters exist or not;
calling a python Jenkins API under the condition that Jenkins pipeline tasks corresponding to the construction parameters do not exist, copying a pre-created Jenkins pipeline task template, and generating corresponding Jenkins pipeline tasks;
and constructing the Jenkins test task through the Jenkins pipeline task.
7. The method for automatically testing the switch according to claim 5, wherein in the process of constructing the Jenkins test task, the method further comprises:
and responding to the stopping operation or the executing operation of the front end, stopping the Jenkins test task by calling a python Jenkins API (application programming interface), or reconstructing the Jenkins test task which is abnormally stopped.
8. The method for automatically testing the switch according to claim 1, wherein after constructing a Jenkins test task based on the test case suite and the switch software version, the method further comprises:
under the condition that the number of simultaneously-performed Jenkins test tasks is more than one, the construction numbers of all Jenkins test tasks are regularly matched through a preset regular expression;
creating a corresponding thread for each construction number;
and starting and executing the threads in sequence based on a preset time interval.
9. The method according to claim 1, wherein the step of obtaining and displaying the state information of the Jenkins test task in real time specifically comprises:
calling a python Jenkins sAPI interface to obtain the state information of the Jenkins test task in real time; wherein the status information comprises at least one or more of: constructing state information, progress information, parameter information and constructor information;
and visually displaying the acquired state information of each Jenkins test task in real time.
10. An automated switch testing apparatus, comprising:
the data control module is used for responding to the received switch test parameters and determining a test case set of the switch; acquiring the switch software version to be tested based on the switch software version path;
the Jenkins control module is used for constructing a Jenkins test task based on the test case set and the switch software version;
and the front-end control module is used for acquiring the state information of the Jenkins test task in real time and displaying the state information on a front-end interface in real time.
CN202110780078.XA 2021-07-09 2021-07-09 Automatic testing method and device for switch Pending CN113485928A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110780078.XA CN113485928A (en) 2021-07-09 2021-07-09 Automatic testing method and device for switch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110780078.XA CN113485928A (en) 2021-07-09 2021-07-09 Automatic testing method and device for switch

Publications (1)

Publication Number Publication Date
CN113485928A true CN113485928A (en) 2021-10-08

Family

ID=77938313

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110780078.XA Pending CN113485928A (en) 2021-07-09 2021-07-09 Automatic testing method and device for switch

Country Status (1)

Country Link
CN (1) CN113485928A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996123A (en) * 2022-05-06 2022-09-02 江苏康众汽配有限公司 Application release quality management method and system based on guarantee test
CN115208787A (en) * 2022-06-29 2022-10-18 国电南瑞科技股份有限公司 Automatic testing method and system for switch

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130042222A1 (en) * 2011-08-08 2013-02-14 Computer Associates Think, Inc. Automating functionality test cases
CN107992404A (en) * 2016-10-26 2018-05-04 中兴通讯股份有限公司 A kind of Software Automatic Testing Method and device
CN109558317A (en) * 2018-11-22 2019-04-02 网易(杭州)网络有限公司 The processing method and processing device of test case
CN110399299A (en) * 2019-07-17 2019-11-01 深圳证券交易所 The execution method of automated test frame and test case
CN110471831A (en) * 2019-06-21 2019-11-19 南京壹进制信息科技有限公司 A kind of automatic method and device of compatibility test

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130042222A1 (en) * 2011-08-08 2013-02-14 Computer Associates Think, Inc. Automating functionality test cases
CN107992404A (en) * 2016-10-26 2018-05-04 中兴通讯股份有限公司 A kind of Software Automatic Testing Method and device
CN109558317A (en) * 2018-11-22 2019-04-02 网易(杭州)网络有限公司 The processing method and processing device of test case
CN110471831A (en) * 2019-06-21 2019-11-19 南京壹进制信息科技有限公司 A kind of automatic method and device of compatibility test
CN110399299A (en) * 2019-07-17 2019-11-01 深圳证券交易所 The execution method of automated test frame and test case

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
AJIT: "Pragmatic investigation for forecasting apple area and production in Himachal Pradesh", INTERNATIONAL JOURNAL OF AGRICULTURAL AND STATISTICAL SCIENCES, vol. 16, no. 1, 31 December 2020 (2020-12-31), pages 1059 - 1065 *
孙晶;李硕;赵会群;: "基本路径测试用例自动生成的方法研究", 计算机工程与应用, no. 20, 9 April 2018 (2018-04-09) *
张海龙;刘宣;李然;唐悦;: "基于TTCN-3的宽带载波通信一致性测试系统设计", 计算机测量与控制, no. 04, 25 April 2018 (2018-04-25) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996123A (en) * 2022-05-06 2022-09-02 江苏康众汽配有限公司 Application release quality management method and system based on guarantee test
CN115208787A (en) * 2022-06-29 2022-10-18 国电南瑞科技股份有限公司 Automatic testing method and system for switch

Similar Documents

Publication Publication Date Title
US10684940B1 (en) Microservice failure modeling and testing
US5754760A (en) Automatic software testing tool
CN109189469B (en) Reflection-based android application micro-servitization method and system
Amalfitano et al. A gui crawling-based technique for android mobile application testing
Scheuner et al. Cloud work bench--infrastructure-as-code based cloud benchmarking
CN109189374B (en) Object structure code generation method and system based on object reference chain
US20070277163A1 (en) Method and tool for automatic verification of software protocols
CN111124919A (en) User interface testing method, device, equipment and storage medium
Arora et al. Web application testing: A review on techniques, tools and state of art
CN105094783A (en) Method and device for testing Android application stability
CN109240666B (en) Function calling code generation method and system based on call stack and dependent path
CN113485928A (en) Automatic testing method and device for switch
CN114297666A (en) Cloud deployment automation vulnerability mining system based on fuzzy test
Walkinshaw et al. Iterative refinement of reverse-engineered models by model-based testing
CN113590454A (en) Test method, test device, computer equipment and storage medium
Li et al. ADAutomation: An activity diagram based automated GUI testing framework for smartphone applications
Koeman et al. Automating failure detection in cognitive agent programs
Wahler et al. CAST: Automating software tests for embedded systems
Lei et al. Performance and scalability testing strategy based on kubemark
CN117931620A (en) Automatic test method for reducing test technical threshold of intelligent terminal system
Sapna et al. Prioritization of scenarios based on uml activity diagrams
Boucher et al. Transforming workflow models into automated end-to-end acceptance test cases
Püschel et al. Towards systematic model-based testing of self-adaptive software
Ryser et al. On the State of the Art in Requirements-based Validation and Test of Software
Tang Towards automation in software test life cycle based on multi-agent

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
CB02 Change of applicant information

Country or region after: China

Address after: 250101 s01-6 / F, No. 1036, Langchao Road, high tech Zone, Jinan City, Shandong Province

Applicant after: Inspur Network Technology (Shandong) Co.,Ltd.

Address before: 250101 s01-6 / F, No. 1036, Langchao Road, high tech Zone, Jinan City, Shandong Province

Applicant before: INSPUR CISCO NETWORK TECHNOLOGY Co.,Ltd.

Country or region before: China