CN109002390B - Test case parameter dynamic configuration method and device - Google Patents

Test case parameter dynamic configuration method and device Download PDF

Info

Publication number
CN109002390B
CN109002390B CN201810660673.8A CN201810660673A CN109002390B CN 109002390 B CN109002390 B CN 109002390B CN 201810660673 A CN201810660673 A CN 201810660673A CN 109002390 B CN109002390 B CN 109002390B
Authority
CN
China
Prior art keywords
test case
parameters
parameter set
parameter
target
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.)
Active
Application number
CN201810660673.8A
Other languages
Chinese (zh)
Other versions
CN109002390A (en
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.)
RADIOSKY (BEIJING) TECHNOLOGY Co.,Ltd.
THE STATE RADIO MONITORING CENTER TESTING CENTER
Tian Wei Xunda (Shanghai) Communication Technology Co.,Ltd.
Original Assignee
STATE RADIO MONITORING CENTER TESTING CENTER
Tian Wei Xunda Shanghai Communication Technology Co ltd
Radiosky Beijing 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 STATE RADIO MONITORING CENTER TESTING CENTER, Tian Wei Xunda Shanghai Communication Technology Co ltd, Radiosky Beijing Technology Co ltd filed Critical STATE RADIO MONITORING CENTER TESTING CENTER
Priority to CN201810660673.8A priority Critical patent/CN109002390B/en
Publication of CN109002390A publication Critical patent/CN109002390A/en
Application granted granted Critical
Publication of CN109002390B publication Critical patent/CN109002390B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/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/368Test management for test version control, e.g. updating test cases to a new software version

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 invention provides a method and a device for dynamically configuring test case parameters, wherein the method comprises the steps of obtaining the test case parameters from a plurality of XML files which are described with the test case parameters in advance; constructing a parameter set based on the acquired parameters of the test case, and storing the constructed parameter set into a preset parameter set list; receiving a target test case selected by a user, and searching a parameter set corresponding to the target test case from a preset parameter set list; dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set, and receiving reconfiguration of the parameters of the target test case through the parameter configuration interface; and updating the content in the XML file corresponding to the target test case based on the reconfigured parameters. The dynamic configuration process of the test case parameters of the embodiment of the invention is simple and convenient, can improve the configuration speed of the test case parameters, supports the multiplexing of the test case parameters, and has extremely high flexibility and expansibility.

Description

Test case parameter dynamic configuration method and device
Technical Field
The invention relates to the technical field of software testing, in particular to a method and a device for dynamically configuring parameters of a test case.
Background
TTCN3(Testing and Test Control notification Version 3) is an international standardized Test language, is a language specially designed for black box Testing and certification Testing, has a built-in matching determination mechanism, supports protocol conformance Testing, concurrent Testing, timer delay Testing, and the like, is a Test technology suitable for various application fields, and has been verified in large-scale and complex industrial tests such as 3G, LTE communication networks.
The test case is a basic unit of the measuring instrument, the parameters of the test case are important input configuration before the test case is started, the test case is a man-machine interface which is opened by a measuring instrument developer to a measuring instrument user, the measuring instrument user can plan a test scheme through the parameter configuration of the test case, the test case is controlled to achieve the expected test purpose, and the test case can be started to carry out the test and obtain the test result after the test parameter configuration is confirmed. The comprehensive, friendly and dynamic expansion of parameter configuration of the test case is an important index for measuring the convenience of development and use of a measuring instrument device.
The traditional protocol measuring instrument developed based on the TTCN3 language can only support the configuration of fixed test parameters, and the supported test parameter configuration is often not flexible enough and has poor expansibility. In addition, the traditional protocol measuring instrument has multiple scenes required for testing practice, strong individuation of supported parameter configuration, no dynamic configuration of the number of parameters and the range of the parameter values, and large development difficulty, high version maintenance cost and long development period for the measuring instrument.
The existing configuration method of test parameters has more problems. For example, the parameter configuration required in the test case needs to be fixed in the template of the TTCN3 code, and when the test case needs to adjust the parameter configuration therein, the original TTCN3 code needs to be modified, and the adjustment content involves a plurality of modules, which results in large workload and low expansibility. For another example, for the same test case, when different parameter configurations are required in different scenarios, codes cannot be reused, so that multiple software versions need to be maintained, and the method is poor in universality and high in maintenance cost.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a method and apparatus for dynamic configuration of test case parameters that overcomes or at least partially solves the above problems.
According to an aspect of the present invention, a method for dynamically configuring test case parameters is provided, including:
acquiring test case parameters from a plurality of XML files which are described with the test case parameters in advance;
parameter sets are constructed based on the obtained test case parameters, and the constructed parameter sets are stored in the preset parameter set list, wherein one parameter set is constructed by the test case parameters corresponding to one test case;
receiving a target test case selected by a user, and searching a parameter set corresponding to the target test case from the preset parameter set list;
dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set, and receiving reconfiguration of the parameters of the target test case through the parameter configuration interface;
and updating the content in the XML file corresponding to the target test case based on the reconfigured parameters.
Optionally, each parameter set identifier in the preset parameter set list has a unique identifier of a corresponding test case, and the receiving a target test case selected by a user and searching a parameter set corresponding to the target test case from the preset parameter set list includes:
receiving a target test case selected by a user, and acquiring a unique identifier of the target test case;
and searching a parameter set corresponding to the unique identifier of the target test case from a preset parameter set list.
Optionally, before obtaining the test case parameters from the plurality of XML files in which the test case parameters are described in advance, the method further includes: and loading a plurality of XML files which are described with test case parameters in advance.
Optionally, loading a plurality of XML files in which test case parameters are described in advance includes:
searching a TestScript folder under a test program directory, and traversing different test scene folders from a next-level directory of the TestScript folder, wherein the test scene folders store the XML files in advance;
and loading XML files corresponding to different test cases from each test scene folder.
Optionally, the parameters in the parameter set include a display sequence, and the dynamically generating a corresponding parameter configuration interface according to the found parameters in the parameter set includes:
and according to the display sequence, displaying the parameter configuration control corresponding to each test case parameter in the searched parameter set in the display control, and dynamically generating a corresponding parameter configuration interface based on the displayed parameter configuration control.
Optionally, updating the content in the XML file corresponding to the target test case based on the reconfigured parameter includes:
updating the parameter set corresponding to the target test case in the preset parameter set list by using the reconfigured parameters;
and updating the content in the corresponding XML file according to the updated parameter set corresponding to the target test case.
Optionally, the method further comprises: and testing the program to be tested by the target test case with the reconfigured parameters through the test case execution tool.
Optionally, the testing the program to be tested by the target test case with the reconfigured parameters through the test case execution tool includes:
matching a predefined test case encoder corresponding to the target test case with the reconfigured parameters through a test case execution tool;
reading the test case parameters in the updated XML file corresponding to the target test case, and encoding the read test case parameters by using a successfully matched test case encoder according to a preset protocol to generate protocol data;
and sending the protocol data to a program to be tested, and testing the program to be tested.
Optionally, matching, by the target test case with the reconfigured parameters, a predefined test case encoder corresponding to the target test case through the test case execution tool includes:
calling a corresponding test function by the target test case with the reconfigured parameters through the test case execution tool, wherein a test template is defined in the form parameters of the test function;
and acquiring a corresponding test template based on the called test function, and matching a predefined test case encoder according to the type of the test template.
According to another aspect of the present invention, there is also provided a test case parameter dynamic configuration apparatus, including:
the acquisition module is suitable for acquiring the test case parameters from a plurality of XML files which are described with the test case parameters in advance;
the construction module is suitable for constructing parameter sets based on the acquired test case parameters and storing the constructed parameter sets into the preset parameter set list, wherein one parameter set is constructed by the test case parameters corresponding to one test case;
the receiving module is suitable for receiving a target test case selected by a user and searching a parameter set corresponding to the target test case from the preset parameter set list;
the generating module is suitable for dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set, and receiving the reconfiguration of the parameters of the target test case through the parameter configuration interface;
and the updating module is suitable for updating the content in the XML file corresponding to the target test case based on the reconfigured parameters.
In the embodiment of the invention, the parameter set is constructed based on the obtained test case parameters by obtaining the test case parameters from a plurality of XML files which are described with the test case parameters in advance, and the constructed parameter set is stored in the preset parameter set list, so that the parameter set corresponding to the target test case can be directly searched from the preset parameter set list after the target test case selected by a user is received. And then, dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set corresponding to the target test case. The user can reconfigure the parameters of the target test case through the parameter configuration interface, and further update the content in the XML file corresponding to the target test case based on the reconfigured parameters. Therefore, the embodiment of the invention describes the parameters of the test case based on the XML file and generates the corresponding parameter configuration interface according to the parameters of the test case, so that the parameters of the test case can be directly adjusted through the parameter configuration interface, and the contents in the XML file, such as the addition, modification, deletion and the like of the parameters, are modified based on the adjusted parameters of the test case.
Furthermore, the parameter set is stored in the preset parameter set list, and when the test case parameters or the parameter set are used subsequently, the parameter set can be directly obtained from the preset parameter set list without traversing the content in each XML file, so that the obtaining efficiency of the test case parameters can be improved.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, taken in conjunction with the accompanying drawings.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow diagram illustrating a method for dynamic configuration of test case parameters, according to one embodiment of the invention;
FIG. 2 is a diagram illustrating a process of loading an XML file and obtaining test case parameters in the XML file according to one embodiment of the invention;
FIG. 3 is a schematic structural diagram of a device for dynamically configuring test case parameters according to an embodiment of the present invention; and
fig. 4 is a schematic structural diagram of a test case parameter dynamic configuration apparatus according to another embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In order to solve the above technical problem, an embodiment of the present invention provides a method for dynamically configuring test case parameters, where the method may be applied to a test case based on TTCN3 language to perform a dynamic configuration process of test case parameters. FIG. 1 is a flowchart illustrating a method for dynamically configuring test case parameters according to an embodiment of the present invention. Referring to fig. 1, the method includes at least steps S102 to S110.
Step S102, obtaining the test case parameters from a plurality of XML files described with the test case parameters in advance.
The step describes the test parameters based on the XML file, and the adjustment of the parameters of the test case can be conveniently realized by modifying the nodes in the XML file in the subsequent process.
And step S104, constructing parameter sets based on the acquired test case parameters, and storing the constructed parameter sets into a preset parameter set list, wherein one parameter set is constructed by the test case parameters corresponding to one test case.
And step S106, receiving the target test case selected by the user, and searching a parameter set corresponding to the target test case from the preset parameter set list.
In this step, each parameter set identifier in the preset parameter set list has a unique identifier of a corresponding test case, and when a parameter set corresponding to a target test case is searched from the preset parameter set list, the unique identifier of the target test case may be obtained first, and then the parameter set corresponding to the unique identifier of the target test case is searched from the preset parameter set list.
Step S108, dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set, and receiving the reconfiguration of the parameters of the target test case through the parameter configuration interface.
In this step, the reconfiguration of the target test case parameters may include configuration operations such as addition, deletion, modification, and the like of the parameters.
Step S110, updating the content in the XML file corresponding to the target test case based on the reconfigured parameters.
In this step, when the content in the XML file corresponding to the target test case is updated based on the reconfigured parameters, the parameter set corresponding to the target test case in the preset parameter set list may be updated first by using the reconfigured parameters, and then the content in the corresponding XML file is updated according to the updated parameter set corresponding to the target test case.
The embodiment of the invention describes the parameters of the test case based on the XML file and generates the corresponding parameter configuration interface according to the parameters of the test case, so that the parameters of the test case can be directly adjusted through the parameter configuration interface, the contents in the XML file are modified based on the adjusted parameters of the test case, such as the addition, modification, deletion and the like of the parameters, the process does not need to modify the codes in the test program at all, the parameter adjustment process is simple and convenient, the adjustment speed of the parameters of the test case is improved, the multiplexing of the parameters of the test case can be supported, and the invention has extremely high flexibility and expansibility. Furthermore, the parameter set is stored in the preset parameter set list, and when the test case parameters or the parameter set are used subsequently, the parameter set can be directly obtained from the preset parameter set list without traversing the content in each XML file, so that the obtaining efficiency of the test case parameters can be improved.
Referring to step S102, in an embodiment of the present invention, when obtaining the test case parameters from the multiple XML files in which the test case parameters are described in advance, the multiple XML files in which the test case parameters are described in advance need to be loaded first, and then the test case parameters are obtained from the loaded XML files. Referring to fig. 2, the following describes a process of loading a plurality of XML files with test case parameters described in advance and obtaining the test case parameters.
And S202, searching a TestScript folder in the test program directory. The test program is the currently executing program.
And step S204, traversing different test scene folders from the next-level directory of the TestScript folder, wherein XML files with test case parameters described in advance are stored in the test scene folders.
And S206, sequentially reading XML files corresponding to different test cases in the test scene folder.
The scheme can read XML configuration files in different test scenes, so that a test program in test software developed based on the scheme can support the test of a multi-scene test mode.
And S208, verifying the format of the read XML file, and judging whether the verification is successful, if so, executing the step S210, and if not, executing the step S206.
In this step, the verification information content for verifying the format of the XML file is set in advance in the XML file. The verification information may include verification information regarding the type, scope, etc. of the test case parameters in the XML file.
And step S210, obtaining the parameters of the test case from the read XML file.
Step S212, determining whether reading of all XML files in different test scene folders is completed, if yes, ending, and if not, executing step S206.
In conjunction with step S104, it has been described above that the test case parameters corresponding to one test case construct one parameter set. In this embodiment, the process of obtaining the test case parameters from the read XML file, constructing the parameter set based on the obtained test case parameters, and storing the parameter set in the preset parameter set list may be as follows: and sequentially and circularly traversing all nodes in the XML file, storing the attribute in each line of nodes in the XML file into a corresponding parameter set structure, and then inserting the parameter set structure into a predefined parameter set list.
The XML file of the embodiment of the invention can adopt a tree-shaped layered structure form, and the beginning of the file is provided with a file description statement for describing the version number and the coding mode of the file. The following is a root node params parameter set, the root node is followed by a param parameter child node, the param has 14 attributes, including id unique identifier, order display order, name parameter name, title parameter display title, value parameter value, select value selection value, defaultValue default value, unit, type control type, enable is operable or not, visible is not displayed, min minimum value, max maximum value, hit prompt information. The type control type comprises an input box, a select pull-down list box and a table pop-up table, and is used for providing different types of display modes. The XML file is adopted to construct the configuration parameters of the test case, the separation of the parameters and the program can be effectively realized, and only the content in the XML file needs to be modified when the parameters of the test case are modified, and the program code does not need to be modified.
An embodiment of the present invention provides a partial content of an XML file, as follows:
Figure BDA0001706687880000071
referring to step S106 above, in an embodiment of the present invention, when the corresponding parameter configuration interface is dynamically generated according to the searched parameters in the parameter set, the parameter configuration control corresponding to each test case parameter may be displayed in a display control (e.g., a Grid control) according to an order display sequence in the parameter set, where the parameter configuration control is used to configure the corresponding test case parameter, so as to dynamically generate the corresponding parameter configuration interface based on the displayed parameter configuration control. The dynamic generation of the parameter configuration interface by using the parameters in the parameter set is also an initialization process for the display control, such as initializing the contents of the title, the display sequence, the type, the default value and the like of the display control according to the parameters of the test case.
In this embodiment, the preset parameter set list may also include some default parameters that the user cannot modify. Therefore, it is also necessary to determine whether the default parameter contains a visible that displays "true" or does not display "false" by traversing each parameter set in the preset parameter set list.
If the visual is "false", it is skipped directly and the visual of the next parameter set is looked up until the last parameter set in the parameter set list is preset. If the visual is "true", a line is dynamically inserted into the GRID (display control), wherein the first column is a hidden id value, the second column is a title of title, the third column is a value field of the parameter, and the fourth column is a unit value. The value field control is initialized according to the type value, tpye is an input box with an "input" control as a default, tpye is a "select" control for dynamically creating a drop-down list box, tpye is a "table" control for an insert button, and for example, if tpye is a "select", a drop-down list option can be filled with a value of select value.
Furthermore, it is also possible to read "value" to fill the value field of the parameter, "enable" is read, and if "enable" is read as "false", the value field after filling the parameter will be set as not modifiable.
In an embodiment of the present invention, after the content in the XML file corresponding to the target test case is updated based on the reconfigured parameters, the target test case with the reconfigured parameters may be used to test the program to be tested through the test case execution tool. The specific test process is as follows:
first, the target test case with the reconfigured parameters is matched with the corresponding predetermined test case encoder through the test case execution tool.
And then, reading the test case parameters in the updated XML file corresponding to the target test case, and encoding the read test case parameters by using a successfully matched test case encoder according to a preset protocol to generate protocol data.
And finally, sending the protocol data to the program to be tested, and testing the program to be tested.
In this embodiment, when the target test case with the reconfigured parameters is matched with the predefined test case encoder corresponding to the target test case through the test case execution tool, the corresponding test function may be called by the target test case with the reconfigured parameters through the test case execution tool, where the form parameters of the test function define the test template. And then acquiring a corresponding test template based on the called test function, and matching a predefined test case encoder according to the type of the test template.
In order to more clearly embody the process of testing the program under test by using the test case after reconfiguring the parameters, an embodiment of the invention is described in detail below. For example, the target test case is a test case designed based on TTCN, and the TTCN test case mentioned herein refers to a test case after the parameters are reconfigured.
Firstly, a user clicks to start executing a test program, and a TTCN test case is started.
And step two, the TTCN test case calls a corresponding test function, a template is defined in the form parameter of the function, and a predefined coder is matched according to the template type.
And thirdly, acquiring the ID of the test case, and searching the corresponding updated XML file from different scene folders according to the ID of the test case. The XML file not only describes the parameters of the test case, but also includes ID identifiers for identifying which parameters of the test case are.
And fourthly, traversing the parameters of each node in the XML file, and putting the parameter name and the parameter value into the dictionary.
And fifthly, reading the content in the dictionary, and encoding the read content by an encoder according to the requirement of a preset protocol format to generate protocol data.
And sixthly, the encoder sends the coded protocol data to the program to be tested so as to test the program to be tested.
And seventhly, receiving the feedback information of the program to be tested, calling the corresponding test function, and matching a predefined decoder according to the template type in the function so as to decode the feedback information.
For example, the feedback information returned includes identification information of test failure, test success, need for retesting, and the like.
The embodiment of the invention can also uniformly convert the reconfigured parameters into dictionary keys/values, such as names/values, can realize the uniformity of interfaces and improve the expansibility and flexibility of software. According to the scheme, the rapid development of the parameter configuration of the test case can be realized without modifying a software program, and the expansibility and the universality of software in the instrument device are improved on the basis of the specialty of the instrument device measured by using a TTCN3 language development protocol. In addition, different XML files are only needed to be configured in different test scenes, the software only has one version, and the unified software version greatly improves the research and development efficiency and the maintenance efficiency of the software in the measuring instrument device.
In addition, if the embodiment of the invention develops the test case based on the TTCN3 language, the test in the aspects of protocol consistency, parallelism, time delay and the like can be supported, and the test process can be supported to be displayed graphically, and the information receiving and sending of each protocol interaction and the judgment in the process can be displayed visually.
Based on the same inventive concept, an embodiment of the present invention further provides a device for dynamically configuring test case parameters, and fig. 3 illustrates a schematic structural diagram of the device for dynamically configuring test case parameters according to an embodiment of the present invention. Referring to fig. 3, the apparatus 400 for dynamically configuring test case parameters at least includes an obtaining module 410, a constructing module 420, a receiving module 430, a generating module 440, and an updating module 450.
The functions of the components or devices of the device 400 and the connection relationships between the components will be described in the embodiment of the present invention based on the test case parameters:
an obtaining module 410, adapted to obtain test case parameters from a plurality of XML files in which the test case parameters are described in advance;
a constructing module 420, coupled to the obtaining module 410, adapted to construct a parameter set based on the obtained test case parameters, and store the constructed parameter set in a preset parameter set list, where a parameter set is constructed for a test case parameter corresponding to one test case;
a receiving module 430, coupled to the constructing module 420, adapted to receive the target test case selected by the user, and search a parameter set corresponding to the target test case from a preset parameter set list;
the generating module 440 is coupled to the receiving module 430, and is adapted to dynamically generate a corresponding parameter configuration interface according to the searched parameters in the parameter set, and receive reconfiguration of the parameters of the target test case through the parameter configuration interface;
the updating module 450, coupled to the generating module 440, is adapted to update the content in the XML file corresponding to the target test case based on the reconfigured parameters.
In an embodiment of the present invention, if each parameter set identifier in the preset parameter set list has a unique identifier of a corresponding test case, the receiving module 430 is further adapted to receive a target test case selected by a user, obtain the unique identifier of the target test case, and search for a parameter set corresponding to the unique identifier of the target test case from the preset parameter set list.
In an embodiment of the present invention, if the parameters in the parameter set include a display sequence, the generating module 440 is further adapted to display the parameter configuration control corresponding to each test case parameter in the display control according to the display sequence of the parameter identifier in the parameter set, and dynamically generate a corresponding parameter configuration interface based on the displayed parameter configuration control.
In an embodiment of the present invention, the updating module 450 is further adapted to update the parameter set corresponding to the target test case in the preset parameter set list by using the reconfigured parameter, and update the content in the corresponding XML file according to the updated parameter set corresponding to the target test case.
In an embodiment of the present invention, referring to fig. 4, the dynamic configuration apparatus 400 for test case parameters may further include a loading module 460 and a testing module 470 in addition to the above modules.
The loading module 460, coupled to the obtaining module 410, is adapted to load the XML files with the test case parameters described in advance before the obtaining module 410 obtains the test case parameters from the XML files with the test case parameters described in advance.
The test module 470, coupled to the update module 450, is adapted to test the program to be tested by the target test case with reconfigured parameters through the test case execution tool.
In an embodiment of the present invention, the loading module 460 is further adapted to search the TestScript folder in the test program directory, traverse different test scenario folders from the next-level directory of the TestScript folder, where XML files are stored in the test scenario folders in advance, and load XML files corresponding to different test cases from each test scenario folder.
In an embodiment of the present invention, the test module 470 is further adapted to match, by the target test case with the reconfigured parameters through the test case execution tool, the predefined test case encoder corresponding to the target test case, read the test case parameters in the updated XML file corresponding to the target test case, encode the read test case parameters according to the preset protocol by using the test case encoder successfully matched, generate protocol data, send the protocol data to the program to be tested, and test the program to be tested.
In an embodiment of the present invention, the test module 470 is further adapted to call a corresponding test function through a test case execution tool by the target test case with reconfigured parameters, where a form parameter of the test function defines a test template, obtain the corresponding test template based on the called test function, and match a predefined test case encoder according to a type of the test template.
According to any one or a combination of the above preferred embodiments, the following advantages can be achieved by the embodiments of the present invention:
in the embodiment of the invention, the parameter set is constructed based on the obtained test case parameters by obtaining the test case parameters from a plurality of XML files which are described with the test case parameters in advance, and the constructed parameter set is stored in the preset parameter set list, so that the parameter set corresponding to the target test case can be directly searched from the preset parameter set list after the target test case selected by a user is received. And then, dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set corresponding to the target test case. The user can reconfigure the parameters of the target test case through the parameter configuration interface, and further update the content in the XML file corresponding to the target test case based on the reconfigured parameters. Therefore, the embodiment of the invention describes the parameters of the test case based on the XML file and generates the corresponding parameter configuration interface according to the parameters of the test case, so that the parameters of the test case can be directly adjusted through the parameter configuration interface, and the contents in the XML file, such as the addition, modification, deletion and the like of the parameters, are modified based on the adjusted parameters of the test case. Furthermore, the parameter set is stored in the preset parameter set list, and when the test case parameters or the parameter set are used subsequently, the parameter set can be directly obtained from the preset parameter set list without traversing the content in each XML file, so that the obtaining efficiency of the test case parameters can be improved.
It is clear to those skilled in the art that the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and for the sake of brevity, further description is omitted here.
In addition, the functional units in the embodiments of the present invention may be physically independent of each other, two or more functional units may be integrated together, or all the functional units may be integrated in one processing unit. The integrated functional units may be implemented in the form of hardware, or in the form of software or firmware.
Those of ordinary skill in the art will understand that: the integrated functional units, if implemented in software 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 computing device (e.g., 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 when the instructions are executed. And the aforementioned storage medium includes: u disk, removable hard disk, Read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disk, and other various media capable of storing program code.
Alternatively, all or part of the steps of implementing the foregoing method embodiments may be implemented by hardware (such as a computing device, e.g., a personal computer, a server, or a network device) associated with program instructions, which may be stored in a computer-readable storage medium, and when the program instructions are executed by a processor of the computing device, the computing device executes all or part of the steps of the method according to the embodiments of the present invention.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments can be modified or some or all of the technical features can be equivalently replaced within the spirit and principle of the present invention; such modifications or substitutions do not depart from the scope of the present invention.

Claims (8)

1. A test case parameter dynamic configuration method comprises the following steps:
acquiring test case parameters from a plurality of XML files which are described with the test case parameters in advance;
the method comprises the steps of constructing parameter sets based on acquired test case parameters, and storing the constructed parameter sets into a preset parameter set list, wherein one parameter set is constructed by test case parameters corresponding to one test case;
receiving a target test case selected by a user, and searching a parameter set corresponding to the target test case from the preset parameter set list;
dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set, and receiving reconfiguration of the parameters of the target test case through the parameter configuration interface;
updating the content in the XML file corresponding to the target test case based on the reconfigured parameters;
wherein, the parameters in the parameter set include a display sequence, and the dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set includes:
according to the display sequence, displaying the parameter configuration control corresponding to each test case parameter in the searched parameter set in a display control;
dynamically generating a corresponding parameter configuration interface based on the displayed parameter configuration control;
wherein the updating the content in the XML file corresponding to the target test case based on the reconfigured parameters includes:
updating the parameter set corresponding to the target test case in the preset parameter set list by using the reconfigured parameters;
and updating the content in the corresponding XML file according to the updated parameter set corresponding to the target test case.
2. The method of claim 1, wherein each parameter set in the preset parameter set list identifies a unique identifier of a corresponding test case, and the receiving a target test case selected by a user and searching for the parameter set corresponding to the target test case from the preset parameter set list comprises:
receiving a target test case selected by a user, and acquiring a unique identifier of the target test case;
and searching a parameter set corresponding to the unique identifier of the target test case from a preset parameter set list.
3. The method according to claim 1 or 2, wherein before obtaining the test case parameters from the plurality of XML files in which the test case parameters are described in advance, the method further comprises: and loading a plurality of XML files which are described with test case parameters in advance.
4. The method of claim 3, wherein loading a plurality of XML files pre-described with test case parameters comprises:
searching a TestScript folder under a test program directory;
traversing different test scene folders from a next-level directory of the TestScript folder, wherein the test scene folder is pre-stored with the XML file;
and loading XML files corresponding to different test cases from each test scene folder.
5. The method of claim 1 or 2, further comprising:
and testing the program to be tested by the target test case with the reconfigured parameters through the test case execution tool.
6. The method according to claim 1 or 2, wherein the step of testing the program to be tested through the test case execution tool by the target test case after the parameters are reconfigured comprises the following steps:
matching a predefined test case encoder corresponding to the target test case with the reconfigured parameters through a test case execution tool;
reading the test case parameters in the updated XML file corresponding to the target test case, and encoding the read test case parameters by using a successfully matched test case encoder according to a preset protocol to generate protocol data;
and sending the protocol data to a program to be tested, and testing the program to be tested.
7. The method of claim 6, wherein matching the predefined test case encoder corresponding thereto by the test case execution tool from the reconfigured target test case comprises:
calling a corresponding test function by the target test case with the reconfigured parameters through the test case execution tool, wherein a test template is defined in the form parameters of the test function;
and acquiring a corresponding test template based on the called test function, and matching a predefined test case encoder according to the type of the test template.
8. A dynamic configuration device for test case parameters comprises:
the acquisition module is suitable for acquiring the test case parameters from a plurality of XML files which are described with the test case parameters in advance;
the construction module is suitable for constructing parameter sets based on the acquired test case parameters and storing the constructed parameter sets into a preset parameter set list, wherein one parameter set is constructed by the test case parameters corresponding to one test case;
the receiving module is suitable for receiving a target test case selected by a user and searching a parameter set corresponding to the target test case from the preset parameter set list;
the generating module is suitable for dynamically generating a corresponding parameter configuration interface according to the searched parameters in the parameter set, and receiving the reconfiguration of the parameters of the target test case through the parameter configuration interface;
the updating module is suitable for updating the content in the XML file corresponding to the target test case based on the reconfigured parameters;
wherein the parameters in the parameter set include a presentation order, the generation module is further adapted to: the found parameter set is provided with parameter configuration controls corresponding to the parameters of the test cases; dynamically generating a corresponding parameter configuration interface based on the displayed parameter configuration control;
the update module is further adapted to: updating the parameter set corresponding to the target test case in the preset parameter set list by using the reconfigured parameters; and updating the content in the corresponding XML file according to the updated parameter set corresponding to the target test case.
CN201810660673.8A 2018-06-25 2018-06-25 Test case parameter dynamic configuration method and device Active CN109002390B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810660673.8A CN109002390B (en) 2018-06-25 2018-06-25 Test case parameter dynamic configuration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810660673.8A CN109002390B (en) 2018-06-25 2018-06-25 Test case parameter dynamic configuration method and device

Publications (2)

Publication Number Publication Date
CN109002390A CN109002390A (en) 2018-12-14
CN109002390B true CN109002390B (en) 2021-07-27

Family

ID=64600730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810660673.8A Active CN109002390B (en) 2018-06-25 2018-06-25 Test case parameter dynamic configuration method and device

Country Status (1)

Country Link
CN (1) CN109002390B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109359057A (en) * 2018-12-25 2019-02-19 上海创功通讯技术有限公司 A kind of application testing method and equipment
CN110618927A (en) * 2019-06-20 2019-12-27 北京无限光场科技有限公司 Method and apparatus for testing applications
CN110781088A (en) * 2019-10-30 2020-02-11 口碑(上海)信息技术有限公司 Software system testing method and device
CN111209195B (en) * 2019-12-30 2023-08-15 瑞庭网络技术(上海)有限公司 Method and device for generating test case

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102665231A (en) * 2012-05-23 2012-09-12 北京中创信测科技股份有限公司 Method of automatically generating parameter configuration file for LTE (Long Term Evolution) system
CN102760062A (en) * 2012-06-19 2012-10-31 株洲南车时代电气股份有限公司 Parameter setting method for embedded software based on rail transit
CN103186460A (en) * 2011-12-30 2013-07-03 金蝶软件(中国)有限公司 Method, device and system for generating script of test case
CN107844349A (en) * 2017-10-19 2018-03-27 上海斐讯数据通信技术有限公司 A kind of control method and device based on user interface

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9379855B2 (en) * 2013-06-03 2016-06-28 MiCOM Labs, Inc. Method and apparatus for a remote modular test system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103186460A (en) * 2011-12-30 2013-07-03 金蝶软件(中国)有限公司 Method, device and system for generating script of test case
CN102665231A (en) * 2012-05-23 2012-09-12 北京中创信测科技股份有限公司 Method of automatically generating parameter configuration file for LTE (Long Term Evolution) system
CN102760062A (en) * 2012-06-19 2012-10-31 株洲南车时代电气股份有限公司 Parameter setting method for embedded software based on rail transit
CN107844349A (en) * 2017-10-19 2018-03-27 上海斐讯数据通信技术有限公司 A kind of control method and device based on user interface

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于TTCN-3重建测试架构的设计与实现";张德民等;《自动化仪表》;20160331;第37卷(第3期);第13-16页 *

Also Published As

Publication number Publication date
CN109002390A (en) 2018-12-14

Similar Documents

Publication Publication Date Title
CN109002390B (en) Test case parameter dynamic configuration method and device
CN106919509B (en) Client generation method and device and electronic equipment
US9218269B2 (en) Testing multiple target platforms
CN106874176B (en) Intelligent test method and device
CN107436844B (en) Method and device for generating interface use case aggregate
WO2017133447A1 (en) Intelligent device control method and apparatus, and computer storage medium
US20150286362A1 (en) Method and apparatus for automatic device program generation
CN106776314B (en) Test system
CN107066377B (en) Page element obtaining method based on Android system and terminal equipment
CN108038212B (en) Data interaction method, device, system, equipment and storage medium
CN108664546B (en) XML data structure conversion method and device
CN108804100A (en) Create method, apparatus, storage medium and the mobile terminal of interface element
CN108664505B (en) Method and device for exporting database table structure
CN107092474B (en) Program development method, ETL processing method and device
CN108259199B (en) Automatic command generation method and device
KR102274664B1 (en) Universal qar test control apparatus and method with dynamic interface message configuration
CN111382051B (en) API automatic test method and test device
WO2023029881A1 (en) Device control method and apparatus
CN109542357B (en) Command parameter assembling method, system, equipment and computer storage medium
CN115169294A (en) Data conversion method, device and medium
US11799724B2 (en) Internet-of-things model-based virtual internet-of-things device generation method and apparatus
CN114489594A (en) Method for constructing command parser, method and device for processing command parsing
CN113568614A (en) Task issuing method, electronic device and storage medium
CN112035360A (en) Middleware testing method and device, computer equipment and readable storage medium
CN109165049A (en) Module data processing method and processing device

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190524

Address after: 100041 China Radio Detection Building, 30 Shixing Street, Shijingshan District, Beijing

Applicant after: Tianwei Xunda (Beijing) Technology Co., Ltd.

Applicant after: Tian Wei Xunda (Shanghai) Communication Technology Co., Ltd.

Address before: 100041 China Radio Detection Building, 30 Shixing Street, Shijingshan District, Beijing

Applicant before: Tianwei signal (Beijing) Technology Co., Ltd.

CI02 Correction of invention patent application

Correction item: Applicant|Address|Applicant

Correct: Tianwei Schindler (Beijing) Technology Co., Ltd.|100041 China Radio Detection Building, 30 Shixing Street, Shijingshan District, Beijing|Tian Wei Xunda (Shanghai) Communication Technology Co., Ltd.

False: Tianwei Xunda (Beijing) Technology Co., Ltd.|100041 China Radio Detection Building, 30 Shixing Street, Shijingshan District, Beijing|Tian Wei Xunda (Shanghai) Communication Technology Co., Ltd.

Number: 24-02

Volume: 35

CI02 Correction of invention patent application
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Tao Hongbo

Inventor after: Wen He

Inventor after: Cao Jingnan

Inventor before: Wen He

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210209

Address after: 100041 China Radio Detection Building, 30 Shixing Street, Shijingshan District, Beijing

Applicant after: RADIOSKY (BEIJING) TECHNOLOGY Co.,Ltd.

Applicant after: Tian Wei Xunda (Shanghai) Communication Technology Co.,Ltd.

Applicant after: THE STATE RADIO MONITORING CENTER TESTING CENTER

Address before: 100041 China Radio Detection Building, 30 Shixing Street, Shijingshan District, Beijing

Applicant before: RADIOSKY (BEIJING) TECHNOLOGY Co.,Ltd.

Applicant before: Tian Wei Xunda (Shanghai) Communication Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant