WO2016180237A1 - Northbound interface test apparatus and test method for northbound interface - Google Patents

Northbound interface test apparatus and test method for northbound interface Download PDF

Info

Publication number
WO2016180237A1
WO2016180237A1 PCT/CN2016/080394 CN2016080394W WO2016180237A1 WO 2016180237 A1 WO2016180237 A1 WO 2016180237A1 CN 2016080394 W CN2016080394 W CN 2016080394W WO 2016180237 A1 WO2016180237 A1 WO 2016180237A1
Authority
WO
WIPO (PCT)
Prior art keywords
script
module
execution module
execution
command
Prior art date
Application number
PCT/CN2016/080394
Other languages
French (fr)
Chinese (zh)
Inventor
吴高科
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016180237A1 publication Critical patent/WO2016180237A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing

Definitions

  • the present application relates to, but is not limited to, the field of computer testing technology, and in particular to a northbound interface testing device and a northbound interface testing method.
  • the northbound interface provides the device vendor with an interface to the carrier.
  • the northbound interface can be used to monitor the device of each device vendor and monitor the alarm, performance, and services of the device.
  • 3G third-generation mobile communication technology
  • 4G fourth-generation mobile communication technology
  • the northbound interface plays an increasingly important role as a bridge between operators and equipment manufacturers.
  • the performance of the northbound interface has become an important feature of device manufacturers.
  • the current mainstream northbound interface includes a Common Object Request Broker Architecture (CORBA) interface, a multi technology operations systems interface (MTOSI) interface, and a new generation of software-defined networks.
  • CORBA Common Object Request Broker Architecture
  • MTOSI multi technology operations systems interface
  • SDN Software Defined Network
  • These mainstream northbound interfaces usually define their own service interfaces based on specific protocol standards. However, due to the large number of service interfaces, when testing the service interface of the northbound interface using the test tool of the related technology, the service interface needs to be hard coded according to the function of the service interface of the northbound interface to be tested. Therefore, only the test is performed.
  • the fixed function of the service interface can be tested by hard coding the service interface of the northbound interface, which results in a large limitation on the automatic test capability of the northbound interface.
  • the embodiment of the present invention provides a test method for a northbound interface test device and a northbound interface, so as to implement a service interface by hard coding a service interface of a northbound interface when testing a northbound interface by using a test tool in the related art.
  • the fixed function is tested, which leads to a problem of large restrictions on the automated test capability of the northbound interface.
  • an embodiment of the present invention provides a northbound interface testing device, including: a script execution module and a command execution module;
  • the script execution module is configured to: execute a script use case in a pre-developed script, invoke a corresponding request message according to the script use case, and send an execution command including the request message to the command execution module;
  • the command execution module is configured to: perform a corresponding test operation according to the content of the request message, and return an execution result to the script execution module, where the request message is used for a northbound interface of the current test. The corresponding communication interface is tested.
  • the script execution example currently executed by the script execution module includes a task of testing a notification
  • the northbound interface testing device further includes: a notification receiving module
  • the script execution module is further configured to: after executing the script use case, send a first subscription command to the notification receiving module;
  • the notification receiving module is configured to: obtain a test notification indicated by the first subscription command, and return the obtained test notification to the script execution module;
  • the script execution module is further configured to: send an unsubscribe command to the notification receiving module.
  • the northbound interface testing device further includes: an initialization module and a script loading module;
  • the initialization module is configured to: before the script execution module executes the script use case in the pre-developed script, the initialization script loading module loads the pre-developed script, initializes parameters of the command execution module, and receives the notification Module execution module.
  • the script use case of the block execution is obtained according to the script load module loading each script use case in the script, the script includes the script use case and a script method, and the script method is an execution method of the script use case ;
  • the notification receiving module is further configured to: continuously receive a notification sent by the server after initialization.
  • the current test northbound interface is a Common Object Request Broker Architecture (CORBA) interface
  • the initialization module is initialized by: Parameters of the command execution module: Initialize Object Request Broker (ORB);
  • the initialization module initializes parameters of the notification receiving module by: instructing, by an object management organization (OMG) standard, that the notification receiving module invokes receiving a notification sent by the server;
  • OMG object management organization
  • the initialization module is further configured to: before the script execution module executes the script use case, send a login command to the script execution module, where the login command includes a login script method;
  • the script execution module is further configured to: execute the login script method according to the login command, invoke a corresponding login request message according to the login script method, and send the login command to the command execution module. Request execution message of the message;
  • the command execution module is further configured to: perform a dynamic call of CORBA according to the received login request message, and return an execution result to the script execution module.
  • the currently tested northbound interface is a multi-technology operating system (MTOSI) interface or a northbound direction of a software-defined network (SDN).
  • the initialization module initializes parameters of the command execution module by initializing a uniform resource locator (URL) for constructing a hypertext transfer protocol (HTTP) request message;
  • URL uniform resource locator
  • HTTP hypertext transfer protocol
  • the initialization module initializes parameters of the notification receiving module by: subscribing to an MTOSI notification;
  • the notification receiving module is further configured to: initialize the notification receiving at the initialization module After the parameter of the module, sending a second subscription command to the script execution module, where the second subscription command includes a script method of the subscription;
  • the script execution module is further configured to: execute the subscribed script method according to the second subscription command, invoke a corresponding subscription request message according to the subscribed script method, and send the include to the command execution module Executing a subscription request message for the subscription request message;
  • the command execution module is further configured to: execute an HTTP request call according to the subscription request message, and return an execution result to the script execution module.
  • the northbound interface testing device further includes a result generating module
  • the script execution module is further configured to: after the command execution module returns the execution result to the script execution module, transmit the execution result to the result generation module;
  • the result generating module is configured to: output the execution result, wherein the execution result includes all northbound interfaces that have been tested, and the number of tests and the test time of each of the northbound interfaces.
  • any one of the first to fourth possible implementation manners of the first aspect in a sixth possible implementation manner,
  • the script execution module executes the script use case in the following manner: in order of each script use case in the script; and/or,
  • the northbound interface test device further includes a recording module, and the script execution module is further configured to: send the execution information and the abnormality information of the script use case to the recording module during execution of the script use case;
  • the recording module is configured to: record and display execution information and abnormality information of the script use case.
  • an embodiment of the present invention provides a test method for a northbound interface, including:
  • the script execution module executes a script use case in a pre-developed script, invokes a corresponding request message according to the script use case, and sends an execution command including the request message to the command execution module;
  • the command execution module performs a corresponding test operation according to the content of the request message, and The execution result is returned to the script execution module, and the request message is used to test the communication interface corresponding to the currently tested northbound interface.
  • the script execution example currently executed by the script execution module includes a task of testing a notification
  • the test method further includes:
  • the script execution module sends a first subscription command to the notification receiving module
  • the notification receiving module acquires the test notification indicated by the first subscription command, and returns the obtained test notification to the script execution module;
  • the script execution module sends an unsubscribe command to the notification receiving module.
  • test method further includes:
  • the initialization module initialization script loading module loads the pre-developed script, initializes the parameters of the command execution module and the parameters of the notification receiving module, wherein the script use case executed by the script execution module is loaded according to the script loading module Obtained by each script use case in the script, the script includes the script use case and a script method, and the script method is an execution method of the script use case;
  • the testing method further includes:
  • the notification receiving module continuously receives the notification sent by the server after initialization.
  • the current test northbound interface is a Common Object Request Broker Architecture (CORBA) interface
  • the command execution module is initialized.
  • Parameters including: Initialization Object Request Broker (ORB);
  • the initializing the parameter of the notification receiving module includes: instructing, by an object management organization (OMG) standard, that the notification receiving module invokes receiving a notification sent by the server;
  • OMG object management organization
  • test method further includes:
  • the initialization module sends a login command to the script execution module, where the login command includes a login script method
  • the script execution module executes the login script method according to the login command, invokes a corresponding login request message according to the login script method, and sends an execution including the login request message to the command execution module.
  • the command execution module performs a dynamic call of CORBA according to the received login request message, and returns an execution result to the script execution module.
  • the currently tested northbound interface is a multi-technology operating system (MTOSI) interface or a northbound direction of a software-defined network (SDN).
  • Initializing parameters of the command execution module including: initializing a uniform resource locator (URL) for constructing a hypertext transfer protocol (HTTP) request message;
  • URL uniform resource locator
  • HTTP hypertext transfer protocol
  • the initializing the parameters of the notification receiving module includes: subscribing to an MTOSI notification;
  • the testing method further includes:
  • the notification receiving module sends a second subscription command to the script execution module, where the second subscription command includes a subscribed script method
  • the script execution module executes the subscribed script method according to the second subscription command, invokes a corresponding subscription request message according to the subscribed script method, and sends the subscription request message to the command execution module. Execute the subscription command;
  • the command execution module executes an HTTP request call according to the subscription request message, and returns an execution result to the script execution module.
  • any one of the first to fourth possible implementation manners of the second aspect in a fifth possible implementation, the command execution module returns an execution result to the script execution module Thereafter, the test method further includes:
  • the script execution module transmits the execution result to the result generation module
  • the result generation module outputs the execution result, the execution result including all northbound interfaces that have been tested, and the number of tests and the test time of each of the northbound interfaces.
  • the script execution module executes the script use case, including: the script execution module sequentially executes in the order of each script use case in the script; and/or,
  • test method further includes:
  • the script execution module sends the execution information and the abnormality information of the script use case to the recording module;
  • the recording module records and displays execution information and exception information of the script use case.
  • the embodiment of the invention further provides a computer readable storage medium storing computer executable instructions, which are implemented when the computer executable instructions are executed.
  • the northbound interface test device and the northbound interface test method provided by the embodiment of the present invention execute a script use case in a pre-developed script through a script execution module, and call a corresponding request message according to the script use case, thereby sending the command execution module to the command execution module.
  • the execution command of the request message, and the command execution module performs a corresponding test operation according to the content of the request message, and returns the execution result to the script execution module.
  • the request message in this embodiment is used for the current test.
  • the communication interface corresponding to the northbound interface is tested.
  • the test logic of the script use case is executed by the script execution module, and the request text for executing the corresponding test function on the northbound interface is invoked, thereby executing the request text of the call by calling the command execution module.
  • the task of testing the northbound interface edited in the script use case is implemented.
  • the service interface of the northbound interface can be hard coded to implement the service interface. Fixed function Test, which led to a big problem to the north limit automated testing capabilities of the interface.
  • FIG. 1 is a schematic diagram of an application scenario of a northbound interface
  • FIG. 2 is a schematic structural diagram of a northbound interface testing device according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of testing of a northbound interface test device provided by the embodiment shown in FIG. 2;
  • FIG. 4 is a schematic structural diagram of another northbound interface testing device according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of still another northbound interface testing device according to an embodiment of the present disclosure.
  • FIG. 6 is a flowchart of a method for testing a northbound interface according to an embodiment of the present invention.
  • FIG. 7 is a flowchart of another method for testing a northbound interface according to an embodiment of the present invention.
  • FIG. 8 is a flowchart of still another method for testing a northbound interface according to an embodiment of the present invention.
  • Figure 1 shows a schematic diagram of an application scenario of a northbound interface.
  • the unfilled squares represent the server side, and the filled squares represent the client.
  • the interface definition provided by the device manufacturer is directly visible to the user, that is, the northbound interface service interface in FIG.
  • the interface definition provided by the device manufacturer is directly visible to the user, that is, the northbound interface service interface in FIG.
  • the CORBA interface it is the interface cluster defined by the Interface Description Language (IDL).
  • IDDL Interface Description Language
  • MTOSI interface it is the interface cluster defined by the Web Service Description Language (referred to as: WSDL) for SDN.
  • the northbound interface is a model definition voice defined in a series of Request For Comments (RFC) 6020, that is, an interface cluster defined by YANG.
  • the northbound interface service interface can also be other forms.
  • the business interface calls the interface definition generated by the special compiler of the northbound interface.
  • the principle of the northbound interface protocol is similar to the seven-layer communication protocol of the Open System Interconnection (OSI), that is, the northbound interface is also a layer model, and the above interface cluster is defined as the uppermost layer, and the interface cluster is There are one or more layers of other communication protocols, which can be collectively referred to as communication interfaces.
  • OSI Open System Interconnection
  • the northbound interface service interface needs to be invoked, and the northbound interface service interface inputs the conversion and invokes the communication connection.
  • the server-side communication interface receives the request to invoke the communication interface, and converts it into a call request of the northbound interface service interface, and then invokes the northbound interface server side implementation.
  • FIG. 2 is a schematic structural diagram of a northbound interface testing device according to an embodiment of the present invention.
  • the northbound interface test device provided in this embodiment is suitable for testing a northbound interface service interface
  • the northbound interface test device is usually implemented in hardware and software, for example, integrated in a processor of the test device, and is used by the processor. carried out.
  • the northbound interface testing apparatus provided in this embodiment includes: a script execution module 11 and a command execution module 12.
  • the script execution module 11 is configured to execute a script use case in a pre-developed script, call a corresponding request message according to the script use case, and send an execution command including the request message to the command execution module 12.
  • the script execution module 11 can execute a pre-developed script, which is a script voice written by the tester for the automation test of the northbound interface after developing the northbound interface test device, and is used for automatically testing the northbound interface.
  • the script usually includes a plurality of script use cases.
  • the script execution module 11 executes the script use case, the script can be called from the request message set according to the specific script use case, that is, the script and the request message in this embodiment.
  • the text has been developed before the automated test.
  • the test logic can be edited through the script use case, that is, the specific script use case can call a specific request message, that is, the script use case and the request message are corresponding relationships.
  • the command execution module 12 is configured to send an execution command including the request message by executing the corresponding request message, and the command execution module 12 processes the called request message.
  • each script use case may be sequentially executed in the order of each script use case in the pre-developed script; the script execution module 11 invokes the request message.
  • the method is: according to the content of the currently executed script use case, that is, each time a script use case is executed, the called request message is usually different; in addition, the requested request message is in a text format, for example, Extensible markup language (Extensible Markup Language, referred to as: XML) formatted text.
  • XML Extensible Markup Language
  • the command execution module 12 is configured to: perform a corresponding test operation according to the content of the request message, and return the execution result to the script execution module 11, where the request message is used to perform communication interface corresponding to the currently tested northbound interface. test.
  • the command execution module 12 after the command execution module 12 receives the execution command sent by the script execution module 11, the corresponding test operation may be performed according to the request message indicated in the execution command, and the request message is used for the current test.
  • the ability of the northbound interface to correspond to the communication interface is tested.
  • the script and the request message set that the tester has developed on the client for testing the function of testing the northbound interface service interface are actually based on the northbound interface service interface in the application scenario shown in FIG.
  • the corresponding communication interface After the input is converted, the corresponding communication interface is called, and the communication interface called after the conversion is tested.
  • the test of the uppermost interface cluster of the northbound interface is converted into the test of the lower layer communication interface, specifically by pre-definition.
  • the script and the request message collection are implemented together, that is, the execution script use case is to obtain the request message for the current script use case through the script use case, and the test plan is specifically defined in the request message, and the command execution module 12 executes the request message. Perform tests on the features of the tests indicated by the current script use case.
  • the script execution module 11 in this embodiment executes the script use case, in fact, by repeatedly calling the command execution module 12 to execute the request message that the script execution module 11 calls through the script use case;
  • the execution module 11 is sequentially executed in the order of each script use case in the script. Therefore, the order in which the command execution module 12 executes the request message is also sequentially executed in the order in which the script execution module 11 calls the request message.
  • the northbound interface test device provided by this embodiment is tested for the function of the northbound interface service interface.
  • the corresponding communication interface is automatically tested, and the script execution module 11 is required to execute the pre-developed script use case first.
  • the execution of the script use case calls the request message related to the test, that is, the two factors that test the communication interface are the script use case and the request message.
  • FIG. 3 is a schematic diagram showing the test of the northbound interface test apparatus provided in the embodiment shown in FIG. 2. Similar to the application scenario shown in FIG. 1, the unfilled square represents the server side, and the filled square represents the client, and the northbound interface.
  • the test device tests the communication interface corresponding to the northbound interface service interface of the client by executing the script use case and calling the request message corresponding to the current script use case, that is, testing the corresponding communication interface of the server through the client, thereby according to the test result. Life
  • the execution module 12 performs the execution result of the request message to verify the function of the client interface and the server-side northbound interface service interface.
  • the automatic test of the function of the northbound interface service interface is established on the corresponding communication interface.
  • the input that can be recognized by the communication interface is usually a binary stream of text or text encoding.
  • the internal object request proxy protocol Internet Inter-ORB Protocol, IIOP
  • CORBA dynamic call interface for MTOSI and SDN, is the HyperText Transfer Protocol (HTTP);
  • HTTP HyperText Transfer Protocol
  • the test plan is The IDL or WSDL request message is saved first, such as the northbound interface request message in FIG. 3, so that the test logic is edited by the script, that is, the tester writes the test sequence in the script in the form of a script use case to complete the test.
  • the use case test of the item function as shown in the northbound interface automation test script of Figure 3.
  • the northbound interface test device provided in this embodiment is independent of the specific northbound interface service interface definition in the process of performing the test, and is only responsible for executing the test script use case to implement automatic test of the northbound interface service interface.
  • the northbound interface test apparatus executes a script use case in a pre-developed script through a script execution module, and invokes a corresponding request message according to the script use case, thereby transmitting an execution command including the request message to the command execution module. Then, the command execution module performs a corresponding test operation according to the content of the request message, and returns the execution result to the script execution module.
  • the request message in this embodiment is used to perform the communication interface corresponding to the currently tested northbound interface.
  • the test that is, the test logic of the script use case is executed by the script execution module, and the request text for executing the corresponding test function on the northbound interface is invoked, thereby executing the call request text by calling the command execution module to implement the edited northward direction in the script use case.
  • the test is performed on the interface. This example solves the problem of testing the fixed function of the service interface by hard coding the service interface of the northbound interface. Automated measurement Capacity constraints bigger problem.
  • the northbound interface test device provided by the present embodiment solves the northbound interface service interface and the northbound interface test device, as compared with the test tool in the related art, which implements the test of the fixed function of the northbound interface service interface in a hard-coded manner. Coupling, that is, the automated test is established on the communication interface corresponding to the northbound interface service interface to be tested, so that the automated test development becomes the development of the request message and the script use case, and the request message is a text input that the communication interface can recognize, which is reduced.
  • the threshold for use case development before testing the communication interface, the tester can develop according to the test requirements, develop a script use case for testing; and if the script use case passes the test, the function of the northbound interface service interface corresponding to the communication interface is explained. Verification passed.
  • the northbound interface test device provided in this embodiment has the characteristics of rapid and flexible development in the development of automated test cases, can double the efficiency of development and test, thereby improving product quality, and is particularly suitable for agile development.
  • FIG. 4 is a schematic structural diagram of another northbound interface testing device according to an embodiment of the present invention.
  • the script execution module 11 currently executes the task of the test notification
  • the device provided in this embodiment further includes a notification receiving module 13 based on the northbound interface test device shown in FIG.
  • the script execution module 11 is further configured to: after executing the script use case, send a first subscription command to the notification receiving module 13; correspondingly, the notification receiving module 13 is configured to: obtain a test notification indicated by the first subscription command, and Returning the obtained test notification to the script execution module 11; subsequently, after obtaining the required test notification in the script use case, that is, after completing the task of the test notification, the script execution module 11 may further send the unsubscribe command to the notification receiving module 13 To cancel the test notification task.
  • the notification receiving module 13 in this embodiment can always receive the notification sent by the server after being started.
  • the notification receiving module 13 needs to test according to the first subscription command.
  • the notification is obtained from the notification received by the server, and the notification of the subscription by the script execution module 11 is found, and is returned to the script execution module 11; that is, the operation of the subscription notification in the embodiment is between the internal modules of the northbound interface test device.
  • Notification subscription the script execution module 11 in this embodiment executes the script use case, and not only needs to execute the request message that the script execution module 11 calls by repeatedly calling the command execution module 12, but also needs to subscribe by repeatedly calling the notification receiving module 13.
  • the script execution module 11 currently executes a notification in the script use case that needs to be tested.
  • the northbound interface test apparatus shown in FIG. 4 may further include: an initialization module 14 and a script loading module 15, wherein the initialization module 14 is configured to: before the script execution module 11 executes the script use case in the pre-developed script
  • the initialization script loading module 15 loads the pre-developed script, and initializes the parameters of the command execution module 12 and the parameters of the notification receiving module 13, wherein the script use case executed by the script execution module 11 is loaded according to the script loading module 15 Obtained by each script use case, the script includes script use cases and script methods, the script method The execution method of the script use case; correspondingly, the notification receiving module 13 is further configured to: continuously receive the notification sent by the server after the initialization.
  • the embodiment does not limit the order in which the initialization module 14 initializes the script loading module 15, the command execution module 12, and the notification receiving module 13, and may be executed sequentially or in parallel.
  • the script loaded by the script loading module 15 is, for example, a script based on an object-oriented programming language Java virtual machine programming language (Groovy), that is, a Groovy script, since the Groovy language is an extension to the Java language, Therefore, the workload of developing Groovy scripts is small; and the Groovy script loaded by the script loading module 15 is divided into two parts, one is the Groovy script method, and the other is the Groovy script use case, wherein the Groovy script method can be some commonly used or one by one. Or a method common to multiple Groovy script use cases, such as a Groovy script method for initializing the login of module 14.
  • Groovy object-oriented programming language Java virtual machine programming language
  • FIG. 5 is a schematic structural diagram of another northbound interface testing device according to an embodiment of the present invention. This embodiment can be used to test the CORBA interface.
  • the script execution module 11 executes the request message that is invoked by the script use case as a CORBA request message, and the CORBA request message is also a text file in XML format.
  • the initialization module 14 initializes the parameters of the command execution module 12 by: initializing the object requesting proxy according to the network protocol (IP) of the server and the naming service port (Object) Request Broker, referred to as: ORB); on the other hand, the initialization module 14 initializes the parameters of the notification receiving module 13 by: according to the service port notified by the server, through the Object Management Group (OMG) standard, The notification notification receiving module 13 continues to receive the notification sent by the server.
  • IP network protocol
  • Object Object Request Broker
  • the command execution module 12 may be a CORBA command execution module 12, and the notification receiving module 13 may notify the OMG notification receiving module 13 that the OMG notification receiving module 13 is in the state of receiving the OMG notification after initialization.
  • An interface for subscribing and unsubscribing can be provided.
  • the script execution module 11 executes the script use case, if a situation in which a certain notification is to be tested is encountered, the first subscription command is sent to the notification receiving module 13 to subscribe to the notification.
  • the notification receiving module 13 finds the test notification of the subscription indicated by the first subscription command in the notification received from the server, thereby returning the required test notification to the script execution module 11 to complete You can cancel the notification subscription after you have tested the notification's tasks.
  • the script loaded by the script loading module 15 is also taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case.
  • a Groovy script which includes a Groovy script method and a Groovy script use case.
  • the login method for obtaining getEmsSession using EmsSessionFactory is defined; optionally, before each Groovy script use case is executed, a login operation is required first, and the Groovy script method corresponding to the Groovy script use case to be executed is the initialization module 14 instructing execution. Log in to the Groovy script method.
  • the initialization module 14 is further configured to: before the script execution module 11 executes the script use case, send a login command to the script execution module 11, where the login command includes a login script method.
  • the script execution module 11 is further configured to: execute the logged-in Groovy script method according to the login command, and invoke the corresponding login request message according to the logged-in Groovy script method, for example, a login CORBA request.
  • the message, the logged-in CORBA request message is also a text file stored in an XML format, thereby sending an execution login command including the logged-in CORBA request message to the command execution module 12; accordingly, the command execution module 12 also sets The dynamic call of the CORBA is performed according to the received CORBA request message, and the execution result is returned to the script execution module 11 after the execution is completed.
  • the embodiment shown in FIG. 5 is different from the embodiment shown in FIG. 4 in that the test of the CORBA interface in this embodiment needs to follow the definition in the 814 standard, that is, before the script execution module 11 executes the script use case,
  • the login operation is first performed, in which the initialization module 14 is required to send a login command to the script execution module 11. Therefore, in the embodiment shown in FIG. 5, the initialization module 14 and the script execution module 11 have a connection relationship for transmitting signaling.
  • the request message in the embodiment of the present invention may all be stored in a text file in an XML format.
  • the command execution module 12 After receiving the login command, the command execution module 12 reads the registered CORBA request message in the command, and passes the read after the reading is completed.
  • the ORB calls the dynamic call interface of CORBA. After the call is completed, the execution result is re-saved as a text file in XML format for subsequent use by the script execution module 11. Furthermore, the script execution module 11 in this embodiment can execute the script use case loaded by the script loading module 15 by using the unit test case framework.
  • the northbound interface test device provided in this embodiment may be used to test the northbound direction of the MTOSI interface or the SDN, and the script execution module 11 uses the request message that is invoked by the script use case to be an HTTP request message, and the HTTP request message may also be an XML. Formatted text file.
  • the initialization module 14 initializes the parameters of the command execution module 12 by: initializing a Uniform Resource Locator (URL) parameter of the server, that is, initializing for constructing The URL of the HTTP request message, because the script execution module 11 in this embodiment executes the HTTP request message when the script use case is executed, the HTTP request message needs to include a URL, and the HTTP request message can be, for example, a simple object access protocol (Simple Object Access).
  • URL Uniform Resource Locator
  • the SOAP request message may be a specific application of the HTTP request message; on the other hand, the initialization module 14 initializes the parameter of the notification receiving module 13 by subscribing to the MTOSI notification, thereby indicating The notification receiving module 13 continuously receives the notification sent by the server.
  • the command execution module 12 may be, for example, an HTTP request execution module, and the notification receiving module 13 may notify the receiving module, for example, a Jetty (Java-based network container), the Jetty notification receiving module is always in after the initialization.
  • the interface for subscribing and unsubscribing can be provided, and the manner in which the script execution module 11 notifies the receiving module of the subscription notification and the cancellation notification subscription to the Jetty is the same as the above embodiment, and belongs to the internal module of the northbound interface test device. Notification subscription.
  • the script loaded by the script loading module 15 is taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case.
  • the initialization module 14 initializes the parameters of the Jetty notification receiving module, That is, after the MTOSI notification is subscribed, the subscription notification is sent to the server by calling the subscribed Groovy script method.
  • the notification receiving module 13 is further configured to: send a second subscription command to the script execution module 11, where the second The subscription command includes a subscribed script method, such as a subscription to the Groovy script method; the script execution module 11 is further configured to execute the subscription's Groovy script method according to the second subscription command, and invoke the corresponding according to the subscription's Groovy script method.
  • the request message for example, a subscribed SOAP request message
  • the subscribed SOAP request message is also a text file stored in an XML format, thereby transmitting an execution subscription command including the subscribed SOAP request message to the command execution module 12.
  • the command execution module 12 is further configured to: Read the SOAP request message to perform HTTP requests to call, after the completion of the implementation of the results returned
  • the module 11 is executed for the script.
  • the purpose is to receive a notification from the server, and the subscription notification is The operation is a notification subscription between the northbound interface test device and the server.
  • the northbound interface testing device in the embodiment shown in FIG. 4 and FIG. 5 may further include a result generating module 16, and the script executing module 11 is further configured to: return the execution result to the script execution module at the command execution module 12. After 11 , the execution result is transmitted to the result generation module 16; correspondingly, the result generation module 16 is configured to: output an execution result, wherein the execution result includes all northbound interfaces that have been tested, and the number of tests of each northbound interface And test time.
  • the northbound interface test apparatus in the embodiment shown in FIG. 4 and FIG. 5 may further include a recording module 17, and the script execution module 11 is further configured to: execute execution information and an exception of the script use case in the process of executing the script use case. The information is sent to the recording module 17; accordingly, the recording module 17 is configured to record and display execution information and exception information of the script use case.
  • the result may be output by the result generation module 16 by using a webpage, a text, or an Excel, for the tester to view the execution result, and the execution result may be reflected.
  • the execution of each script use case including which northbound interfaces were tested, and the number of tests and test times for each northbound interface tested.
  • the script use case fails to execute, the related abnormal running state can be viewed through the information recorded by the recording module 17.
  • the northbound interface test device performs the automatic use case test based on the underlying protocol of the northbound interface protocol, that is, the communication interface, from the characteristics of the northbound interface, so that only the request message is required after the script development is completed.
  • the northbound interface test device can provide a stable northbound interface, and is applicable to automatic test development of script use cases in various application scenarios, and can correspondingly reduce the maintenance required for the northbound interface test device. Labor costs.
  • FIG. 6 is a flowchart of a method for testing a northbound interface according to an embodiment of the present invention.
  • the method can be performed by a northbound interface test device, which is usually implemented in hardware and software, for example, a processor integrated in the test device. In, for the processor to call execution.
  • the method provided in this embodiment includes the following steps:
  • Step S110 the script execution module executes the script use case in the pre-developed script, and invokes the corresponding request message according to the script use case;
  • Step S120 The script execution module sends an execution command including the request message to the command execution module.
  • Step S130 the command execution module performs a corresponding test operation according to the content of the request message
  • step S140 the command execution module returns the execution result to the script execution module, where the request message is used to test the capability of the communication interface corresponding to the currently tested northbound interface.
  • the application scenario of testing the service interface of the northbound interface through the northbound interface test device in this embodiment can also refer to the application scenario shown in FIG. 1 above.
  • the test mode can also refer to the test schematic diagram shown in FIG. 3 above.
  • the test method of the northbound interface provided by the embodiment is independent of the specific northbound interface service interface definition during the test process, and is only responsible for executing the automated test script use case.
  • test method of the northbound interface provided by the embodiment of the present invention can be performed by the northbound interface test device provided by the embodiment shown in FIG. 2, and the steps of the method correspond to the functions of the devices in the northbound interface test device provided by the embodiment of the present invention.
  • the implementation principle and technical effect are similar, and will not be described here.
  • the method provided by the embodiment further includes:
  • Step S111 the script execution module sends a first subscription command to the notification receiving module.
  • Step S112 the notification receiving module acquires the test notification indicated by the first subscription command
  • step S113 the notification receiving module returns the obtained test notification to the script execution module, and the test notification obtained in this embodiment is a notification received from the server.
  • step S114 the script execution module sends an unsubscribe command to the notification receiving module.
  • step S111 does not limit the execution sequence of step S111 to step S114 and step S120 to step S140
  • FIG. 6 is illustrated by taking steps S111 to S114 before step S120 to step S140 as an example.
  • the method provided in this embodiment further includes: before step S110:
  • Step S101 the initialization module initializes the script loading module
  • Step S102 the script loading module loads the script use case in the pre-developed script.
  • the script use case executed by the script execution module is obtained according to each script use case in the script loading module loading script, and the script includes a script use case.
  • a script method that is an execution method of the script use case;
  • the above method further includes:
  • Step S103 the initialization module initializes a parameter of the command execution module
  • Step S104 the initialization module initializes the parameters of the notification receiving module.
  • FIG. 6 shows an execution manner in the order of steps S101 to S104 as an example.
  • FIG. 7 is a flowchart of another test method of the northbound interface according to the embodiment of the present invention.
  • the script execution module calls the request message to be a CORBA request message by executing the script use case.
  • step S103 may be replaced by: initializing the ORB according to the IP address of the server and the naming service port;
  • step S104 may be replaced by: indicating the notification receiving by the OMG standard according to the service port notified by the server.
  • the module is instructed to receive the notification sent by the server, that is, to subscribe to the OMG notification.
  • the notification receiving module in this embodiment is in the state of receiving the OMG notification after the initialization.
  • the specific implementation is the same as that in the foregoing embodiment, and therefore is not described here.
  • the script loaded by the script loading module is also taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case.
  • This embodiment tests the CORBA interface, that is, executes each Before the Groovy script use case, the login operation needs to be performed first.
  • the method provided in this embodiment is further included before step S110. include:
  • Step S105 the initialization module sends a login command to the script execution module, where the login command includes a login Groovy script method;
  • Step S106 the script execution module executes the logged-in Groovy script method according to the login command, and invokes the corresponding logged-in CORBA request message according to the logged-in Groovy script method;
  • Step S107 the script execution module sends an execution login command including the registered CORBA request message to the command execution module.
  • Step S108 the command execution module performs a dynamic call of the CORBA according to the received CORBA request message.
  • step S109 the command execution module returns the execution result to the script execution module.
  • test method of the northbound interface provided by the embodiment of the present invention can be performed by the northbound interface test device provided by the embodiment shown in FIG. 5, and the steps of the method correspond to the functions of the devices in the northbound interface test device provided by the embodiment of the present invention.
  • the implementation principle and technical effect are similar, and will not be described here.
  • FIG. 8 is a flowchart of still another test method of the northbound interface according to the embodiment of the present invention.
  • the present embodiment is used to test the northbound direction of the MTOSI interface or the SDN.
  • the script execution module invokes the request message sent by the script use case as an HTTP request message.
  • step S103 may be replaced by: initializing a URL for constructing an HTTP request message;
  • step S104 may be replaced by: subscribing to the MTOSI notification, thereby instructing the notification receiving module to continuously receive the notification sent by the server. .
  • the script loaded by the script loading module is also taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case, and the notification is received after the initialization module initialization notification receiving module subscribes to the MTOSI notification. The module needs to invoke the scripting method of the subscription.
  • the method provided in this embodiment further includes after step S104:
  • Step S105 the notification receiving module sends a second subscription command to the script execution module, where the second subscription command includes a subscribed Groovy script method;
  • Step S106 the script execution module executes the subscribed Groovy script method according to the second subscription command, and invokes the corresponding subscribed SOAP request message according to the subscribed Groovy script method.
  • Step S107 The script execution module sends an execution subscription command including a subscribed SOAP request message to the command execution module.
  • Step S108 the command execution module performs an HTTP request call according to the subscribed SOAP request message
  • step S109 the command execution module returns the execution result to the script execution module.
  • test method of the northbound interface provided by the embodiment of the present invention can be performed by the northbound interface test device provided by the embodiment shown in FIG. 4, and the steps of the method correspond to the functions of the devices in the northbound interface test device provided by the embodiment of the present invention.
  • the implementation principle and technical effect are similar, and will not be described here.
  • step S140 and step S109 the following steps may be performed:
  • Step S150 the script execution module transmits the execution result to the result generation module
  • step S160 the result generation module outputs an execution result, which includes all the northbound interfaces that have been tested, and the number of tests and the test time of each northbound interface.
  • the script execution module further includes: the script execution module transmitting the execution information and the abnormality information of the script use case to the recording module; and subsequently, the recording module Record and display execution information and exception information for script use cases.
  • an embodiment of the present invention further provides a computer readable storage medium, where computer executable instructions are stored, and the test method of the northbound interface is implemented when the computer executable instructions are executed.
  • each module/unit in the foregoing embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, being executed by a processor and stored in a memory. Programs/instructions to implement their respective functions. This application is not limited to any specific combination of hardware and software.
  • the embodiment of the present invention provides a test method for the northbound interface test device and the northbound interface, and solves the problem that the test interface of the related art is used to test the northbound interface, and the service interface of the northbound interface needs to be hard coded to implement the service interface.
  • the fixed function is tested, which leads to a problem of large restrictions on the automated test capability of the northbound interface.

Abstract

Disclosed is a northbound interface test apparatus, comprising a script execution module and a command execution module, wherein the script execution module is configured to execute a script case in a pre-developed script, call a corresponding request message according to the script case and send an execution command comprising the request message to the command execution module; and the command execution module is configured to execute a corresponding test operation according to the content of the request message and return an execution result to the script execution module, wherein the request message is used to test a communication interface corresponding to a currently tested northbound interface. The solution solves the problem that when a testing tool in the related art is adopted to test a northbound interface, the automated testing capability of the northbound interface is seriously limited due to the fact that a service interface of the northbound interface needs to be hard-coded in order to realize the test of a fixed function of the service interface.

Description

一种北向接口测试装置和北向接口的测试方法North direction interface test device and test method for northbound interface 技术领域Technical field
本申请涉及但不限于计算机测试技术领域,尤指一种北向接口测试装置和北向接口的测试方法。The present application relates to, but is not limited to, the field of computer testing technology, and in particular to a northbound interface testing device and a northbound interface testing method.
背景技术Background technique
北向接口为设备厂商提供给运营商的接口,运营商可以通过北向接口统一监管每个设备厂商的设备,监控设备厂商告警、性能以及开通业务。随着第三代移动通信技术(3rd-Generation,简称为:3G)、第四代移动通信技术(4G)网络建设的发展,北向接口在运营商和设备厂商之间的桥梁作用越来越重要,北向接口的使用性能成为设备厂商关注的重要特征。The northbound interface provides the device vendor with an interface to the carrier. The northbound interface can be used to monitor the device of each device vendor and monitor the alarm, performance, and services of the device. With the development of third-generation mobile communication technology (3rd-Generation, 3G) and fourth-generation mobile communication technology (4G) network construction, the northbound interface plays an increasingly important role as a bridge between operators and equipment manufacturers. The performance of the northbound interface has become an important feature of device manufacturers.
目前的主流北向接口包括公共对象请求代理体系结构(Common Object Request Broker Architecture,简称为:CORBA)接口、多重技术操作系统(Multi technology operations systems interface,简称为:MTOSI)接口以及新一代的软件定义网络(Software Defined Network,简称为:SDN)的北向,即SDN的restconf北向接口;上述这些主流北向接口通常基于特定的协议标准定义各自的业务接口。但是由于业务接口的数量较多,采用相关技术的测试工具测试北向接口的业务接口时,需要根据待测试的北向接口的业务接口的功能,对该业务接口进行硬编码,因此,在测试中只能实现对业务接口的固定功能进行自动化测试;如果需要对功能发生变化的业务接口或者对增加新功能的业务接口进行测量,就需要对该测试工具的代码进行变更或者对新实现功能进行硬编码,以实现对该业务接口的不同功能的自动化测试。The current mainstream northbound interface includes a Common Object Request Broker Architecture (CORBA) interface, a multi technology operations systems interface (MTOSI) interface, and a new generation of software-defined networks. The northbound direction of the Software Defined Network (SDN) is the UPS restconf northbound interface. These mainstream northbound interfaces usually define their own service interfaces based on specific protocol standards. However, due to the large number of service interfaces, when testing the service interface of the northbound interface using the test tool of the related technology, the service interface needs to be hard coded according to the function of the service interface of the northbound interface to be tested. Therefore, only the test is performed. It can automate the testing of the fixed functions of the service interface; if you need to measure the service interface whose function changes or the service interface that adds new functions, you need to change the code of the test tool or hard code the new implementation function. To automate testing of the different functions of the business interface.
采用相关技术中的测试工具测试北向接口时,由于需要通过对北向接口的业务接口进行硬编码才能实现对业务接口的固定功能进行测试,导致北向接口的自动化测试能力限制较大。When testing the northbound interface with the test tool in the related technology, the fixed function of the service interface can be tested by hard coding the service interface of the northbound interface, which results in a large limitation on the automatic test capability of the northbound interface.
发明内容 Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提供了一种北向接口测试装置和北向接口的测试方法,以解决采用相关技术中的测试工具测试北向接口时,由于需要通过对北向接口的业务接口进行硬编码才能实现对业务接口的固定功能进行测试,而导致北向接口的自动化测试能力限制较大的问题。The embodiment of the present invention provides a test method for a northbound interface test device and a northbound interface, so as to implement a service interface by hard coding a service interface of a northbound interface when testing a northbound interface by using a test tool in the related art. The fixed function is tested, which leads to a problem of large restrictions on the automated test capability of the northbound interface.
第一方面,本发明实施例提供一种北向接口测试装置,包括:脚本执行模块和命令执行模块;In a first aspect, an embodiment of the present invention provides a northbound interface testing device, including: a script execution module and a command execution module;
其中,所述脚本执行模块,设置为:执行预先开发的脚本中的脚本用例,根据所述脚本用例调用相应的请求报文,并向命令执行模块发送包括所述请求报文的执行命令;The script execution module is configured to: execute a script use case in a pre-developed script, invoke a corresponding request message according to the script use case, and send an execution command including the request message to the command execution module;
所述命令执行模块,设置为:根据所述请求报文的内容执行相应的测试操作,并将执行结果返回给所述脚本执行模块,其中,所述请求报文用于对当前测试的北向接口对应的通讯接口进行测试。The command execution module is configured to: perform a corresponding test operation according to the content of the request message, and return an execution result to the script execution module, where the request message is used for a northbound interface of the current test. The corresponding communication interface is tested.
在第一方面的第一种可能的实现方式中,In a first possible implementation of the first aspect,
所述脚本执行模块当前执行的脚本用例中包括测试通知的任务,所述北向接口测试装置还包括:通知接收模块;The script execution example currently executed by the script execution module includes a task of testing a notification, and the northbound interface testing device further includes: a notification receiving module;
所述脚本执行模块,还设置为:在执行所述脚本用例之后,向所述通知接收模块发送第一订阅命令;The script execution module is further configured to: after executing the script use case, send a first subscription command to the notification receiving module;
所述通知接收模块,设置为:获取所述第一订阅命令指示的测试通知,并将所述获取的测试通知返回给所述脚本执行模块;The notification receiving module is configured to: obtain a test notification indicated by the first subscription command, and return the obtained test notification to the script execution module;
所述脚本执行模块,还设置为:向所述通知接收模块发送取消订阅命令。The script execution module is further configured to: send an unsubscribe command to the notification receiving module.
在第一方面的第二种可能的实现方式中,In a second possible implementation of the first aspect,
所述北向接口测试装置还包括:初始化模块和脚本加载模块;The northbound interface testing device further includes: an initialization module and a script loading module;
所述初始化模块,设置为:在所述脚本执行模块执行预先开发的脚本中的脚本用例之前,初始化脚本加载模块加载所述预先开发的脚本,初始化所述命令执行模块的参数和所述通知接收模块的参数,其中,所述脚本执行模 块执行的脚本用例为根据所述脚本加载模块加载所述脚本中的每个脚本用例所获取的,所述脚本包括所述脚本用例和脚本方法,所述脚本方法为所述脚本用例的执行方法;The initialization module is configured to: before the script execution module executes the script use case in the pre-developed script, the initialization script loading module loads the pre-developed script, initializes parameters of the command execution module, and receives the notification Module execution module The script use case of the block execution is obtained according to the script load module loading each script use case in the script, the script includes the script use case and a script method, and the script method is an execution method of the script use case ;
所述通知接收模块,还设置为:在初始化后持续接收服务器发送的通知。The notification receiving module is further configured to: continuously receive a notification sent by the server after initialization.
根据第一方面的第二种可能的实现方式,在第三种可能的实现方式中,所述当前测试的北向接口为公共对象请求代理体系结构(CORBA)接口,所述初始化模块通过以下方式初始化命令执行模块的参数:初始化对象请求代理(ORB);According to a second possible implementation manner of the first aspect, in a third possible implementation, the current test northbound interface is a Common Object Request Broker Architecture (CORBA) interface, and the initialization module is initialized by: Parameters of the command execution module: Initialize Object Request Broker (ORB);
所述初始化模块通过以下方式初始化所述通知接收模块的参数:通过对象管理组织(OMG)标准,指示所述通知接收模块调用接收所述服务器发送的通知;The initialization module initializes parameters of the notification receiving module by: instructing, by an object management organization (OMG) standard, that the notification receiving module invokes receiving a notification sent by the server;
所述初始化模块,还设置为:在所述脚本执行模块执行所述脚本用例之前,向所述脚本执行模块发送登陆命令,其中,所述登陆命令中包括登陆的脚本方法;The initialization module is further configured to: before the script execution module executes the script use case, send a login command to the script execution module, where the login command includes a login script method;
所述脚本执行模块,还设置为:根据所述登陆命令执行所述登陆的脚本方法,根据所述登陆的脚本方法调用相应的登陆请求报文,并向所述命令执行模块发送包括所述登陆请求报文的执行登陆命令;The script execution module is further configured to: execute the login script method according to the login command, invoke a corresponding login request message according to the login script method, and send the login command to the command execution module. Request execution message of the message;
所述命令执行模块,还设置为:根据所述接收到的登陆请求报文执行CORBA的动态调用,并将执行结果返回给所述脚本执行模块。The command execution module is further configured to: perform a dynamic call of CORBA according to the received login request message, and return an execution result to the script execution module.
根据第一方面的第二种可能的实现方式,在第四种可能的实现方式中,所述当前测试的北向接口为多重技术操作系统(MTOSI)接口或者软件定义网络(SDN)的北向,所述初始化模块通过以下方式初始化命令执行模块的参数:初始化用于构造超文本传输协议(HTTP)请求报文的统一资源定位符(URL);According to a second possible implementation manner of the first aspect, in a fourth possible implementation, the currently tested northbound interface is a multi-technology operating system (MTOSI) interface or a northbound direction of a software-defined network (SDN). The initialization module initializes parameters of the command execution module by initializing a uniform resource locator (URL) for constructing a hypertext transfer protocol (HTTP) request message;
所述初始化模块通过以下方式初始化所述通知接收模块的参数:订阅MTOSI通知;The initialization module initializes parameters of the notification receiving module by: subscribing to an MTOSI notification;
所述通知接收模块,还设置为:在所述初始化模块初始化所述通知接收 模块的参数之后,向所述脚本执行模块发送第二订阅命令,其中,所述第二订阅命令中包括订阅的脚本方法;The notification receiving module is further configured to: initialize the notification receiving at the initialization module After the parameter of the module, sending a second subscription command to the script execution module, where the second subscription command includes a script method of the subscription;
所述脚本执行模块,还设置为:根据所述第二订阅命令执行所述订阅的脚本方法,根据所述订阅的脚本方法调用相应的订阅请求报文,并向所述命令执行模块发送包括所述订阅请求报文的执行订阅命令;The script execution module is further configured to: execute the subscribed script method according to the second subscription command, invoke a corresponding subscription request message according to the subscribed script method, and send the include to the command execution module Executing a subscription request message for the subscription request message;
所述命令执行模块,还设置为:根据所述订阅请求报文执行HTTP请求调用,并将执行结果返回给所述脚本执行模块。The command execution module is further configured to: execute an HTTP request call according to the subscription request message, and return an execution result to the script execution module.
根据第一方面、第一方面的第一种到第四种可能的实现方式中任意一种,在第五种可能的实现方式中,所述北向接口测试装置还包括结果生成模块;According to the first aspect, the first to fourth possible implementation manners of the first aspect, in a fifth possible implementation, the northbound interface testing device further includes a result generating module;
所述脚本执行模块,还设置为:在所述命令执行模块将所述执行结果返回给所述脚本执行模块之后,将所述执行结果传输给所述结果生成模块;The script execution module is further configured to: after the command execution module returns the execution result to the script execution module, transmit the execution result to the result generation module;
所述结果生成模块,设置为:输出所述执行结果,其中,所述执行结果包括已测试的所有北向接口,以及每个所述北向接口的测试次数和测试时间。The result generating module is configured to: output the execution result, wherein the execution result includes all northbound interfaces that have been tested, and the number of tests and the test time of each of the northbound interfaces.
根据第一方面、第一方面的第一种到第四种可能的实现方式中任意一种,在第六种可能的实现方式中,According to the first aspect, any one of the first to fourth possible implementation manners of the first aspect, in a sixth possible implementation manner,
所述脚本执行模块通过以下方式执行所述脚本用例:按照所述脚本中每个脚本用例的顺序依次执行;和/或,The script execution module executes the script use case in the following manner: in order of each script use case in the script; and/or,
所述北向接口测试装置还包括记录模块;所述脚本执行模块,还设置为:在执行所述脚本用例的过程中,将所述脚本用例的执行信息和异常信息发送给所述记录模块;The northbound interface test device further includes a recording module, and the script execution module is further configured to: send the execution information and the abnormality information of the script use case to the recording module during execution of the script use case;
所述记录模块,设置为:记录并展示所述脚本用例的执行信息和异常信息。The recording module is configured to: record and display execution information and abnormality information of the script use case.
第二方面,本发明实施例提供一种北向接口的测试方法,包括:In a second aspect, an embodiment of the present invention provides a test method for a northbound interface, including:
脚本执行模块执行预先开发的脚本中的脚本用例,根据所述脚本用例调用相应的请求报文,并向命令执行模块发送包括所述请求报文的执行命令;The script execution module executes a script use case in a pre-developed script, invokes a corresponding request message according to the script use case, and sends an execution command including the request message to the command execution module;
所述命令执行模块根据所述请求报文的内容执行相应的测试操作,并将 执行结果返回给所述脚本执行模块,所述请求报文用于对当前测试的北向接口对应的通讯接口的进行测试。The command execution module performs a corresponding test operation according to the content of the request message, and The execution result is returned to the script execution module, and the request message is used to test the communication interface corresponding to the currently tested northbound interface.
在第二方面的第一种可能的实现方式中,所述脚本执行模块当前执行的脚本用例中包括测试通知的任务,所述脚本执行所述脚本用例之后,所述测试方法还包括:In a first possible implementation manner of the second aspect, the script execution example currently executed by the script execution module includes a task of testing a notification, and after the script executes the script use case, the test method further includes:
所述脚本执行模块向通知接收模块发送第一订阅命令;The script execution module sends a first subscription command to the notification receiving module;
所述通知接收模块获取所述第一订阅命令指示的测试通知,并将所述获取的测试通知返回给所述脚本执行模块;The notification receiving module acquires the test notification indicated by the first subscription command, and returns the obtained test notification to the script execution module;
所述脚本执行模块向所述通知接收模块发送取消订阅命令。The script execution module sends an unsubscribe command to the notification receiving module.
在第二方面的第二种可能的实现方式中,In a second possible implementation of the second aspect,
所述脚本执行模块执行预先开发的脚本中的脚本用例之前,所述测试方法还包括:Before the script execution module executes the script use case in the pre-developed script, the test method further includes:
初始化模块初始化脚本加载模块加载所述预先开发的脚本,初始化所述命令执行模块的参数和所述通知接收模块的参数,其中,所述脚本执行模块执行的脚本用例为根据所述脚本加载模块加载所述脚本中的每个脚本用例所获取的,所述脚本包括所述脚本用例和脚本方法,所述脚本方法为所述脚本用例的执行方法;The initialization module initialization script loading module loads the pre-developed script, initializes the parameters of the command execution module and the parameters of the notification receiving module, wherein the script use case executed by the script execution module is loaded according to the script loading module Obtained by each script use case in the script, the script includes the script use case and a script method, and the script method is an execution method of the script use case;
所述初始化模块初始化所述通知接收模块的参数之后,所述测试方法还包括:After the initialization module initializes the parameters of the notification receiving module, the testing method further includes:
所述通知接收模块在初始化后持续接收服务器发送的通知。The notification receiving module continuously receives the notification sent by the server after initialization.
根据第二方面的第二种可能的实现方式,在第三种可能的实现方式中,所述当前测试的北向接口为公共对象请求代理体系结构(CORBA)接口,所述初始化所述命令执行模块的参数,包括:初始化对象请求代理(ORB);According to a second possible implementation manner of the second aspect, in a third possible implementation, the current test northbound interface is a Common Object Request Broker Architecture (CORBA) interface, and the command execution module is initialized. Parameters, including: Initialization Object Request Broker (ORB);
所述初始化所述通知接收模块的参数,包括:通过对象管理组织(OMG)标准,指示所述通知接收模块调用接收所述服务器发送的通知;The initializing the parameter of the notification receiving module includes: instructing, by an object management organization (OMG) standard, that the notification receiving module invokes receiving a notification sent by the server;
所述脚本执行模块执行预先开发的脚本中的脚本用例之前,所述测试方法还包括: Before the script execution module executes the script use case in the pre-developed script, the test method further includes:
所述初始化模块向所述脚本执行模块发送登陆命令,所述登陆命令中包括登陆的脚本方法;The initialization module sends a login command to the script execution module, where the login command includes a login script method;
所述脚本执行模块根据所述登陆命令执行所述登陆的脚本方法,根据所述登陆的脚本方法调用相应的登陆请求报文,并向所述命令执行模块发送包括所述登陆请求报文的执行登陆命令;The script execution module executes the login script method according to the login command, invokes a corresponding login request message according to the login script method, and sends an execution including the login request message to the command execution module. Login command
所述命令执行模块根据所述接收到的登陆请求报文执行CORBA的动态调用,并将执行结果返回给所述脚本执行模块。The command execution module performs a dynamic call of CORBA according to the received login request message, and returns an execution result to the script execution module.
根据第二方面的第二种可能的实现方式,在第四种可能的实现方式中,所述当前测试的北向接口为多重技术操作系统(MTOSI)接口或者软件定义网络(SDN)的北向,所述初始化所述命令执行模块的参数,包括:初始化用于构造超文本传输协议(HTTP)请求报文的统一资源定位符(URL);According to a second possible implementation manner of the second aspect, in a fourth possible implementation manner, the currently tested northbound interface is a multi-technology operating system (MTOSI) interface or a northbound direction of a software-defined network (SDN). Initializing parameters of the command execution module, including: initializing a uniform resource locator (URL) for constructing a hypertext transfer protocol (HTTP) request message;
所述初始化所述通知接收模块的参数,包括:订阅MTOSI通知;The initializing the parameters of the notification receiving module includes: subscribing to an MTOSI notification;
所述初始化模块初始化所述通知接收模块的参数之后,所述测试方法还包括:After the initialization module initializes the parameters of the notification receiving module, the testing method further includes:
所述通知接收模块向所述脚本执行模块发送第二订阅命令,所述第二订阅命令中包括订阅的脚本方法;The notification receiving module sends a second subscription command to the script execution module, where the second subscription command includes a subscribed script method;
所述脚本执行模块根据所述第二订阅命令执行所述订阅的脚本方法,根据所述订阅的脚本方法调用相应的订阅请求报文,并向所述命令执行模块发送包括所述订阅请求报文的执行订阅命令;The script execution module executes the subscribed script method according to the second subscription command, invokes a corresponding subscription request message according to the subscribed script method, and sends the subscription request message to the command execution module. Execute the subscription command;
所述命令执行模块根据所述订阅请求报文执行HTTP请求调用,并将执行结果返回给所述脚本执行模块。The command execution module executes an HTTP request call according to the subscription request message, and returns an execution result to the script execution module.
根据第二方面、第二方面的第一种到第四种可能的实现方式中任意一种,在第五种可能的实现方式中,所述命令执行模块将执行结果返回给所述脚本执行模块之后,所述测试方法还包括:According to the second aspect, any one of the first to fourth possible implementation manners of the second aspect, in a fifth possible implementation, the command execution module returns an execution result to the script execution module Thereafter, the test method further includes:
所述脚本执行模块将所述执行结果传输给结果生成模块;The script execution module transmits the execution result to the result generation module;
所述结果生成模块输出所述执行结果,所述执行结果包括已测试的所有北向接口,以及每个所述北向接口的测试次数和测试时间。The result generation module outputs the execution result, the execution result including all northbound interfaces that have been tested, and the number of tests and the test time of each of the northbound interfaces.
根据第二方面、第二方面的第一种到第四种可能的实现方式中任意一 种,在第六种可能的实现方式中,所述脚本执行模块执行所述脚本用例,包括:所述脚本执行模块按照所述脚本中每个脚本用例的顺序依次执行;和/或,According to the second aspect, any one of the first to fourth possible implementations of the second aspect In a sixth possible implementation manner, the script execution module executes the script use case, including: the script execution module sequentially executes in the order of each script use case in the script; and/or,
所述脚本执行模块执行所述脚本用例的过程中,所述测试方法还包括:In the process of executing the script use case by the script execution module, the test method further includes:
所述脚本执行模块将所述脚本用例的执行信息和异常信息发送给记录模块;The script execution module sends the execution information and the abnormality information of the script use case to the recording module;
所述记录模块记录并展示所述脚本用例的执行信息和异常信息。The recording module records and displays execution information and exception information of the script use case.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现上述北向接口的测试方法。The embodiment of the invention further provides a computer readable storage medium storing computer executable instructions, which are implemented when the computer executable instructions are executed.
本发明实施例提供的北向接口测试装置和北向接口的测试方法,通过脚本执行模块执行预先开发的脚本中的脚本用例,并根据该脚本用例调用相应的请求报文,从而向命令执行模块发送包括该请求报文的执行命令,进而通过命令执行模块根据该请求报文的内容执行相应的测试操作,并将执行结果返回给脚本执行模块,本实施例中的请求报文用于对当前测试的北向接口对应的通讯接口进行测试,即本发明实施例通过脚本执行模块对脚本用例的测试逻辑,调用对北向接口执行相应测试功能的请求文本,从而通过调用命令执行模块执行上述调用的请求文本以实现脚本用例中编辑的对北向接口进行测试的任务;本发明实施例解决了采用相关技术中的测试工具测试北向接口时,由于需要通过对北向接口的业务接口进行硬编码才能实现对业务接口的固定功能进行测试,而导致北向接口的自动化测试能力限制较大的问题。The northbound interface test device and the northbound interface test method provided by the embodiment of the present invention execute a script use case in a pre-developed script through a script execution module, and call a corresponding request message according to the script use case, thereby sending the command execution module to the command execution module. The execution command of the request message, and the command execution module performs a corresponding test operation according to the content of the request message, and returns the execution result to the script execution module. The request message in this embodiment is used for the current test. The communication interface corresponding to the northbound interface is tested. In the embodiment of the present invention, the test logic of the script use case is executed by the script execution module, and the request text for executing the corresponding test function on the northbound interface is invoked, thereby executing the request text of the call by calling the command execution module. The task of testing the northbound interface edited in the script use case is implemented. When the northbound interface is tested by using the test tool in the related art, the service interface of the northbound interface can be hard coded to implement the service interface. Fixed function Test, which led to a big problem to the north limit automated testing capabilities of the interface.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
附图用来提供对本申请技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。The drawings are used to provide a further understanding of the technical solutions of the present application, and constitute a part of the specification, which is used together with the embodiments of the present application to explain the technical solutions of the present application, and does not constitute a limitation of the technical solutions of the present application.
图1为北向接口的应用场景的示意图;FIG. 1 is a schematic diagram of an application scenario of a northbound interface;
图2为本发明实施例提供的一种北向接口测试装置的结构示意图; 2 is a schematic structural diagram of a northbound interface testing device according to an embodiment of the present invention;
图3为图2所示实施例提供的北向接口测试装置的测试原理图;3 is a schematic diagram of testing of a northbound interface test device provided by the embodiment shown in FIG. 2;
图4为本发明实施例提供的另一种北向接口测试装置的结构示意图;4 is a schematic structural diagram of another northbound interface testing device according to an embodiment of the present invention;
图5为本发明实施例提供的又一种北向接口测试装置的结构示意图;FIG. 5 is a schematic structural diagram of still another northbound interface testing device according to an embodiment of the present disclosure;
图6为本发明实施例提供的一种北向接口的测试方法的流程图;FIG. 6 is a flowchart of a method for testing a northbound interface according to an embodiment of the present invention;
图7为本发明实施例提供的另一种北向接口的测试方法的流程图;FIG. 7 is a flowchart of another method for testing a northbound interface according to an embodiment of the present invention;
图8为本发明实施例提供的又一种北向接口的测试方法的流程图。FIG. 8 is a flowchart of still another method for testing a northbound interface according to an embodiment of the present invention.
本发明的实施方式Embodiments of the invention
下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, in the case of no conflict, the features in the embodiments and the embodiments in the present application may be arbitrarily combined with each other.
在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps illustrated in the flowchart of the figures may be executed in a computer system such as a set of computer executable instructions. Also, although logical sequences are shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than the ones described herein.
图1所示为北向接口的应用场景的示意图。其中,无填充的方块代表服务器端,具有填充的方块代表客户端,在北向接口的对接过程中,用户直接可见的就是设备厂商所提供的接口定义,即图1中的北向接口业务接口,例如对于CORBA接口,就是接口描述语言(Interface Description language,简称为:IDL)定义的接口簇,对于MTOSI接口,就是网络服务描述语言(Web Service Description language,简称为:WSDL)定义的接口簇,对于SDN北向接口,就是一系列以编号排定的文件(Request For Comments,简称为:RFC)6020中的定义的一种模型定义语音,即YANG定义的接口簇,上述北向接口业务接口还可以为其它形式的业务接口,客户端调用的是北向接口专门的编译器生成的接口定义。需要说明的是,北向接口协议的原理类似于开放式系统互联(Open System Interconnection,简称为:OSI)的七层通讯协议,即北向接口也是层模型,上述接口簇定义为最上层,接口簇的下面有一层或多层其它通讯协议,可以统称为通讯接口。Figure 1 shows a schematic diagram of an application scenario of a northbound interface. The unfilled squares represent the server side, and the filled squares represent the client. In the docking process of the northbound interface, the interface definition provided by the device manufacturer is directly visible to the user, that is, the northbound interface service interface in FIG. For the CORBA interface, it is the interface cluster defined by the Interface Description Language (IDL). For the MTOSI interface, it is the interface cluster defined by the Web Service Description Language (referred to as: WSDL) for SDN. The northbound interface is a model definition voice defined in a series of Request For Comments (RFC) 6020, that is, an interface cluster defined by YANG. The northbound interface service interface can also be other forms. The business interface, the client calls the interface definition generated by the special compiler of the northbound interface. It should be noted that the principle of the northbound interface protocol is similar to the seven-layer communication protocol of the Open System Interconnection (OSI), that is, the northbound interface is also a layer model, and the above interface cluster is defined as the uppermost layer, and the interface cluster is There are one or more layers of other communication protocols, which can be collectively referred to as communication interfaces.
在图1所示应用场景中,为了实现某项功能,即北向接口客户端实现,需要调用北向接口业务接口,该北向接口业务接口将输入转换后调用通讯接 口;服务器端的通讯接口收到调用通讯接口的请求后,并转换为北向接口业务接口的调用请求,然后调用北向接口服务器端实现。In the application scenario shown in Figure 1, in order to implement a certain function, that is, the northbound interface client implementation, the northbound interface service interface needs to be invoked, and the northbound interface service interface inputs the conversion and invokes the communication connection. The server-side communication interface receives the request to invoke the communication interface, and converts it into a call request of the northbound interface service interface, and then invokes the northbound interface server side implementation.
下面以具体的实施例对本申请的技术方案进行详细说明,本申请各实施例都可以应用于图1所示北向接口的应用场景中,对北向接口业务接口对应的通讯接口进行自动化测试。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solutions of the present application are described in detail in the following embodiments. The embodiments of the present application can be applied to the application scenario of the northbound interface shown in FIG. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in some embodiments.
图2为本发明实施例提供的一种北向接口测试装置的结构示意图。本实施例提供的北向接口测试装置适用于对北向接口业务接口进行测试的情况中,该北向接口测试装置通常以硬件和软件的方式实现,例如集成在测试设备的处理器中,供处理器调用执行。如图2所示,本实施例提供的北向接口测试装置包括:脚本执行模块11和命令执行模块12。FIG. 2 is a schematic structural diagram of a northbound interface testing device according to an embodiment of the present invention. In the case where the northbound interface test device provided in this embodiment is suitable for testing a northbound interface service interface, the northbound interface test device is usually implemented in hardware and software, for example, integrated in a processor of the test device, and is used by the processor. carried out. As shown in FIG. 2, the northbound interface testing apparatus provided in this embodiment includes: a script execution module 11 and a command execution module 12.
其中,脚本执行模块11,设置为:执行预先开发的脚本中的脚本用例,根据所述脚本用例调用相应的请求报文,并向命令执行模块12发送包括该请求报文的执行命令。The script execution module 11 is configured to execute a script use case in a pre-developed script, call a corresponding request message according to the script use case, and send an execution command including the request message to the command execution module 12.
在本实施例中,脚本执行模块11可以执行预先开发的脚本,该脚本为测试人员在开发北向接口测试装置后,针对北向接口的自动化测试编写的脚本语音,用于对北向接口进行自动化测试,该脚本中通常包括多个脚本用例,脚本执行模块11在执行脚本用例时,可以根据具体的脚本用例从请求报文集合中调用相应的请求报文,即本实施例中的脚本和请求报文的文本都是在进行自动化测试前已经开发好的,通常地,可以通过脚本用例编辑测试逻辑,即特定的脚本用例可以调用特定的请求报文,即脚本用例和请求报文为对应的关系,通过对某个脚本用例的执行调用出相应的请求报文,从而向命令执行模块12发送包括该请求报文的执行命令,具体由命令执行模块12对该调用的请求报文进行处理。In this embodiment, the script execution module 11 can execute a pre-developed script, which is a script voice written by the tester for the automation test of the northbound interface after developing the northbound interface test device, and is used for automatically testing the northbound interface. The script usually includes a plurality of script use cases. When the script execution module 11 executes the script use case, the script can be called from the request message set according to the specific script use case, that is, the script and the request message in this embodiment. The text has been developed before the automated test. Generally, the test logic can be edited through the script use case, that is, the specific script use case can call a specific request message, that is, the script use case and the request message are corresponding relationships. The command execution module 12 is configured to send an execution command including the request message by executing the corresponding request message, and the command execution module 12 processes the called request message.
需要说明的是,本实施例中的脚本执行模块11在执行脚本用例时,例如可以按照预先开发的脚本中每个脚本用例的顺序依次执行每个脚本用例;脚本执行模块11调用请求报文的方式为:根据当前执行的脚本用例的内容进行调用,即每次执行一个脚本用例时,调用到的请求报文通常是不同的;另外,调用到的请求报文为文本格式,例如可以为以可扩展标记语言 (Extensible Markup Language,简称为:XML)格式存储的文本。It should be noted that, when the script execution module 11 in this embodiment executes the script use case, for example, each script use case may be sequentially executed in the order of each script use case in the pre-developed script; the script execution module 11 invokes the request message. The method is: according to the content of the currently executed script use case, that is, each time a script use case is executed, the called request message is usually different; in addition, the requested request message is in a text format, for example, Extensible markup language (Extensible Markup Language, referred to as: XML) formatted text.
命令执行模块12,设置为:根据请求报文的内容执行相应的测试操作,并将执行结果返回给脚本执行模块11,其中,该请求报文用于对当前测试的北向接口对应的通讯接口进行测试。The command execution module 12 is configured to: perform a corresponding test operation according to the content of the request message, and return the execution result to the script execution module 11, where the request message is used to perform communication interface corresponding to the currently tested northbound interface. test.
本实施例中,在命令执行模块12接收到脚本执行模块11向其发送的执行命令后,可以根据该执行命令中指示执行的请求报文执行相应的测试操作,请求报文用于对当前测试的北向接口对应的通讯接口的能力进行测试。在具体实现中,由于测试人员在客户端已经开发的用于对测试北向接口业务接口的功能进行测试的脚本和请求报文集合,实际上是基于图1所示应用场景中北向接口业务接口将输入转换后调用对应的通讯接口,具体对转换后调用的通讯接口进行测试,即本实施例中将对北向接口的最上层的接口簇的测试转化为对下层通讯接口的测试,具体通过预定义的脚本和请求报文集合共同实现,即执行脚本用例就是通过该脚本用例获取针对当前脚本用例的请求报文,在请求报文中具体定义了测试方案,命令执行模块12执行请求报文就是说对当前脚本用例所指示测试的功能执行测试。In this embodiment, after the command execution module 12 receives the execution command sent by the script execution module 11, the corresponding test operation may be performed according to the request message indicated in the execution command, and the request message is used for the current test. The ability of the northbound interface to correspond to the communication interface is tested. In a specific implementation, the script and the request message set that the tester has developed on the client for testing the function of testing the northbound interface service interface are actually based on the northbound interface service interface in the application scenario shown in FIG. After the input is converted, the corresponding communication interface is called, and the communication interface called after the conversion is tested. In this embodiment, the test of the uppermost interface cluster of the northbound interface is converted into the test of the lower layer communication interface, specifically by pre-definition. The script and the request message collection are implemented together, that is, the execution script use case is to obtain the request message for the current script use case through the script use case, and the test plan is specifically defined in the request message, and the command execution module 12 executes the request message. Perform tests on the features of the tests indicated by the current script use case.
需要说明的是,本实施例中的脚本执行模块11执行脚本用例的过程,实际上就是通过反复调用命令执行模块12,以执行脚本执行模块11通过脚本用例调用到的请求报文;并且由于脚本执行模块11是按照脚本中每个脚本用例中的顺序依次执行的,因此,命令执行模块12执行请求报文的顺序同样是按照脚本执行模块11调用到请求报文的顺序依次执行的。It should be noted that the script execution module 11 in this embodiment executes the script use case, in fact, by repeatedly calling the command execution module 12 to execute the request message that the script execution module 11 calls through the script use case; The execution module 11 is sequentially executed in the order of each script use case in the script. Therefore, the order in which the command execution module 12 executes the request message is also sequentially executed in the order in which the script execution module 11 calls the request message.
采用本实施例提供的北向接口测试装置对待测北向接口业务接口的功能进行测试,实际上是转换后对对应的通讯接口进行自动化测试,需要通过脚本执行模块11先执行预先开发的脚本用例,通过对脚本用例的执行调用到与测试相关的请求报文,即测试通讯接口的两个因素即是脚本用例和请求报文。图3所示为图2所示实施例提供的北向接口测试装置的测试原理图,与图1所述应用场景类似地,无填充的方块代表服务器端,具有填充的方块代表客户端,北向接口测试装置通过执行脚本用例和调用与当前脚本用例对应的请求报文对客户端的北向接口业务接口对应的通讯接口进行测试,也就是通过客户端对服务器端对应通讯接口进行测试,从而根据测试的结果,即命 令执行模块12执行请求报文的执行结果验证客户端和服务器端北向接口业务接口的功能。The northbound interface test device provided by this embodiment is tested for the function of the northbound interface service interface. In fact, after the conversion, the corresponding communication interface is automatically tested, and the script execution module 11 is required to execute the pre-developed script use case first. The execution of the script use case calls the request message related to the test, that is, the two factors that test the communication interface are the script use case and the request message. FIG. 3 is a schematic diagram showing the test of the northbound interface test apparatus provided in the embodiment shown in FIG. 2. Similar to the application scenario shown in FIG. 1, the unfilled square represents the server side, and the filled square represents the client, and the northbound interface. The test device tests the communication interface corresponding to the northbound interface service interface of the client by executing the script use case and calling the request message corresponding to the current script use case, that is, testing the corresponding communication interface of the server through the client, thereby according to the test result. Life The execution module 12 performs the execution result of the request message to verify the function of the client interface and the server-side northbound interface service interface.
本实施例将对北向接口业务接口实现功能的自动化测试,建立在对应的通讯接口上,由于通讯接口可以识别的输入通常是文本或者文本编码的二进制流,例如对于CORBA接口来说,是基于互联网内部对象请求代理协议(Internet Inter-ORB Protocol,简称为:IIOP)的CORBA动态调用接口,对于MTOSI和SDN来说,是超文本传输协议(HyperText Transfer Protocol,简称为:HTTP);测试方案都是将IDL或者WSDL的请求报文先保存下来,如图3中的北向接口请求报文,从而通过脚本来编辑测试逻辑,即测试人员将测试顺序以脚本用例的形式编写在脚本中,以完成多项功能的用例测试,如图3的北向接口自动化测试脚本。本实施例提供的北向接口测试装置在执行测试的过程中与具体的北向接口业务接口定义无关,只负责执行试脚本用例即可实现对北向接口业务接口的自动化测试。In this embodiment, the automatic test of the function of the northbound interface service interface is established on the corresponding communication interface. The input that can be recognized by the communication interface is usually a binary stream of text or text encoding. For example, for the CORBA interface, it is based on the Internet. The internal object request proxy protocol (Internet Inter-ORB Protocol, IIOP) CORBA dynamic call interface, for MTOSI and SDN, is the HyperText Transfer Protocol (HTTP); the test plan is The IDL or WSDL request message is saved first, such as the northbound interface request message in FIG. 3, so that the test logic is edited by the script, that is, the tester writes the test sequence in the script in the form of a script use case to complete the test. The use case test of the item function, as shown in the northbound interface automation test script of Figure 3. The northbound interface test device provided in this embodiment is independent of the specific northbound interface service interface definition in the process of performing the test, and is only responsible for executing the test script use case to implement automatic test of the northbound interface service interface.
本实施例提供的北向接口测试装置,通过脚本执行模块执行预先开发的脚本中的脚本用例,并根据该脚本用例调用相应的请求报文,从而向命令执行模块发送包括该请求报文的执行命令,进而通过命令执行模块根据该请求报文的内容执行相应的测试操作,并将执行结果返回给脚本执行模块,本实施例中的请求报文用于对当前测试的北向接口对应的通讯接口进行测试,即本实施例通过脚本执行模块对脚本用例的测试逻辑,调用对北向接口执行相应测试功能的请求文本,从而通过调用命令执行模块执行上述调用的请求文本以实现脚本用例中编辑的对北向接口进行测试的任务;本实施例解决了采用相关技术中的测试工具测试北向接口时,由于需要通过对北向接口的业务接口进行硬编码才能实现对业务接口的固定功能进行测试,而导致北向接口的自动化测试能力限制较大的问题。The northbound interface test apparatus provided in this embodiment executes a script use case in a pre-developed script through a script execution module, and invokes a corresponding request message according to the script use case, thereby transmitting an execution command including the request message to the command execution module. Then, the command execution module performs a corresponding test operation according to the content of the request message, and returns the execution result to the script execution module. The request message in this embodiment is used to perform the communication interface corresponding to the currently tested northbound interface. The test, that is, the test logic of the script use case is executed by the script execution module, and the request text for executing the corresponding test function on the northbound interface is invoked, thereby executing the call request text by calling the command execution module to implement the edited northward direction in the script use case. The test is performed on the interface. This example solves the problem of testing the fixed function of the service interface by hard coding the service interface of the northbound interface. Automated measurement Capacity constraints bigger problem.
相比于相关技术中的测试工具通过硬编码的方式实现对北向接口业务接口的固定功能进行测试的方案来说,本实施例提供的北向接口测试装置将北向接口业务接口与北向接口测试装置解耦,即自动化测试建立在待测试的北向接口业务接口对应的通讯接口上,使得自动化测试开发变为请求报文和脚本用例的开发,该请求报文为通讯接口可以识别的文本输入,降低了自动化 用例开发的门槛,在测试通讯接口前,测试人员可以根据测试需求进行研发,开发出用于测试的脚本用例;并且如果脚本用例通过测试,则说明与该通讯接口对应的北向接口业务接口的功能验证通过。本实施例提供的北向接口测试装置在开发自动化测试用例时具有快速灵活的特点,能成倍地提高开发测试的效率,从而提高产品质量,特别适合于敏捷开发。The northbound interface test device provided by the present embodiment solves the northbound interface service interface and the northbound interface test device, as compared with the test tool in the related art, which implements the test of the fixed function of the northbound interface service interface in a hard-coded manner. Coupling, that is, the automated test is established on the communication interface corresponding to the northbound interface service interface to be tested, so that the automated test development becomes the development of the request message and the script use case, and the request message is a text input that the communication interface can recognize, which is reduced. Automation The threshold for use case development, before testing the communication interface, the tester can develop according to the test requirements, develop a script use case for testing; and if the script use case passes the test, the function of the northbound interface service interface corresponding to the communication interface is explained. Verification passed. The northbound interface test device provided in this embodiment has the characteristics of rapid and flexible development in the development of automated test cases, can double the efficiency of development and test, thereby improving product quality, and is particularly suitable for agile development.
可选地,图4为本发明实施例提供的另一种北向接口测试装置的结构示意图。在本实施例中,脚本执行模块11当前执行的脚本用例中包括测试通知的任务,则在图2所示北向接口测试装置的基础上,本实施例提供的装置还包括通知接收模块13,其中,脚本执行模块11,还设置为:在执行脚本用例之后,向通知接收模块13发送第一订阅命令;相应地,通知接收模块13,设置为:获取该第一订阅命令指示的测试通知,并将获取的测试通知返回给脚本执行模块11;随后,脚本执行模块11在获得脚本用例中指示需要的测试通知后,即完成测试通知的任务后,可以进一步向通知接收模块13发送取消订阅命令,以取消测试通知的任务。Optionally, FIG. 4 is a schematic structural diagram of another northbound interface testing device according to an embodiment of the present invention. In this embodiment, the script execution module 11 currently executes the task of the test notification, and the device provided in this embodiment further includes a notification receiving module 13 based on the northbound interface test device shown in FIG. The script execution module 11 is further configured to: after executing the script use case, send a first subscription command to the notification receiving module 13; correspondingly, the notification receiving module 13 is configured to: obtain a test notification indicated by the first subscription command, and Returning the obtained test notification to the script execution module 11; subsequently, after obtaining the required test notification in the script use case, that is, after completing the task of the test notification, the script execution module 11 may further send the unsubscribe command to the notification receiving module 13 To cancel the test notification task.
需要说明的是,本实施例中的通知接收模块13在启动后可以一直接收服务器端发送的通知,当脚本执行模块11向其订阅通知时,该通知接收模块13根据第一订阅命令中需要测试通知的内容,从服务器端接收的通知中找到上述脚本执行模块11订阅的通知,并返回给脚本执行模块11;即本实施例中的订阅通知的操作为北向接口测试装置的内部模块之间的通知订阅。另外,本实施例中的脚本执行模块11执行脚本用例的过程,不仅需要通过反复调用命令执行模块12来执行脚本执行模块11调用到的请求报文,还需要通过反复调用通知接收模块13来订阅脚本执行模块11当前执行的脚本用例中需要测试的通知。It should be noted that the notification receiving module 13 in this embodiment can always receive the notification sent by the server after being started. When the script execution module 11 subscribes to the notification, the notification receiving module 13 needs to test according to the first subscription command. The notification is obtained from the notification received by the server, and the notification of the subscription by the script execution module 11 is found, and is returned to the script execution module 11; that is, the operation of the subscription notification in the embodiment is between the internal modules of the northbound interface test device. Notification subscription. In addition, the script execution module 11 in this embodiment executes the script use case, and not only needs to execute the request message that the script execution module 11 calls by repeatedly calling the command execution module 12, but also needs to subscribe by repeatedly calling the notification receiving module 13. The script execution module 11 currently executes a notification in the script use case that needs to be tested.
可选地,图4所示的北向接口测试装置还可以包括:初始化模块14和脚本加载模块15,其中,初始化模块14,设置为:在脚本执行模块11执行预先开发的脚本中的脚本用例之前,初始化脚本加载模块15加载该预先开发的脚本,同时初始化命令执行模块12的参数和通知接收模块13的参数,其中,脚本执行模块11执行的脚本用例就是根据脚本加载模块15加载该脚本中的每个脚本用例所获取的,该脚本包括脚本用例和脚本方法,该脚本方法 为脚本用例的执行方法;相应地,通知接收模块13,还设置为:在初始化后持续接收服务器发送的通知。需要说明的是,本实施例不限制初始化模块14初始化脚本加载模块15、命令执行模块12和通知接收模块13的顺序,可以是依次执行的,也可以是并行执行的。Optionally, the northbound interface test apparatus shown in FIG. 4 may further include: an initialization module 14 and a script loading module 15, wherein the initialization module 14 is configured to: before the script execution module 11 executes the script use case in the pre-developed script The initialization script loading module 15 loads the pre-developed script, and initializes the parameters of the command execution module 12 and the parameters of the notification receiving module 13, wherein the script use case executed by the script execution module 11 is loaded according to the script loading module 15 Obtained by each script use case, the script includes script use cases and script methods, the script method The execution method of the script use case; correspondingly, the notification receiving module 13 is further configured to: continuously receive the notification sent by the server after the initialization. It should be noted that, the embodiment does not limit the order in which the initialization module 14 initializes the script loading module 15, the command execution module 12, and the notification receiving module 13, and may be executed sequentially or in parallel.
在本实施例中,脚本加载模块15所加载的脚本例如为基于面向对象的程序设计语言Java虚拟机的编程语言(Groovy)编程的脚本,即Groovy脚本,由于Groovy语言是对Java语言的扩展,因此开发Groovy脚本的工作量较小;并且脚本加载模块15加载的Groovy脚本分为两部分内容,一部分是Groovy脚本方法,一部分是Groovy脚本用例,其中,Groovy脚本方法可以是一些常用的或者被一个或多个Groovy脚本用例公用的方法,例如为用于初始化模块14的登陆的Groovy脚本方法。In this embodiment, the script loaded by the script loading module 15 is, for example, a script based on an object-oriented programming language Java virtual machine programming language (Groovy), that is, a Groovy script, since the Groovy language is an extension to the Java language, Therefore, the workload of developing Groovy scripts is small; and the Groovy script loaded by the script loading module 15 is divided into two parts, one is the Groovy script method, and the other is the Groovy script use case, wherein the Groovy script method can be some commonly used or one by one. Or a method common to multiple Groovy script use cases, such as a Groovy script method for initializing the login of module 14.
在通过本发明实施例提供的装置测试北向接口的一种应用场景中,图5所示为本发明实施例提供的又一种北向接口测试装置的结构示意图。本实施例可以用于测试CORBA接口,则脚本执行模块11通过执行脚本用例调用到的请求报文为CORBA请求报文,该CORBA请求报文同样为XML格式的文本文件。本实施例在具体实现中,一方面,初始化模块14通过以下方式初始化命令执行模块12的参数:根据服务器的网络协议(Internet Protocol,简称为:IP)和命名服务端口,初始化对象请求代理(Object Request Broker,简称为:ORB);另一方面,初始化模块14通过以下方式初始化通知接收模块13的参数:根据服务器通知的服务端口,通过对象管理组织(Object Management Group,简称为:OMG)标准,指示通知接收模块13持续接收服务器发送的通知。In an application scenario of testing a northbound interface by using the device provided by the embodiment of the present invention, FIG. 5 is a schematic structural diagram of another northbound interface testing device according to an embodiment of the present invention. This embodiment can be used to test the CORBA interface. The script execution module 11 executes the request message that is invoked by the script use case as a CORBA request message, and the CORBA request message is also a text file in XML format. In this embodiment, in an implementation, on the one hand, the initialization module 14 initializes the parameters of the command execution module 12 by: initializing the object requesting proxy according to the network protocol (IP) of the server and the naming service port (Object) Request Broker, referred to as: ORB); on the other hand, the initialization module 14 initializes the parameters of the notification receiving module 13 by: according to the service port notified by the server, through the Object Management Group (OMG) standard, The notification notification receiving module 13 continues to receive the notification sent by the server.
本实施例在具体实现中,命令执行模块12可以为CORBA命令执行模块12,通知接收模块13可以为OMG通知接收模块13,该OMG通知接收模块13在初始化之后,一直处于接收OMG通知的状态,可以提供订阅和取消订阅的接口,例如,在脚本执行模块11执行脚本用例时,如遇到要测试某个通知的情况,就向通知接收模块13发送第一订阅命令以订阅需要通知时,此时,通知接收模块13在从服务器接收到的通知中找到第一订阅命令指示的订阅的测试通知,从而向脚本执行模块11返回其所需的测试通知,完成 测试通知的任务后则可以取消通知订阅。In a specific implementation, the command execution module 12 may be a CORBA command execution module 12, and the notification receiving module 13 may notify the OMG notification receiving module 13 that the OMG notification receiving module 13 is in the state of receiving the OMG notification after initialization. An interface for subscribing and unsubscribing can be provided. For example, when the script execution module 11 executes the script use case, if a situation in which a certain notification is to be tested is encountered, the first subscription command is sent to the notification receiving module 13 to subscribe to the notification. The notification receiving module 13 finds the test notification of the subscription indicated by the first subscription command in the notification received from the server, thereby returning the required test notification to the script execution module 11 to complete You can cancel the notification subscription after you have tested the notification's tasks.
需要说明的是,本实施例同样以脚本加载模块15加载的脚本为Groovy脚本为例予以说明,该Groovy脚本包括Groovy脚本方法和Groovy脚本用例,对于CORBA接口,都需要遵循814标准中的定义,定义了使用EmsSessionFactory来获得getEmsSession的登陆方法;可选地,在执行每个Groovy脚本用例前,都需要先进行登录操作,与待执行的Groovy脚本用例对应的Groovy脚本方法即是初始化模块14指示执行的登录的Groovy脚本方法。本实施例提供的装置在具体实现中,初始化模块14,还设置为:在脚本执行模块11执行脚本用例之前,向脚本执行模块11发送登陆命令,其中,该登陆命令中包括登陆的脚本方法,例如为登录的Groovy脚本方法;脚本执行模块11,还设置为:根据登陆命令执行该登陆的Groovy脚本方法,并根据该登陆的Groovy脚本方法调用相应的登陆请求报文,例如为登陆的CORBA请求报文,该登陆的CORBA请求报文同样为以XML格式存储的文本文件,从而向命令执行模块12发送包括该登陆的CORBA请求报文的执行登陆命令;相应地,命令执行模块12,还设置为:根据接收到的登陆的CORBA请求报文执行CORBA的动态调用,执行完成后将执行结果返回给脚本执行模块11。It should be noted that, in this embodiment, the script loaded by the script loading module 15 is also taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case. For the CORBA interface, the definition in the 814 standard needs to be followed. The login method for obtaining getEmsSession using EmsSessionFactory is defined; optionally, before each Groovy script use case is executed, a login operation is required first, and the Groovy script method corresponding to the Groovy script use case to be executed is the initialization module 14 instructing execution. Log in to the Groovy script method. In a specific implementation, the initialization module 14 is further configured to: before the script execution module 11 executes the script use case, send a login command to the script execution module 11, where the login command includes a login script method. For example, the registered Groovy script method; the script execution module 11 is further configured to: execute the logged-in Groovy script method according to the login command, and invoke the corresponding login request message according to the logged-in Groovy script method, for example, a login CORBA request. The message, the logged-in CORBA request message is also a text file stored in an XML format, thereby sending an execution login command including the logged-in CORBA request message to the command execution module 12; accordingly, the command execution module 12 also sets The dynamic call of the CORBA is performed according to the received CORBA request message, and the execution result is returned to the script execution module 11 after the execution is completed.
需要说明的是,图5所示实施例与图4所示实施例的不同在于,由于本实施例对CORBA接口的测试需要遵循814标准中的定义,即脚本执行模块11执行脚本用例前,需要先进行登录操作,该操作中需要初始化模块14向脚本执行模块11发送登陆命令,因此,图5所示实施例中初始化模块14与脚本执行模块11具有发送信令的连接关系。另外,本发明实施例中的请求报文可以全部以XML格式的文本文件存储,命令执行模块12接收到执行登陆命令后,读取该命令中的登陆的CORBA请求报文,读取完成后通过ORB调用CORBA的动态调用接口,调用完成后将执行结果重新保存为XML格式的文本文件,以供脚本执行模块11进行后续使用。再者,本实施例中的脚本执行模块11可以采用单元测试用例框架执行脚本加载模块15加载的脚本用例。It should be noted that the embodiment shown in FIG. 5 is different from the embodiment shown in FIG. 4 in that the test of the CORBA interface in this embodiment needs to follow the definition in the 814 standard, that is, before the script execution module 11 executes the script use case, The login operation is first performed, in which the initialization module 14 is required to send a login command to the script execution module 11. Therefore, in the embodiment shown in FIG. 5, the initialization module 14 and the script execution module 11 have a connection relationship for transmitting signaling. In addition, the request message in the embodiment of the present invention may all be stored in a text file in an XML format. After receiving the login command, the command execution module 12 reads the registered CORBA request message in the command, and passes the read after the reading is completed. The ORB calls the dynamic call interface of CORBA. After the call is completed, the execution result is re-saved as a text file in XML format for subsequent use by the script execution module 11. Furthermore, the script execution module 11 in this embodiment can execute the script use case loaded by the script loading module 15 by using the unit test case framework.
在通过本发明实施例提供的装置测试北向接口的另一种应用场景中,可 以参考图4所示的北向接口测试装置的结构示意图。本实施例提供的北向接口测试装置可以用于测试MTOSI接口或者SDN的北向,则脚本执行模块11通过执行脚本用例调用到的请求报文为HTTP请求报文,该HTTP请求报文同样可以为XML格式的文本文件。本实施例在具体实现中,一方面,初始化模块14通过以下方式初始化命令执行模块12的参数:初始化服务器的统一资源定位符(Uniform Resource Locator,简称为:URL)参数,也就是初始化用于构造HTTP请求报文的URL,由于本实施例中脚本执行模块11执行脚本用例时调用HTTP请求报文,HTTP请求报文需要包括URL,该HTTP请求报文例如可以为简单对象访问协议(Simple Object Access Protocol,简称为:SOAP)请求报文,该SOAP请求报文可以是HTTP请求报文的具体应用;另一方面,初始化模块14通过以下方式初始化通知接收模块13的参数:订阅MTOSI通知,从而指示通知接收模块13持续接收服务器发送的通知。本实施例在具体实现中,命令执行模块12例如可以为HTTP请求执行模块,通知接收模块13例如可以为Jetty(基于Java的网络容器)通知接收模块,该Jetty通知接收模块在初始化之后,一直处于接收MTOSI通知的状态,可以提供订阅和取消订阅的接口,脚本执行模块11向Jetty通知接收模块订阅通知和取消通知订阅的方式与上述实施例相同,均属于北向接口测试装置的内部模块之间的通知订阅。In another application scenario of testing a northbound interface by using the device provided by the embodiment of the present invention, Refer to the structural schematic diagram of the northbound interface test device shown in FIG. The northbound interface test device provided in this embodiment may be used to test the northbound direction of the MTOSI interface or the SDN, and the script execution module 11 uses the request message that is invoked by the script use case to be an HTTP request message, and the HTTP request message may also be an XML. Formatted text file. In this embodiment, in an implementation, on the one hand, the initialization module 14 initializes the parameters of the command execution module 12 by: initializing a Uniform Resource Locator (URL) parameter of the server, that is, initializing for constructing The URL of the HTTP request message, because the script execution module 11 in this embodiment executes the HTTP request message when the script use case is executed, the HTTP request message needs to include a URL, and the HTTP request message can be, for example, a simple object access protocol (Simple Object Access). Protocol, abbreviated as: SOAP) request message, the SOAP request message may be a specific application of the HTTP request message; on the other hand, the initialization module 14 initializes the parameter of the notification receiving module 13 by subscribing to the MTOSI notification, thereby indicating The notification receiving module 13 continuously receives the notification sent by the server. In a specific implementation, the command execution module 12 may be, for example, an HTTP request execution module, and the notification receiving module 13 may notify the receiving module, for example, a Jetty (Java-based network container), the Jetty notification receiving module is always in after the initialization. Receiving the status of the MTOSI notification, the interface for subscribing and unsubscribing can be provided, and the manner in which the script execution module 11 notifies the receiving module of the subscription notification and the cancellation notification subscription to the Jetty is the same as the above embodiment, and belongs to the internal module of the northbound interface test device. Notification subscription.
需要说明的是,本实施例同样以脚本加载模块15加载的脚本为Groovy脚本为例予以说明,该Groovy脚本包括Groovy脚本方法和Groovy脚本用例,在初始化模块14初始化Jetty通知接收模块的参数后,即订阅MTOSI通知后,需要通过调用订阅的Groovy脚本方法向服务器发送订阅通知,具体实现方式如下:通知接收模块13,还设置为:向脚本执行模块11发送第二订阅命令,其中,该第二订阅命令中包括订阅的脚本方法,例如为订阅的Groovy脚本方法;脚本执行模块11,还设置为:根据第二订阅命令执行该订阅的Groovy脚本方法,并根据该订阅的Groovy脚本方法调用相应的订阅请求报文,例如为订阅的SOAP请求报文,该订阅的SOAP请求报文同样为以XML格式存储的文本文件,从而向命令执行模块12发送包括该订阅的SOAP请求报文的执行订阅命令;相应地,命令执行模块12,还设置为:根据订阅的SOAP请求报文执行HTTP请求调用,执行完成后将执行结果返回 给脚本执行模块11。It should be noted that, in this embodiment, the script loaded by the script loading module 15 is taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case. After the initialization module 14 initializes the parameters of the Jetty notification receiving module, That is, after the MTOSI notification is subscribed, the subscription notification is sent to the server by calling the subscribed Groovy script method. The specific implementation is as follows: the notification receiving module 13 is further configured to: send a second subscription command to the script execution module 11, where the second The subscription command includes a subscribed script method, such as a subscription to the Groovy script method; the script execution module 11 is further configured to execute the subscription's Groovy script method according to the second subscription command, and invoke the corresponding according to the subscription's Groovy script method. Subscribing to the request message, for example, a subscribed SOAP request message, the subscribed SOAP request message is also a text file stored in an XML format, thereby transmitting an execution subscription command including the subscribed SOAP request message to the command execution module 12. Correspondingly, the command execution module 12 is further configured to: Read the SOAP request message to perform HTTP requests to call, after the completion of the implementation of the results returned The module 11 is executed for the script.
需要说明的是,上述实施例中,无论是测试CORBA接口时初始化通知接收模块13,还是测试MTOSI接口或者SDN的北向时初始化通知接收模块13,目的都是需要接收服务器端的通知,该订阅通知的操作为北向接口测试装置与服务器之间的通知订阅。It should be noted that, in the above embodiment, whether the initialization notification receiving module 13 is tested when testing the CORBA interface, or the northbound time initialization notification receiving module 13 of the MTOSI interface or the SDN is tested, the purpose is to receive a notification from the server, and the subscription notification is The operation is a notification subscription between the northbound interface test device and the server.
可选地,图4和图5所示实施例中的北向接口测试装置还可以包括结果生成模块16,则脚本执行模块11,还设置为:在命令执行模块12将执行结果返回给脚本执行模块11之后,将该执行结果传输给结果生成模块16;相应地,结果生成模块16,设置为:输出执行结果,其中,该执行结果包括已测试的所有北向接口,以及每个北向接口的测试次数和测试时间。另外,图4和图5所示实施例中的北向接口测试装置还可以包括记录模块17,则脚本执行模块11,还设置为:在执行脚本用例的过程中,将脚本用例的执行信息和异常信息发送给记录模块17;相应地,记录模块17,设置为:记录并展示脚本用例的执行信息和异常信息。Optionally, the northbound interface testing device in the embodiment shown in FIG. 4 and FIG. 5 may further include a result generating module 16, and the script executing module 11 is further configured to: return the execution result to the script execution module at the command execution module 12. After 11 , the execution result is transmitted to the result generation module 16; correspondingly, the result generation module 16 is configured to: output an execution result, wherein the execution result includes all northbound interfaces that have been tested, and the number of tests of each northbound interface And test time. In addition, the northbound interface test apparatus in the embodiment shown in FIG. 4 and FIG. 5 may further include a recording module 17, and the script execution module 11 is further configured to: execute execution information and an exception of the script use case in the process of executing the script use case. The information is sent to the recording module 17; accordingly, the recording module 17 is configured to record and display execution information and exception information of the script use case.
在具体实现中,脚本执行模块11执行完脚本用例后,可以通过结果生成模块16将测试结果以Web网页、文本或Excel等方式输出,以供测试人员查看执行结果,该执行结果中可以体现出每个脚本用例的执行情况,包括测试了哪些北向接口,以及测试的每个北向接口的测试次数和测试时间。另外,当脚本用例执行失败时,可以通过记录模块17所记录的信息查看相关异常运行状态。In a specific implementation, after the script execution module 11 executes the script use case, the result may be output by the result generation module 16 by using a webpage, a text, or an Excel, for the tester to view the execution result, and the execution result may be reflected. The execution of each script use case, including which northbound interfaces were tested, and the number of tests and test times for each northbound interface tested. In addition, when the script use case fails to execute, the related abnormal running state can be viewed through the information recorded by the recording module 17.
本发明实施例提供的北向接口测试装置,从北向接口的特性出发,以北向接口协议的底层协议,即通讯接口为基础进行自动化用例测试,从而在脚本开发完成后,只需要进行请求报文编写和脚本用例编写,就可快速完成旧脚本用例的变更,以及新脚本用例的开发,能与敏捷开发模式紧密结合,成倍地提高开发测试效率,有利于集成到持续集成系统中。另外,通过本发明实施例提供的北向接口测试装置,可以提供稳定的北向接口,而且,适用于各种应用场景中脚本用例的自动化测试开发,可以相应地降低维护该北向接口测试装置所需的人力成本。The northbound interface test device provided by the embodiment of the present invention performs the automatic use case test based on the underlying protocol of the northbound interface protocol, that is, the communication interface, from the characteristics of the northbound interface, so that only the request message is required after the script development is completed. By writing script use cases, you can quickly complete changes to old script use cases and the development of new script use cases. It can be closely integrated with the agile development model to multiply the efficiency of development testing and facilitate integration into a continuous integration system. In addition, the northbound interface test device provided by the embodiment of the present invention can provide a stable northbound interface, and is applicable to automatic test development of script use cases in various application scenarios, and can correspondingly reduce the maintenance required for the northbound interface test device. Labor costs.
图6为本发明实施例提供的一种北向接口的测试方法的流程图。本实施 例提供的方法适用于对北向接口的业务接口进行测试的情况中,该方法可以由北向接口测试装置执行,该北向接口测试装置通常以硬件和软件的方式实现,例如集成在测试设备的处理器中,供处理器调用执行。如图6所示,本实施例提供的方法包括以下步骤:FIG. 6 is a flowchart of a method for testing a northbound interface according to an embodiment of the present invention. This implementation In the case where the method provided is applicable to testing the service interface of the northbound interface, the method can be performed by a northbound interface test device, which is usually implemented in hardware and software, for example, a processor integrated in the test device. In, for the processor to call execution. As shown in FIG. 6, the method provided in this embodiment includes the following steps:
步骤S110,脚本执行模块执行预先开发的脚本中的脚本用例,并根据脚本用例调用相应的请求报文;Step S110, the script execution module executes the script use case in the pre-developed script, and invokes the corresponding request message according to the script use case;
步骤S120,脚本执行模块向命令执行模块发送包括请求报文的执行命令;Step S120: The script execution module sends an execution command including the request message to the command execution module.
步骤S130,命令执行模块根据请求报文的内容执行相应的测试操作;Step S130, the command execution module performs a corresponding test operation according to the content of the request message;
步骤S140,命令执行模块将执行结果返回给所述脚本执行模块,其中,该请求报文用于对当前测试的北向接口对应的通讯接口的能力进行测试。In step S140, the command execution module returns the execution result to the script execution module, where the request message is used to test the capability of the communication interface corresponding to the currently tested northbound interface.
本实施例中通过北向接口测试装置对北向接口的业务接口进行测试的应用场景同样可以参照上述图1所示的应用场景,其测试方式同样可以参照上述图3所示的测试原理图,即本实施例提供的北向接口的测试方法,在测试的过程中与具体的北向接口业务接口定义无关,只负责执行自动化测试脚本用例即可。The application scenario of testing the service interface of the northbound interface through the northbound interface test device in this embodiment can also refer to the application scenario shown in FIG. 1 above. The test mode can also refer to the test schematic diagram shown in FIG. 3 above. The test method of the northbound interface provided by the embodiment is independent of the specific northbound interface service interface definition during the test process, and is only responsible for executing the automated test script use case.
本发明实施例提供的北向接口的测试方法可以由图2所示实施例提供的北向接口测试装置执行,该方法的各步骤与本发明实施例提供的北向接口测试装置中的各装置的功能对应,其实现原理和技术效果类似,此处不再赘述。The test method of the northbound interface provided by the embodiment of the present invention can be performed by the northbound interface test device provided by the embodiment shown in FIG. 2, and the steps of the method correspond to the functions of the devices in the northbound interface test device provided by the embodiment of the present invention. The implementation principle and technical effect are similar, and will not be described here.
可选地,在上述图6所示实施例的基础上,若脚本执行模块当前执行的脚本用例中包括测试通知的任务,则本实施例提供的方法在步骤S110之后,还包括:Optionally, on the basis of the foregoing embodiment shown in FIG. 6, if the script execution example currently executed by the script execution module includes the task of the test notification, the method provided by the embodiment further includes:
步骤S111,脚本执行模块向通知接收模块发送第一订阅命令;Step S111, the script execution module sends a first subscription command to the notification receiving module.
步骤S112,通知接收模块获取第一订阅命令指示的测试通知;Step S112, the notification receiving module acquires the test notification indicated by the first subscription command;
步骤S113,通知接收模块将获取的测试通知返回给脚本执行模块,本实施例中获取的测试通知为从服务器端接收到的通知;In step S113, the notification receiving module returns the obtained test notification to the script execution module, and the test notification obtained in this embodiment is a notification received from the server.
步骤S114,脚本执行模块向通知接收模块发送取消订阅命令。 In step S114, the script execution module sends an unsubscribe command to the notification receiving module.
需要说明的是,本实施例不限制步骤S111至步骤S114与步骤S120至步骤S140的执行顺序,图6以步骤S111至步骤S114在步骤S120至步骤S140之前执行为例予以示出。It should be noted that the embodiment does not limit the execution sequence of step S111 to step S114 and step S120 to step S140, and FIG. 6 is illustrated by taking steps S111 to S114 before step S120 to step S140 as an example.
可选地,本实施例提供的方法,在步骤S110之前还包括:Optionally, the method provided in this embodiment further includes: before step S110:
步骤S101,初始化模块初始化脚本加载模块;Step S101, the initialization module initializes the script loading module;
步骤S102,脚本加载模块加载预先开发的脚本中的脚本用例,可选地,脚本执行模块执行的脚本用例就是根据该脚本加载模块加载脚本中的每个脚本用例所获取的,该脚本包括脚本用例和脚本方法,该脚本方法为脚本用例的执行方法;Step S102, the script loading module loads the script use case in the pre-developed script. Optionally, the script use case executed by the script execution module is obtained according to each script use case in the script loading module loading script, and the script includes a script use case. And a script method that is an execution method of the script use case;
类似地,上述方法还包括:Similarly, the above method further includes:
步骤S103,初始化模块初始化命令执行模块的参数;Step S103, the initialization module initializes a parameter of the command execution module;
步骤S104,初始化模块初始化通知接收模块的参数。Step S104, the initialization module initializes the parameters of the notification receiving module.
需要说明的是,本实施例不限制初始化模块执行步骤S101至步骤S102与执行步骤S103或步骤S104的顺序,图6以步骤S101至步骤S104为顺序的执行方式为例予以示出。It should be noted that the embodiment does not limit the order in which the initialization module performs steps S101 to S102 and performs step S103 or step S104. FIG. 6 shows an execution manner in the order of steps S101 to S104 as an example.
在本发明实施例提供的北向接口的测试方法的一种具体应用中,图7所示为本发明实施例提供的另一种北向接口的测试方法的流程图。本实施例用于测试CORBA接口,则步骤S110中脚本执行模块通过执行脚本用例调用到的请求报文为CORBA请求报文。在上述图6所示实施例的基础上,步骤S103可以替换为:根据服务器的IP和命名服务端口,初始化ORB;步骤S104可以替换为:根据服务器通知的服务端口,通过OMG标准,指示通知接收模块调用接收服务器发送的通知,即订阅OMG通知,本实施例中的通知接收模块在初始化之后,一直处于接收OMG通知的状态,具体实现方式与上述实施例相同,故在此不再赘述。In a specific application of the test method of the northbound interface provided by the embodiment of the present invention, FIG. 7 is a flowchart of another test method of the northbound interface according to the embodiment of the present invention. This embodiment is used to test the CORBA interface. In step S110, the script execution module calls the request message to be a CORBA request message by executing the script use case. On the basis of the foregoing embodiment shown in FIG. 6, step S103 may be replaced by: initializing the ORB according to the IP address of the server and the naming service port; step S104 may be replaced by: indicating the notification receiving by the OMG standard according to the service port notified by the server. The module is instructed to receive the notification sent by the server, that is, to subscribe to the OMG notification. The notification receiving module in this embodiment is in the state of receiving the OMG notification after the initialization. The specific implementation is the same as that in the foregoing embodiment, and therefore is not described here.
需要说明的是,本实施例同样以脚本加载模块加载的脚本为Groovy脚本为例予以说明,该Groovy脚本包括Groovy脚本方法和Groovy脚本用例,本实施例对CORBA接口进行测试,即在执行每个Groovy脚本用例前,都需要先进行登录操作,可选地,本实施例提供的方法在步骤S110之前还包 括:It should be noted that, in this embodiment, the script loaded by the script loading module is also taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case. This embodiment tests the CORBA interface, that is, executes each Before the Groovy script use case, the login operation needs to be performed first. Optionally, the method provided in this embodiment is further included before step S110. include:
步骤S105,初始化模块向脚本执行模块发送登陆命令,该登陆命令中包括登陆的Groovy脚本方法;Step S105, the initialization module sends a login command to the script execution module, where the login command includes a login Groovy script method;
步骤S106,脚本执行模块根据登陆命令执行登陆的Groovy脚本方法,并根据登陆的Groovy脚本方法调用相应的登陆的CORBA请求报文;Step S106, the script execution module executes the logged-in Groovy script method according to the login command, and invokes the corresponding logged-in CORBA request message according to the logged-in Groovy script method;
步骤S107,脚本执行模块向命令执行模块发送包括登陆的CORBA请求报文的执行登陆命令;Step S107, the script execution module sends an execution login command including the registered CORBA request message to the command execution module.
步骤S108,命令执行模块根据接收到的登陆的CORBA请求报文执行CORBA的动态调用;Step S108, the command execution module performs a dynamic call of the CORBA according to the received CORBA request message.
步骤S109,命令执行模块将执行结果返回给脚本执行模块。In step S109, the command execution module returns the execution result to the script execution module.
本发明实施例提供的北向接口的测试方法可以由图5所示实施例提供的北向接口测试装置执行,该方法的各步骤与本发明实施例提供的北向接口测试装置中的各装置的功能对应,其实现原理和技术效果类似,此处不再赘述。The test method of the northbound interface provided by the embodiment of the present invention can be performed by the northbound interface test device provided by the embodiment shown in FIG. 5, and the steps of the method correspond to the functions of the devices in the northbound interface test device provided by the embodiment of the present invention. The implementation principle and technical effect are similar, and will not be described here.
类似地,在本发明实施例提供的北向接口的测试方法的另一种具体应用中,图8所示为本发明实施例提供的又一种北向接口的测试方法的流程图。本实施例用于测试MTOSI接口或者SDN的北向,则步骤S110中脚本执行模块通过执行脚本用例调用到的请求报文为HTTP请求报文。在上述图6所示实施例的基础上,步骤S103可以替换为:初始化用于构造HTTP请求报文的URL;步骤S104可以替换为:订阅MTOSI通知,从而指示通知接收模块持续接收服务器发送的通知。Similarly, in another specific application of the test method of the northbound interface provided by the embodiment of the present invention, FIG. 8 is a flowchart of still another test method of the northbound interface according to the embodiment of the present invention. The present embodiment is used to test the northbound direction of the MTOSI interface or the SDN. In the step S110, the script execution module invokes the request message sent by the script use case as an HTTP request message. On the basis of the foregoing embodiment shown in FIG. 6, step S103 may be replaced by: initializing a URL for constructing an HTTP request message; step S104 may be replaced by: subscribing to the MTOSI notification, thereby instructing the notification receiving module to continuously receive the notification sent by the server. .
需要说明的是,本实施例同样以脚本加载模块加载的脚本为Groovy脚本为例予以说明,该Groovy脚本包括Groovy脚本方法和Groovy脚本用例,在初始化模块初始化通知接收模块订阅MTOSI通知后,通知接收模块需要调用订阅的脚本方法,可选地,本实施例提供的方法在步骤S104之后还包括:It should be noted that, in this embodiment, the script loaded by the script loading module is also taken as an example of a Groovy script, which includes a Groovy script method and a Groovy script use case, and the notification is received after the initialization module initialization notification receiving module subscribes to the MTOSI notification. The module needs to invoke the scripting method of the subscription. Optionally, the method provided in this embodiment further includes after step S104:
步骤S105,通知接收模块向脚本执行模块发送第二订阅命令,该第二订阅命令中包括订阅的Groovy脚本方法; Step S105, the notification receiving module sends a second subscription command to the script execution module, where the second subscription command includes a subscribed Groovy script method;
步骤S106,脚本执行模块根据第二订阅命令执行订阅的Groovy脚本方法,并根据该订阅的Groovy脚本方法调用相应的订阅的SOAP请求报文,Step S106, the script execution module executes the subscribed Groovy script method according to the second subscription command, and invokes the corresponding subscribed SOAP request message according to the subscribed Groovy script method.
步骤S107,脚本执行模块向命令执行模块发送包括订阅的SOAP请求报文的执行订阅命令;Step S107: The script execution module sends an execution subscription command including a subscribed SOAP request message to the command execution module.
步骤S108,命令执行模块根据订阅的SOAP请求报文执行HTTP请求调用;Step S108, the command execution module performs an HTTP request call according to the subscribed SOAP request message;
步骤S109,命令执行模块将执行结果返回给脚本执行模块。In step S109, the command execution module returns the execution result to the script execution module.
本发明实施例提供的北向接口的测试方法可以由图4所示实施例提供的北向接口测试装置执行,该方法的各步骤与本发明实施例提供的北向接口测试装置中的各装置的功能对应,其实现原理和技术效果类似,此处不再赘述。The test method of the northbound interface provided by the embodiment of the present invention can be performed by the northbound interface test device provided by the embodiment shown in FIG. 4, and the steps of the method correspond to the functions of the devices in the northbound interface test device provided by the embodiment of the present invention. The implementation principle and technical effect are similar, and will not be described here.
可选地,在上述各实施例提供的北向接口的测试方法的基础上,在步骤S140和步骤S109之后,均可以执行以下步骤:Optionally, on the basis of the testing method of the northbound interface provided by the foregoing embodiments, after step S140 and step S109, the following steps may be performed:
步骤S150,脚本执行模块将执行结果传输给结果生成模块;Step S150, the script execution module transmits the execution result to the result generation module;
步骤S160,结果生成模块输出执行结果,该执行结果包括已测试的所有北向接口,以及每个北向接口的测试次数和测试时间。In step S160, the result generation module outputs an execution result, which includes all the northbound interfaces that have been tested, and the number of tests and the test time of each northbound interface.
另外,在上述各实施例的基础上,脚本执行模块在执行脚本用例的过程中,所述测试方法还包括:脚本执行模块将脚本用例的执行信息和异常信息发送给记录模块;随后,记录模块记录并展示脚本用例的执行信息和异常信息。In addition, in the process of executing the script use case, the script execution module further includes: the script execution module transmitting the execution information and the abnormality information of the script use case to the recording module; and subsequently, the recording module Record and display execution information and exception information for script use cases.
此外,本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现上述北向接口的测试方法。In addition, an embodiment of the present invention further provides a computer readable storage medium, where computer executable instructions are stored, and the test method of the northbound interface is implemented when the computer executable instructions are executed.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的 程序/指令来实现其相应功能。本申请不限制于任何特定形式的硬件和软件的结合。One of ordinary skill in the art will appreciate that all or a portion of the above steps may be performed by a program to instruct related hardware, such as a processor, which may be stored in a computer readable storage medium, such as a read only memory, disk or optical disk. Wait. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the foregoing embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, being executed by a processor and stored in a memory. Programs/instructions to implement their respective functions. This application is not limited to any specific combination of hardware and software.
虽然本申请所揭露的实施方式如上,但所述的内容仅为便于理解本申请而采用的实施方式,并非用以限定本申请。任何本申请所属领域内的技术人员,在不脱离本申请所揭露的精神和范围的前提下,可以在实施的形式及细节上进行任何的修改与变化,但本申请的专利保护范围,仍须以所附的权利要求书所界定的范围为准。The embodiments disclosed in the present application are as described above, but the description is only for the purpose of understanding the present application, and is not intended to limit the present application. Any modifications and changes in the form and details of the embodiments may be made by those skilled in the art without departing from the spirit and scope of the disclosure. The scope defined by the appended claims shall prevail.
工业实用性Industrial applicability
本发明实施例提供一种北向接口测试装置和北向接口的测试方法,解决了采用相关技术中的测试工具测试北向接口时,由于需要通过对北向接口的业务接口进行硬编码才能实现对业务接口的固定功能进行测试,而导致北向接口的自动化测试能力限制较大的问题。 The embodiment of the present invention provides a test method for the northbound interface test device and the northbound interface, and solves the problem that the test interface of the related art is used to test the northbound interface, and the service interface of the northbound interface needs to be hard coded to implement the service interface. The fixed function is tested, which leads to a problem of large restrictions on the automated test capability of the northbound interface.

Claims (14)

  1. 一种北向接口测试装置,包括:脚本执行模块和命令执行模块;A northbound interface testing device includes: a script execution module and a command execution module;
    其中,所述脚本执行模块,设置为:执行预先开发的脚本中的脚本用例,根据所述脚本用例调用相应的请求报文,并向命令执行模块发送包括所述请求报文的执行命令;The script execution module is configured to: execute a script use case in a pre-developed script, invoke a corresponding request message according to the script use case, and send an execution command including the request message to the command execution module;
    所述命令执行模块,设置为:根据所述请求报文的内容执行相应的测试操作,并将执行结果返回给所述脚本执行模块,其中,所述请求报文用于对当前测试的北向接口对应的通讯接口进行测试。The command execution module is configured to: perform a corresponding test operation according to the content of the request message, and return an execution result to the script execution module, where the request message is used for a northbound interface of the current test. The corresponding communication interface is tested.
  2. 根据权利要求1述的北向接口测试装置,其中,The northbound interface test apparatus according to claim 1, wherein
    所述脚本执行模块当前执行的脚本用例中包括测试通知的任务,The script execution case currently executed by the script execution module includes a task of testing notifications.
    所述装置还包括:通知接收模块;The device further includes: a notification receiving module;
    所述脚本执行模块,还设置为:在执行所述脚本用例之后,向所述通知接收模块发送第一订阅命令;The script execution module is further configured to: after executing the script use case, send a first subscription command to the notification receiving module;
    所述通知接收模块,设置为:获取所述第一订阅命令指示的测试通知,并将所述获取的测试通知返回给所述脚本执行模块;The notification receiving module is configured to: obtain a test notification indicated by the first subscription command, and return the obtained test notification to the script execution module;
    所述脚本执行模块,还设置为:向所述通知接收模块发送取消订阅命令。The script execution module is further configured to: send an unsubscribe command to the notification receiving module.
  3. 根据权利要求1所述的北向接口测试装置,所述装置还包括:初始化模块和脚本加载模块;The northbound interface testing device according to claim 1, further comprising: an initialization module and a script loading module;
    所述初始化模块,设置为:在所述脚本执行模块执行预先开发的脚本中的脚本用例之前,初始化脚本加载模块加载所述预先开发的脚本,初始化所述命令执行模块的参数和所述通知接收模块的参数,其中,所述脚本执行模块执行的脚本用例为根据所述脚本加载模块加载所述脚本中的每个脚本用例所获取的,所述脚本包括所述脚本用例和脚本方法,所述脚本方法为所述脚本用例的执行方法;The initialization module is configured to: before the script execution module executes the script use case in the pre-developed script, the initialization script loading module loads the pre-developed script, initializes parameters of the command execution module, and receives the notification a parameter of the module, wherein the script use case executed by the script execution module is obtained according to the script load module loading each script use case in the script, the script including the script use case and a script method, The script method is an execution method of the script use case;
    所述通知接收模块,还设置为:在初始化后持续接收服务器发送的通知。The notification receiving module is further configured to: continuously receive a notification sent by the server after initialization.
  4. 根据权利要求3所述的北向接口测试装置,其中,The northbound interface test apparatus according to claim 3, wherein
    所述当前测试的北向接口为公共对象请求代理体系结构CORBA接口, The northbound interface of the current test is a public object requesting proxy architecture CORBA interface,
    所述初始化模块通过以下方式初始化命令执行模块的参数:初始化对象请求代理ORB;The initialization module initializes parameters of the command execution module by: initializing an object requesting agent ORB;
    所述初始化模块通过以下方式初始化所述通知接收模块的参数:通过对象管理组织OMG标准,指示所述通知接收模块调用接收所述服务器发送的通知;The initialization module initializes parameters of the notification receiving module by: instructing, by the object management organization, an OMG standard, that the notification receiving module invokes receiving a notification sent by the server;
    所述初始化模块,还设置为:在所述脚本执行模块执行所述脚本用例之前,向所述脚本执行模块发送登陆命令,其中,所述登陆命令中包括登陆的脚本方法;The initialization module is further configured to: before the script execution module executes the script use case, send a login command to the script execution module, where the login command includes a login script method;
    所述脚本执行模块,还设置为:根据所述登陆命令执行所述登陆的脚本方法,根据所述登陆的脚本方法调用相应的登陆请求报文,并向所述命令执行模块发送包括所述登陆请求报文的执行登陆命令;The script execution module is further configured to: execute the login script method according to the login command, invoke a corresponding login request message according to the login script method, and send the login command to the command execution module. Request execution message of the message;
    所述命令执行模块,还设置为:根据所述接收到的登陆请求报文执行CORBA的动态调用,并将执行结果返回给所述脚本执行模块。The command execution module is further configured to: perform a dynamic call of CORBA according to the received login request message, and return an execution result to the script execution module.
  5. 根据权利要求3所述的北向接口测试装置,其中,The northbound interface test apparatus according to claim 3, wherein
    所述当前测试的北向接口为多重技术操作系统MTOSI接口或者软件定义网络SDN的北向,The northbound interface of the current test is a northbound direction of a multi-technology operating system MTOSI interface or a software-defined network SDN.
    所述初始化模块通过以下方式初始化命令执行模块的参数:初始化用于构造超文本传输协议HTTP请求报文的统一资源定位符URL;The initialization module initializes parameters of the command execution module by: initializing a uniform resource locator URL for constructing a hypertext transfer protocol HTTP request message;
    所述初始化模块通过以下方式初始化所述通知接收模块的参数:订阅MTOSI通知;The initialization module initializes parameters of the notification receiving module by: subscribing to an MTOSI notification;
    所述通知接收模块,还设置为:在所述初始化模块初始化所述通知接收模块的参数之后,向所述脚本执行模块发送第二订阅命令,其中,所述第二订阅命令中包括订阅的脚本方法;The notification receiving module is further configured to: after the initialization module initializes the parameter of the notification receiving module, send a second subscription command to the script execution module, where the second subscription command includes a subscribed script method;
    所述脚本执行模块,还设置为:根据所述第二订阅命令执行所述订阅的脚本方法,根据所述订阅的脚本方法调用相应的订阅请求报文,并向所述命令执行模块发送包括所述订阅请求报文的执行订阅命令;The script execution module is further configured to: execute the subscribed script method according to the second subscription command, invoke a corresponding subscription request message according to the subscribed script method, and send the include to the command execution module Executing a subscription request message for the subscription request message;
    所述命令执行模块,还设置为:根据所述订阅请求报文执行HTTP请求调用,并将执行结果返回给所述脚本执行模块。 The command execution module is further configured to: execute an HTTP request call according to the subscription request message, and return an execution result to the script execution module.
  6. 根据权利要求1至5中任一项所述的北向接口测试装置,所述装置还包括结果生成模块;所述脚本执行模块,还设置为:在所述命令执行模块将所述执行结果返回给所述脚本执行模块之后,将所述执行结果传输给所述结果生成模块;The northbound interface test apparatus according to any one of claims 1 to 5, further comprising a result generation module; the script execution module further configured to: return the execution result to the command execution module to After the script executes the module, transmitting the execution result to the result generation module;
    所述结果生成模块,设置为:输出所述执行结果,其中,所述执行结果包括已测试的所有北向接口,以及每个所述北向接口的测试次数和测试时间。The result generating module is configured to: output the execution result, wherein the execution result includes all northbound interfaces that have been tested, and the number of tests and the test time of each of the northbound interfaces.
  7. 根据权利要求1至5中任一项所述的北向接口测试装置,其中,所述脚本执行模块通过以下方式执行所述脚本用例:按照所述脚本中每个脚本用例的顺序依次执行;和/或,The northbound interface test apparatus according to any one of claims 1 to 5, wherein the script execution module executes the script use case in the following manner: in order of each script use case in the script; and or,
    所述装置还包括记录模块;所述脚本执行模块,还设置为:在执行所述脚本用例的过程中,将所述脚本用例的执行信息和异常信息发送给所述记录模块;所述记录模块,设置为:记录并展示所述脚本用例的执行信息和异常信息。The device further includes a recording module, and the script execution module is further configured to: send the execution information and the abnormality information of the script use case to the recording module during execution of the script use case; the recording module Set to: record and display execution information and exception information of the script use case.
  8. 一种北向接口的测试方法,包括:A test method for a northbound interface, including:
    脚本执行模块执行预先开发的脚本中的脚本用例,根据所述脚本用例调用相应的请求报文,并向命令执行模块发送包括所述请求报文的执行命令;The script execution module executes a script use case in a pre-developed script, invokes a corresponding request message according to the script use case, and sends an execution command including the request message to the command execution module;
    所述命令执行模块根据所述请求报文的内容执行相应的测试操作,并将执行结果返回给所述脚本执行模块,所述请求报文用于对当前测试的北向接口对应的通讯接口的进行测试。The command execution module performs a corresponding test operation according to the content of the request message, and returns an execution result to the script execution module, where the request message is used to perform a communication interface corresponding to the currently tested northbound interface. test.
  9. 根据权利要求8所述的北向接口的测试方法,其中,The method of testing a northbound interface according to claim 8, wherein
    所述脚本执行模块当前执行的脚本用例中包括测试通知的任务,The script execution case currently executed by the script execution module includes a task of testing notifications.
    所述脚本执行所述脚本用例之后,所述测试方法还包括:After the script executes the script use case, the test method further includes:
    所述脚本执行模块向通知接收模块发送第一订阅命令;The script execution module sends a first subscription command to the notification receiving module;
    所述通知接收模块获取所述第一订阅命令指示的测试通知,并将所述获取的测试通知返回给所述脚本执行模块;The notification receiving module acquires the test notification indicated by the first subscription command, and returns the obtained test notification to the script execution module;
    所述脚本执行模块向所述通知接收模块发送取消订阅命令。 The script execution module sends an unsubscribe command to the notification receiving module.
  10. 根据权利要求8所述的北向接口的测试方法,The method for testing a northbound interface according to claim 8,
    所述脚本执行模块执行预先开发的脚本中的脚本用例之前,所述测试方法还包括:Before the script execution module executes the script use case in the pre-developed script, the test method further includes:
    初始化模块初始化脚本加载模块加载所述预先开发的脚本,初始化所述命令执行模块的参数和所述通知接收模块的参数,其中,所述脚本执行模块执行的脚本用例为根据所述脚本加载模块加载所述脚本中的每个脚本用例所获取的,所述脚本包括所述脚本用例和脚本方法,所述脚本方法为所述脚本用例的执行方法;The initialization module initialization script loading module loads the pre-developed script, initializes the parameters of the command execution module and the parameters of the notification receiving module, wherein the script use case executed by the script execution module is loaded according to the script loading module Obtained by each script use case in the script, the script includes the script use case and a script method, and the script method is an execution method of the script use case;
    所述初始化模块初始化所述通知接收模块的参数之后,所述测试方法还包括:After the initialization module initializes the parameters of the notification receiving module, the testing method further includes:
    所述通知接收模块在初始化后持续接收服务器发送的通知。The notification receiving module continuously receives the notification sent by the server after initialization.
  11. 根据权利要求10所述的北向接口的测试方法,其中,The method for testing a northbound interface according to claim 10, wherein
    所述当前测试的北向接口为公共对象请求代理体系结构CORBA接口,所述初始化命令执行模块的参数,包括:初始化对象请求代理ORB;The northbound interface of the current test is a public object requesting proxy architecture CORBA interface, and the parameters of the initialization command execution module include: an initialization object requesting agent ORB;
    所述初始化所述通知接收模块的参数,包括:通过对象管理组织OMG标准,指示所述通知接收模块调用接收所述服务器发送的通知;The initializing the parameter of the notification receiving module includes: instructing, by the object management organization, an OMG standard, that the notification receiving module invokes receiving a notification sent by the server;
    所述脚本执行模块执行预先开发的脚本中的脚本用例之前,所述测试方法还包括:Before the script execution module executes the script use case in the pre-developed script, the test method further includes:
    所述初始化模块向所述脚本执行模块发送登陆命令,所述登陆命令中包括登陆的脚本方法;The initialization module sends a login command to the script execution module, where the login command includes a login script method;
    所述脚本执行模块根据所述登陆命令执行所述登陆的脚本方法,根据所述登陆的脚本方法调用相应的登陆请求报文,并向所述命令执行模块发送包括所述登陆请求报文的执行登陆命令;The script execution module executes the login script method according to the login command, invokes a corresponding login request message according to the login script method, and sends an execution including the login request message to the command execution module. Login command
    所述命令执行模块根据所述接收到的登陆请求报文执行CORBA的动态调用,并将执行结果返回给所述脚本执行模块。The command execution module performs a dynamic call of CORBA according to the received login request message, and returns an execution result to the script execution module.
  12. 根据权利要求10所述的北向接口的测试方法,其中,The method for testing a northbound interface according to claim 10, wherein
    所述当前测试的北向接口为多重技术操作系统MTOSI接口或者软件定 义网络SDN的北向,所述初始化所述命令执行模块的参数,包括:初始化用于构造超文本传输协议HTTP请求报文的统一资源定位符URL;The northbound interface of the current test is a multi-technology operating system MTOSI interface or software In the north direction of the network SDN, the initializing the parameters of the command execution module includes: initializing a uniform resource locator URL for constructing a hypertext transfer protocol HTTP request message;
    所述初始化所述通知接收模块的参数,包括:订阅MTOSI通知;The initializing the parameters of the notification receiving module includes: subscribing to an MTOSI notification;
    所述初始化模块初始化所述通知接收模块的参数之后,所述测试方法还包括:After the initialization module initializes the parameters of the notification receiving module, the testing method further includes:
    所述通知接收模块向所述脚本执行模块发送第二订阅命令,所述第二订阅命令中包括订阅的脚本方法;The notification receiving module sends a second subscription command to the script execution module, where the second subscription command includes a subscribed script method;
    所述脚本执行模块根据所述第二订阅命令执行所述订阅的脚本方法,根据所述订阅的脚本方法调用相应的订阅请求报文,并向所述命令执行模块发送包括所述订阅请求报文的执行订阅命令;The script execution module executes the subscribed script method according to the second subscription command, invokes a corresponding subscription request message according to the subscribed script method, and sends the subscription request message to the command execution module. Execute the subscription command;
    所述命令执行模块根据所述订阅请求报文执行HTTP请求调用,并将执行结果返回给所述脚本执行模块。The command execution module executes an HTTP request call according to the subscription request message, and returns an execution result to the script execution module.
  13. 根据权利要求8至12中任一项所述的北向接口的测试方法,所述命令执行模块将执行结果返回给所述脚本执行模块之后,所述测试方法还包括:The test method of the northbound interface according to any one of claims 8 to 12, after the command execution module returns an execution result to the script execution module, the test method further includes:
    所述脚本执行模块将所述执行结果传输给结果生成模块;The script execution module transmits the execution result to the result generation module;
    所述结果生成模块输出所述执行结果,所述执行结果包括已测试的所有北向接口,以及每个所述北向接口的测试次数和测试时间。The result generation module outputs the execution result, the execution result including all northbound interfaces that have been tested, and the number of tests and the test time of each of the northbound interfaces.
  14. 根据权利要求8至12中任一项所述的北向接口的测试方法,其中,所述脚本执行模块执行所述脚本用例,包括:所述脚本执行模块按照所述脚本中每个脚本用例的顺序依次执行;和/或,The test method of the northbound interface according to any one of claims 8 to 12, wherein the script execution module executes the script use case, comprising: the script execution module follows the order of each script use case in the script Execute sequentially; and/or,
    所述脚本执行模块执行所述脚本用例的过程中,所述测试方法还包括:In the process of executing the script use case by the script execution module, the test method further includes:
    所述脚本执行模块将所述脚本用例的执行信息和异常信息发送给记录模块;The script execution module sends the execution information and the abnormality information of the script use case to the recording module;
    所述记录模块记录并展示所述脚本用例的执行信息和异常信息。 The recording module records and displays execution information and exception information of the script use case.
PCT/CN2016/080394 2015-07-27 2016-04-27 Northbound interface test apparatus and test method for northbound interface WO2016180237A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510447745.7A CN106407061B (en) 2015-07-27 2015-07-27 Northbound interface testing device and northbound interface testing method
CN201510447745.7 2015-07-27

Publications (1)

Publication Number Publication Date
WO2016180237A1 true WO2016180237A1 (en) 2016-11-17

Family

ID=57248748

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/080394 WO2016180237A1 (en) 2015-07-27 2016-04-27 Northbound interface test apparatus and test method for northbound interface

Country Status (2)

Country Link
CN (1) CN106407061B (en)
WO (1) WO2016180237A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110232016A (en) * 2019-03-08 2019-09-13 上海蔚来汽车有限公司 Interface testing case generation method, device and controller and medium
CN110647458A (en) * 2018-06-27 2020-01-03 优视科技有限公司 Testing method and device based on distributed testing platform and electronic equipment
CN110941563A (en) * 2019-12-31 2020-03-31 中国银行股份有限公司 Automatic script testing method and device
CN113162823A (en) * 2021-04-06 2021-07-23 广州鲁邦通物联网科技有限公司 APP test simulation system and Internet of things simulation test method

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107846323B (en) * 2017-10-25 2020-03-06 国网山东省电力公司信息通信公司 Method and system for monitoring running state of north interface of manufacturer professional network management

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070104111A1 (en) * 2005-11-04 2007-05-10 Intel Corporation Internal analog loopback for a high-speed interface test
CN103353857A (en) * 2013-05-31 2013-10-16 国家电网公司 Communication test method of integrated monitoring unit in substation

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5819093A (en) * 1995-03-03 1998-10-06 Sun Microsystems, Inc. System and method for a distributed debugger for debugging distributed application programs
US7174555B2 (en) * 2002-07-08 2007-02-06 Sbc Properties, L.P. Methods and systems for verifying EMS compliance via NMS interface
CN100387004C (en) * 2005-11-16 2008-05-07 华为技术有限公司 Protocol testing apparatus and method thereof
CN101212357B (en) * 2006-12-31 2010-09-15 亿阳信通股份有限公司 Interface testing method and device
CN101266570B (en) * 2007-03-15 2011-05-11 中兴通讯股份有限公司 Software system test method and apparatus
CN101996132A (en) * 2009-08-14 2011-03-30 中兴通讯股份有限公司 Method and device for automatically testing common object request broker architecture (CORBA) interfaces
CN102546260A (en) * 2012-02-06 2012-07-04 烽火通信科技股份有限公司 Simulator based on SNMP (Simple Network Management Protocol) network management

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070104111A1 (en) * 2005-11-04 2007-05-10 Intel Corporation Internal analog loopback for a high-speed interface test
CN103353857A (en) * 2013-05-31 2013-10-16 国家电网公司 Communication test method of integrated monitoring unit in substation

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110647458A (en) * 2018-06-27 2020-01-03 优视科技有限公司 Testing method and device based on distributed testing platform and electronic equipment
CN110232016A (en) * 2019-03-08 2019-09-13 上海蔚来汽车有限公司 Interface testing case generation method, device and controller and medium
CN110941563A (en) * 2019-12-31 2020-03-31 中国银行股份有限公司 Automatic script testing method and device
CN110941563B (en) * 2019-12-31 2024-04-16 中国银行股份有限公司 Automatic script testing method and device
CN113162823A (en) * 2021-04-06 2021-07-23 广州鲁邦通物联网科技有限公司 APP test simulation system and Internet of things simulation test method

Also Published As

Publication number Publication date
CN106407061B (en) 2020-06-16
CN106407061A (en) 2017-02-15

Similar Documents

Publication Publication Date Title
WO2016180237A1 (en) Northbound interface test apparatus and test method for northbound interface
JP5677455B2 (en) Cloud computing monitoring and management system
Aksakalli et al. Deployment and communication patterns in microservice architectures: A systematic literature review
US9697104B2 (en) End-to end tracing and logging
WO2016184175A1 (en) Database processing method and apparatus
CN107241315B (en) Access method and device of bank gateway interface and computer readable storage medium
Brandón et al. Fmone: A flexible monitoring solution at the edge
Chazalet Service level checking in the cloud computing context
CN112783672B (en) Remote procedure call processing method and system
del Castillo et al. Openstack federation in experimentation multi-cloud testbeds
US20230401058A1 (en) Semantic functional wrappers of services
CN114745295A (en) Data acquisition method, device, equipment and readable storage medium
Indrasiri et al. Design Patterns for Cloud Native Applications
Al-Kasassbeh et al. Analysis of mobile agents in network fault management
US10402307B2 (en) System and method for providing runtime tracing for a web-based client accessing a transactional middleware platform using an extension interface
CN114567571B (en) Performance test method, device, electronic equipment and computer readable storage medium
Maule et al. Performance and QoS in service-based systems
CN107305524A (en) Method for testing pressure and system
CN113360386A (en) Switching chip drive test method, device, electronic equipment and storage medium
CN113127096A (en) Task processing method and device, electronic equipment and storage medium
CN112685252A (en) Micro-service monitoring method, device, equipment and storage medium
US10536508B2 (en) Flexible data communication
Arora Cloud Native Network Slice Orchestration in 5G and Beyond
CN115756771B (en) Micro-servitization front-end system, workflow scheduling method and device
US20160308991A1 (en) Analytics system architecture

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16792087

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16792087

Country of ref document: EP

Kind code of ref document: A1