Middleware adaptation test method and device, electronic equipment and medium
By creating request object libraries and response object libraries, and combining them with Python multithreading, the middleware and gateway adaptation tests are completed automatically, solving the problem of time-consuming and labor-intensive middleware adaptation to gateway tests, and achieving efficient automated testing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2023-01-17
- Publication Date
- 2026-06-09
AI Technical Summary
Testing the middleware to adapt to the gateway is time-consuming and labor-intensive, especially when there are many types of gateways, complex functions, and diverse device forms, the workload of manually reviewing test reports is enormous.
By creating request object libraries and response object libraries, middleware adaptation tests are performed using Python multithreading. Adaptation tests are conducted based on the standard gateway information of the gateway, and the traversal test of the gateway and middleware is completed automatically. The gateway information of the gateway under test is determined by the correspondence between request objects and response objects.
Without human intervention, the system automates the adaptation testing of gateways and middleware, improving testing efficiency and reducing manpower and time costs.
Smart Images

Figure CN116089290B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a middleware adaptation testing method, apparatus, electronic device, and medium. Background Technology
[0002] Middleware is a type of software that provides connectivity between system software and application software, facilitating communication between various software components. It resides above the operating system of the client server and manages computing resources and network communication. To verify the communication capabilities of each gateway and middleware, backward compatibility testing of the middleware with gateways is required.
[0003] Middleware's downward adaptation to gateways is typically designed with considerations such as gateway model, functional modules, and device form factor. The middleware sends a communication request to the gateway and receives a response, which serves as the test report. Current technology requires manual review of these test reports.
[0004] With the development of communication services, the types of gateway models that middleware adapts to are becoming increasingly diverse, their functions increasingly complex, and their device forms increasingly varied. Therefore, to comprehensively test all gateway models, functional modules, and device forms, the above solution requires the manual review of hundreds of test reports, which is a huge workload from the perspectives of cost, manpower, and time. This presents the problem of time-consuming and labor-intensive testing of middleware adapting to gateways. Summary of the Invention
[0005] This application provides a middleware adaptation testing method, apparatus, electronic device, and medium to solve the problem of time-consuming and labor-intensive testing of middleware adapting to gateways.
[0006] On one hand, this application provides a middleware adaptation testing method, comprising: creating a request object library and a response object library based on the response data returned by each gateway under test according to the communication request of the middleware; the request object library includes request objects corresponding to each gateway under test, and the request objects include the identification information of the gateway under test; the response object library includes response objects corresponding to each request object, and the response objects include the gateway information of the gateway under test corresponding to the request object; executing middleware adaptation testing processing for each gateway under test based on Python multithreading to obtain test results; the middleware adaptation testing processing includes: obtaining standard gateway information corresponding to each request object based on the standard gateway information of each gateway; and performing adaptation testing based on the response object and standard gateway information corresponding to each request object.
[0007] In one possible implementation, the step of creating a request object library and a response object library based on the response data returned by each gateway under test according to the communication request of the middleware includes: for each response data returned by the gateway under test, extracting the identification information of the gateway under test from the response data, and encapsulating the identification information of the gateway under test into a request object corresponding to the gateway under test; extracting the gateway information of the gateway under test from the response data, and encapsulating the gateway information of the gateway under test into a response object corresponding to the request object corresponding to the gateway under test; and creating a request object library and a response object library based on the request objects corresponding to each gateway under test and the response objects corresponding to the request objects.
[0008] In one possible implementation, the identification information of the gateway under test includes the gateway's manufacturer information, model, and supported network communication protocol information. The step of creating a request object library and a response object library based on the request objects and response objects corresponding to each gateway under test includes: dividing the request objects of each gateway under test according to the gateway model to obtain a request object class corresponding to each gateway model; combining the request object classes according to the manufacturer information to obtain a request object library corresponding to each gateway manufacturer; dividing the response objects according to the gateway model to obtain a response object class corresponding to each request object class, wherein the gateway model corresponding to each request object class and the corresponding response object class is the same; and combining the response object classes according to the manufacturer information to obtain a response object library corresponding to each request object library, wherein the manufacturer information corresponding to each request object library and the corresponding response object library is the same.
[0009] In one possible implementation, the middleware adaptation test processing further includes: determining the first response object library corresponding to the first request object library to which the request object belongs based on the manufacturer information in each request object; matching the corresponding first response object class in the first response object library based on the model in the request object; and matching the corresponding response object in the first response object class based on the network communication protocol information in the request object, and using it as the response object corresponding to the request object.
[0010] In one possible implementation, the middleware adaptation test processing of each gateway under test based on Python multithreading to obtain test results includes: assigning each request object library to a Python sub-thread of the Python multithreading, with different request object libraries corresponding to different Python sub-threads, so that the sub-threads execute the middleware adaptation test of the gateway under test corresponding to each request object in the corresponding request object library.
[0011] In one possible implementation, the adaptation test based on the response object and standard gateway information corresponding to each request object includes: extracting response data from the response object and comparing it with the standard gateway information; if they match, the test result is determined to be that the middleware is adapted to the gateway under test; if they do not match, the test result is determined to be that the middleware is not adapted to the gateway under test.
[0012] On the other hand, this application provides a middleware adaptation testing apparatus, comprising: a creation module, configured to create a request object library and a response object library based on the response data returned by each gateway under test according to the communication request of the middleware, wherein the request object library includes request objects corresponding to each gateway under test, the request objects include the identification information of the gateway under test, and the response object library includes response objects corresponding to each request object, the response objects include the gateway information of the gateway under test corresponding to the request object; and a testing module, configured to execute middleware adaptation testing processing of each gateway under test based on Python multithreading, and obtain test results; wherein the middleware adaptation testing processing includes: obtaining standard gateway information corresponding to each request object based on the standard gateway information of each gateway; and performing adaptation testing based on the response object and standard gateway information corresponding to each request object.
[0013] In one possible implementation, the creation module is specifically configured to: extract the identification information of the gateway under test from the response data returned by each gateway under test, and encapsulate the identification information of the gateway under test into a request object corresponding to the gateway under test; extract the gateway information of the gateway under test from the response data, and encapsulate the gateway information of the gateway under test into a response object corresponding to the request object corresponding to the gateway under test; and create a request object library and a response object library based on the request objects corresponding to each gateway under test and the response objects corresponding to the request objects.
[0014] In one possible implementation, the identification information of the gateway under test includes the gateway's manufacturer information, model, and supported network communication protocol information. When the creation module creates a request object library and a response object library based on the request objects and response objects corresponding to each gateway under test, it specifically performs the following steps: dividing the request objects of each gateway under test according to the gateway model to obtain a request object class corresponding to each gateway model; combining the request object classes according to the manufacturer information to obtain a request object library corresponding to each gateway manufacturer; dividing the response objects according to the gateway model to obtain a response object class corresponding to each request object class, wherein the gateway model corresponding to each request object class and the corresponding response object class is the same; and combining the response object classes according to the manufacturer information to obtain a response object library corresponding to each request object library, wherein the manufacturer information corresponding to each request object library and the corresponding response object library is the same.
[0015] In one possible implementation, the testing module is further configured to: determine the first response object library corresponding to the first request object library to which the request object belongs based on the gateway vendor information in each request object; match the corresponding first response object class in the first response object library based on the gateway model in the request object; and match the corresponding response object in the first response object class based on the network communication protocol information supported by the gateway in the request object, and use it as the response object corresponding to the request object.
[0016] In one possible implementation, the test module is specifically used to: assign each request object library to a Python sub-thread of the Python multithreading, with different request object libraries corresponding to different Python sub-threads, so that the sub-threads execute the middleware adaptation test of the gateway under test corresponding to each request object in the corresponding request object library.
[0017] In one possible implementation, the testing module is specifically used to: extract response data from the response object and compare it with the standard gateway information; if they match, the test result is determined to be that the middleware is compatible with the gateway under test; if they do not match, the test result is determined to be that the middleware is not compatible with the gateway under test.
[0018] In another aspect, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method described above.
[0019] In another aspect, this application provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, are used to implement the method described above.
[0020] The middleware adaptation testing method, apparatus, electronic device, and medium provided in this application extract relevant gateway information from the gateway's response to the middleware based on the communication results between the middleware and the gateway. The identification information and gateway information of each gateway under test are encapsulated into request objects and response objects, ensuring that one request object corresponds to one response object. A request object library and a response object library are established based on this. Multithreading is used to obtain the response object corresponding to each request object and the standard gateway information of the gateway under test corresponding to the request object, completing the adaptation test. This solution uniquely identifies the gateway under test for each test using the request object and determines the gateway information of the gateway under test based on the correspondence between the request object and the response object. Combined with the standard gateway information of the gateway under test, it automatically performs traversal testing of the gateway and middleware without manual intervention, solving the problem of time-consuming and labor-intensive middleware downward adaptation testing. Attached Figure Description
[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0022] Figure 1 The diagram above illustrates a flowchart of a middleware adaptation testing method provided in Embodiment 1 of this application.
[0023] Figure 2 The diagram above exemplifies the structure of a request object library and a response object library provided in Embodiment 1 of this application.
[0024] Figure 3 The diagram above exemplarily illustrates another structural diagram of a request object library and a response object library provided in Embodiment 1 of this application;
[0025] Figure 4 The diagram above illustrates a process for obtaining a response object corresponding to a request object, as provided in Embodiment 1 of this application.
[0026] Figure 5 The diagram above exemplarily illustrates a structural schematic of a middleware adaptation testing device provided in Embodiment 2 of this application;
[0027] Figure 6 The diagram above illustrates a structural schematic of a middleware adaptation test electronic device provided in Embodiment 3 of this application.
[0028] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0029] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0030] In this application, a module refers to a functional module or a logical module. It can be in software form, where its function is implemented by a processor executing program code; or it can be in hardware form. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "OR" relationship.
[0031] First, let me explain the terms used in this application:
[0032] Ethernet Passive Optical Network (EPON) refers to passive optical fiber network (PON) technology based on Ethernet. It employs a point-to-multipoint structure and passive optical fiber transmission, providing various services over Ethernet. It utilizes PON technology at the physical layer and Ethernet protocol at the link layer, leveraging the PON topology to achieve Ethernet access, thus combining the advantages of both PON and Ethernet technologies.
[0033] Gigabit-Capable Passive Optical Network (GPON) refers to a new generation of broadband passive optical integrated access standard based on the ITU-T G.984.x standard. It boasts numerous advantages such as high bandwidth, high efficiency, wide coverage, and rich user interfaces. GPON and EPON are two typical passive optical networks, both using short-distance optical cables and primarily for network transmission within urban areas. Their biggest difference lies in their download and uplink communication protocols. GPON supports multiple speeds, including asymmetric uplink and downlink rates, and offers greater bandwidth than EPON.
[0034] Middleware is a type of software that provides connectivity between system software and application software, facilitating communication between various software components. It resides above the operating system of the client / server and manages computing resources and network communication. Taking a gateway C operating system middleware as an example, this middleware is developed based on OpenWRT and runs on the gateway's Linux kernel. It can access gateway functions through the DBus interface. To verify the communication capabilities between various gateways and the C system middleware, the downward adaptation testing of the middleware to gateways is mostly designed and executed based on gateway model, functional modules, and device form factors.
[0035] With the development of communication services, the types of gateway models adapted to the C system middleware are becoming increasingly numerous, their functions more complex, and their device forms more diverse. Therefore, to comprehensively test all gateways, in terms of hardware, there are at least 30 or more gateway models, each supporting at least 4 functions. Furthermore, the hardware is divided into 4 major categories, requiring at least 30 * 4 * 4 = 480 tests for compatibility. After testing, 480 test reports need to be manually reviewed. From the perspectives of cost, manpower, and time, this is a huge workload.
[0036] This application proposes a middleware adaptation testing method that considers both business and cost dimensions, eliminating the need for manual intervention and solving the problem of time-consuming and labor-intensive middleware adaptation to gateway testing in the above scenarios.
[0037] The technical solutions of this application are illustrated below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0038] Example 1
[0039] Figure 1 This is a flowchart illustrating a middleware adaptation testing method provided in one embodiment of this application. Figure 1 As shown, the middleware adaptation testing method provided in this embodiment may include:
[0040] S101, Based on the response data returned by each gateway under test according to the communication request of the middleware, a request object library and a response object library are created. The request object library includes the request object corresponding to each gateway under test. The request object includes the identification information of the gateway under test. The response object library includes the response object corresponding to each request object. The response object includes the gateway information of the gateway under test corresponding to the request object.
[0041] S102, based on Python multithreading, execute the middleware adaptation test processing for each gateway under test and obtain the test results; the middleware adaptation test processing includes: obtaining the standard gateway information corresponding to each request object according to the standard gateway information of each gateway; and performing adaptation testing according to the response object corresponding to each request object and the standard gateway information.
[0042] In practical applications, the execution entity of this embodiment can be a middleware adaptation testing device, which can be implemented by a computer program, such as application software; or it can be implemented as a medium storing relevant computer programs, such as a USB flash drive or cloud drive; or it can be implemented by a physical device that integrates or installs relevant computer programs, such as a chip or server.
[0043] Specifically, the middleware adaptation testing device obtains the response data returned by each gateway under test to the middleware, and creates request objects and response objects based on the response data; wherein the request object includes the identification information of the gateway under test, which is used to uniquely identify the gateway under test; the response object includes the gateway information of the gateway under test, which represents the gateway-related information obtained by the middleware in communication with the gateway; the set of request objects is used as a request object library, and there is a one-to-one correspondence between the request objects and the request objects; the set of response objects is used as a response object library.
[0044] Then, using multi-threading, adaptation tests are performed based on each response object and its corresponding standard gateway information. The request object is used to uniquely identify the gateway to be tested each time the adaptation test is performed. Based on the correspondence between the request object and the response object, the response object corresponding to the request object is obtained. Based on the gateway to be tested corresponding to the request object, the standard gateway information corresponding to that gateway is obtained, thus obtaining the standard gateway information corresponding to each response object and realizing the adaptation test processing.
[0045] The following is an illustrative example of this solution: Currently, we want to perform compatibility testing between a certain middleware and several gateways. Corresponding test plugins can be compiled for different gateways. These plugins execute communication between the middleware and the gateways, generating test reports. These reports include the gateway's response after receiving a communication request from the middleware. Based on the test reports, the identification and gateway information of each gateway under test are identified. The identification information of each gateway under test is encapsulated into a request object, with one request object corresponding to one gateway under test. The gateway information corresponding to each request object is encapsulated into a response object, thus achieving a correspondence between one request object and one response object. The collection of request objects is called the request library, and the collection of response objects is called the response library. Multi-threaded execution is used to perform compatibility tests between each gateway under test and the middleware. Standard gateway information and a response object corresponding to each request object are obtained. The response data in the response object is extracted and compared with the standard gateway information to complete the middleware and gateway compatibility test.
[0046] In practical applications, there are various computer programming languages that can be used to perform middleware adaptation testing. In the example above, Python can be used to perform middleware adaptation testing on each gateway under test using multiple threads to obtain test results. Alternatively, programming languages such as Java and C++ can be used. There are no restrictions on these languages.
[0047] There are several ways to create request object libraries and response object libraries. In one example, S101 may include:
[0048] For each response data returned by the gateway under test, the identification information of the gateway under test is extracted from the response data, and the identification information of the gateway under test is encapsulated into a request object corresponding to the gateway under test.
[0049] Extract the gateway information of the gateway under test from the response data, and encapsulate the gateway information of the gateway under test into a response object corresponding to the request object of the gateway under test;
[0050] Based on the request object corresponding to each gateway under test and the response object corresponding to the request object, create a request object library and a response object library.
[0051] Specifically, based on the response data returned by each gateway under test obtained by the middleware adaptation testing device, the identification information and gateway information of each gateway under test are extracted. The identification information and gateway information of each gateway under test are encapsulated into a request object and a response object, respectively. The gateway under test corresponding to the request object and the response object are the same, so one request object corresponds to one response object. The collection of request objects is used as a request object library, and the collection of response objects is used as a response object library.
[0052] The following is an example of how this solution works: Figure 2 This application provides a schematic diagram of the structure of a request object library and a response object library according to an embodiment of the present application, as shown below. Figure 2 As shown, assuming there are two gateways to be tested, namely gateway 1 and gateway 2, based on the response data between the gateway and the middleware, the identification information and gateway information of gateway 1 are encapsulated into request1 and response1, and the identification information and gateway information of gateway 2 are encapsulated into request2 and response2. The set of request1 and request2 is used as the request library, and the set of response1 and response2 is used as the response library.
[0053] In practical applications, the identification information and gateway information of the gateway under test can be of various types, and can be selected according to the actual production needs. This is not limited here. In one example, the identification information of the gateway under test includes the gateway's manufacturer information, model, and supported network communication protocol information. The step of creating a request object library and a response object library based on the request object corresponding to each gateway under test and the response object corresponding to the request object includes:
[0054] According to the gateway model, the request objects of each gateway under test are divided to obtain a request object class corresponding to each gateway model; according to the manufacturer information, the request object classes are combined to obtain a request object library corresponding to each gateway manufacturer; according to the gateway model, the response objects are divided to obtain a response object class corresponding to each request object class, wherein the gateway model corresponding to the request object class and the corresponding response object class is the same; according to the manufacturer information, the response object classes are combined to obtain a response object library corresponding to each request object library, wherein the manufacturer information corresponding to the request object library and the corresponding response object library is the same.
[0055] Specifically, the identification information of the gateway under test may include the gateway manufacturer information, model and supported network communication protocol information (such as EPON and GPON). After the encapsulation of the request object and response object is completed as described above, the request objects with the same gateway model are divided into a set as a request object class, and the request object classes with the same gateway manufacturer are divided into a set as a request object library. The processing of the response object is similar and will not be repeated here.
[0056] The following will provide examples using specific scenarios: Figure 3 This is a schematic diagram illustrating the structure of another request object library and response object library provided in an embodiment of this application, as shown below. Figure 3 As shown, assume there are two manufacturers of the gateway under test, A and B. Manufacturer A has two models, A1 and A2, each supporting either EPON or GPON. Manufacturer B has two models, B1 and B2, each supporting either EPON or GPON. Assuming the gateway under test is manufacturer A, model A1, and supports EPON, the identification information of the gateway is encapsulated as a request object a1e, the gateway information as a response object A1E, and so on, encapsulating request objects a1e, a1p, a2e, a2p and response objects A1E, A1P, A2E, A2P. The set of request objects a1e and a1p is called request class a1, the set of a2e and a2p is called request class a2, and the set of request classes a1 and a2 is called request library a. The remaining processing is similar and will not be elaborated further.
[0057] To improve testing efficiency, multi-threading can be used to execute middleware adaptation testing. In one example, based on Python multi-threading, the middleware adaptation testing of each gateway under test is executed to obtain test results, which may specifically include:
[0058] Each request object library is assigned to a Python sub-thread within the Python multithreading, with different request object libraries corresponding to different Python sub-threads, so that the sub-threads can execute middleware adaptation tests for the gateway under test corresponding to each request object in the respective request object library.
[0059] For example, if there are two vendors, A and B, for the gateway under test as described above, then request libraries a and b can be obtained by following the above process. For request libraries a and b, a sub-thread is allocated to implement middleware adaptation testing for the gateway under test corresponding to all request objects in request libraries a and b, respectively.
[0060] In practical applications, using multithreading to execute tests can improve efficiency. Sub-threads can share memory and it is easy to add new sub-threads. Other computer technologies can also be used to implement the testing process, and there are no restrictions on them here.
[0061] Furthermore, Figure 4 This application provides a schematic diagram of a process for obtaining a response object corresponding to a request object, as shown in one embodiment. Figure 4 As shown, in one example, the middleware adaptation test process may further include:
[0062] S401, Based on the vendor information in each request object, determine the first response object library corresponding to the first request object library to which the request object belongs;
[0063] S402, based on the model number in the request object, the corresponding first response object class is obtained by matching in the first response object library;
[0064] S403, based on the network communication protocol information in the request object, a corresponding response object is matched in the first response object class and used as the response object corresponding to the request object.
[0065] Specifically, to obtain the response object corresponding to each request object, for a given request object, the system matches the request object library corresponding to that request object to determine the manufacturer of the gateway under test; matches the corresponding request object class within the request object library to determine the model of the gateway under test; and matches the request object under the corresponding request object class to determine the network communication protocol of the gateway under test. Based on the correspondence between request objects and response objects, and according to the manufacturer of the gateway under test, the system matches the response object library corresponding to the response object; according to the model of the gateway under test, the system matches the corresponding response object class within the response object library; and according to the network communication protocol of the gateway under test, the system matches the response object under the corresponding response object class, thereby uniquely identifying the gateway under test and its gateway information.
[0066] Assuming the gateway under test is vendor A, model A1, and supports the EPON network communication protocol, as shown in the example above, the gateway's identification information is encapsulated as a request object a1e, and the gateway information is encapsulated as a response object A1E. In the sub-thread corresponding to request library a, after obtaining the request object a1e for a particular test, we can determine that the request library is a, i.e., the vendor of the gateway under test is A. Matching request class a1 in request library a confirms the gateway's model is A1. Matching request object a1e in request class a1 confirms that the gateway supports the EPON network communication protocol. Based on the correspondence between request and response objects, we can determine that the response library is A. Matching response class A1 in response library A, and then matching response object A1E in response class A1, we obtain the corresponding response object and perform middleware adaptation testing.
[0067] There are various ways to conduct adaptation testing. In one example, the adaptation testing based on the response object and standard gateway information corresponding to each request object includes:
[0068] Extract the response data from the response object and compare it with the standard gateway information;
[0069] If they match, the test result indicates that the middleware is compatible with the gateway under test.
[0070] If there is a discrepancy, the test result is determined to be that the middleware is incompatible with the gateway under test.
[0071] Specifically, the response data in the response object, i.e. the gateway information obtained from the communication between the middleware and the gateway, is compared with the standard gateway information of the gateway. If they match, it indicates that the middleware and gateway are compatible; otherwise, they are not compatible.
[0072] The following will provide examples using specific scenarios:
[0073] Based on the current testing solutions for home gateway middleware, the business testing scenarios are divided as follows:
[0074] 1) Different gateway manufacturers and models: Currently, there are 5 major gateway manufacturers, with more than 30 specific models. Each model of gateway can be divided into those supporting EPON and those supporting GPON. Examples of gateway manufacturers and models are as follows:
[0075] Manufacturer A: A1, A2, A3, A4, A5, A6;
[0076] Manufacturer B: B1, B2, B3, B4, B5, B6, B7, B8;
[0077] Manufacturer C: C1, C2, C3, C4, C5, C6, C7, C8;
[0078] Manufacturer D: D1, D2, D3, D4, D5, D6;
[0079] Manufacturer E: E1, E2.
[0080] 2) Different functional modules: Currently, the main functional modules include USB, firewall, WIFI, and voice, which can be further divided into:
[0081] USB: No USB port, 1 USB port, 2 USB ports;
[0082] Firewall: Firewall supported; Firewall not supported.
[0083] WIFI: WIFI4, WIFI5, WIFI6;
[0084] Voice: Voice is supported, voice is not supported.
[0085] 3) Device Form: Currently, gateways are mainly divided into frequency-enabled gateways and frequency-free gateways, home gateways and FTTR gateways, which can be further divided into:
[0086] Frequency-dependent gateways: single-frequency gateways, dual-frequency gateways;
[0087] Frequencyless gateway: Frequencyless gateway;
[0088] Home gateway: A single master gateway with no slave gateways;
[0089] FTTR gateways: one master and one slave, one master and two slaves, one master and four slaves.
[0090] The middleware adaptation testing device obtains the response information returned by the gateway to the middleware. The response information includes relevant data information of the gateway, including the gateway's identification information such as manufacturer, model, and network communication protocol, and the gateway information such as USB, firewall, WIFI, voice, frequency-enabled gateway or frequency-free gateway, home gateway or FTTR gateway.
[0091] The middleware and gateway communication relies on the DBus interface. To simulate communication between the middleware and the gateway, the identification information and gateway information of each gateway are encapsulated into request objects and response objects. Therefore, one request object corresponds to one response object. Request and response libraries are created. The request object can simulate the middleware's DBus request to communicate with the gateway. The response object is set as a mock object, and the response library is set as a mock object library. The response object can simulate the gateway's response after receiving a request. The request library is a collection of request classes, and each request class is a collection of request objects. A request class corresponds to the same model of the gateway under test, and a request library corresponds to the same manufacturer of the gateway under test. Based on the above scenario, the processing flow is as described above, resulting in request libraries a, b, c, d, e and response libraries A, B, C, D, E. Response library A contains response classes A1, A2, A3, A4, A5, A6; response library B contains response classes B1, B2, B3, B4, B5, B6, B7, B8; response library C contains response classes C1, C2, C3, C4, C5, C6, C7, C8; response library D contains response classes D1, D2, D3, D4, D5, D6; and response library E1, E2. The request libraries follow the same logic.
[0092] To simulate communication, the Python dbusmock library should be used for testing. For a request library, start a Python sub-thread, import the dbusmock library, and its data interface can simulate the DBus interface. Test request data and corresponding test response data are pre-set in the dbusmock data interface. Therefore, inputting test request data into the dbusmock data interface will output the standard gateway information corresponding to the gateway under test, which will be used as test response data. Thus, the request library and dbusmock data interface can be used not only for middleware adaptation testing in this solution, but also directly for individual testing of middleware or gateways, or in other testing scenarios.
[0093] In a sub-thread, after obtaining a request object, the corresponding response object is matched, and the response data is extracted from the response object. This response data is then used as test request data and input into the dbusmock data interface to obtain the corresponding test response data. The response data and test response data are then compared. For example, if the current response data indicates that the gateway under test has 1 USB port, and the test response data indicates that the gateway under test has 0 USB ports, and they are inconsistent, then the gateway is determined to be incompatible with the middleware, and a "fail" message is sent to the middleware. If the test response data indicates that the gateway under test has 1 USB port, and they are consistent, then the gateway is determined to be compatible with the middleware, and a "pass" message is sent to the middleware.
[0094] In the middleware adaptation testing method provided in this embodiment, based on the communication results between the middleware and the gateway, relevant gateway information in the gateway's response to the middleware is extracted. The identifier information and gateway information of each gateway under test are encapsulated into a request object and a response object, ensuring that one request object corresponds to one response object. A request object library and a response object library are then established based on this. Using multithreading, the response object corresponding to each request object and the standard gateway information of the gateway under test corresponding to the request object are obtained to complete the adaptation test. This solution uses the request object to uniquely identify the gateway under test for each test and determines the gateway information of the gateway under test based on the correspondence between the request object and the response object. Combined with the standard gateway information of the gateway under test, it automatically performs traversal testing of the gateway and middleware without manual intervention, solving the problem of time-consuming and labor-intensive middleware adaptation testing.
[0095] Example 2
[0096] Figure 5 This is a schematic diagram of the middleware adaptation testing device provided in one embodiment of this application. Figure 5 As shown, the middleware adaptation testing device provided in this embodiment may include:
[0097] The creation module 51 is used to create a request object library and a response object library based on the response data returned by each gateway under test according to the communication request of the middleware. The request object library includes the request object corresponding to each gateway under test, and the request object includes the identification information of the gateway under test. The response object library includes the response object corresponding to each request object, and the response object includes the gateway information of the gateway under test corresponding to the request object.
[0098] Test module 52 is used to perform middleware adaptation test processing for each gateway under test based on Python multithreading and obtain test results; the middleware adaptation test processing includes: obtaining standard gateway information corresponding to each request object according to the standard gateway information of each gateway; and performing adaptation test according to the response object corresponding to each request object and the standard gateway information.
[0099] In practical applications, middleware adaptation testing devices can be implemented through computer programs, such as application software; or they can be implemented as media storing relevant computer programs, such as USB flash drives or cloud drives; or they can be implemented through physical devices that integrate or install relevant computer programs, such as chips or servers.
[0100] Specifically, the middleware adaptation testing device obtains the response data returned by each gateway under test to the middleware, and the creation module 51 creates request objects and response objects based on the response data; wherein the request object includes the identification information of the gateway under test, which is used to uniquely identify the gateway under test; the response object includes the gateway information of the gateway under test, which represents the gateway-related information obtained by the middleware in communication with the gateway; the set of request objects is used as a request object library, and there is a one-to-one correspondence between the request objects and the request objects; the set of response objects is used as a response object library.
[0101] Then, the test module 52 uses multi-threading to perform adaptation tests based on each response object and the corresponding standard gateway information. The request object is used to uniquely determine the gateway to be tested each time the adaptation test is performed. Based on the correspondence between the request object and the response object, the response object corresponding to the request object is obtained, and based on the gateway to be tested corresponding to the request object, the standard gateway information corresponding to the gateway to be tested is obtained, thereby obtaining the standard gateway information corresponding to each response object and realizing the adaptation test processing.
[0102] In practical applications, there are various computer programming languages that can be used to perform middleware adaptation testing. In the example above, Python can be used to perform middleware adaptation testing on each gateway under test using multiple threads to obtain test results. Alternatively, programming languages such as Java and C++ can be used. There are no restrictions on these languages.
[0103] There are several ways to create request object libraries and response object libraries. In one example, creating a module can specifically be used for:
[0104] For each response data returned by the gateway under test, the identification information of the gateway under test is extracted from the response data, and the identification information of the gateway under test is encapsulated into a request object corresponding to the gateway under test.
[0105] Extract the gateway information of the gateway under test from the response data, and encapsulate the gateway information of the gateway under test into a response object corresponding to the request object of the gateway under test;
[0106] Based on the request object corresponding to each gateway under test and the response object corresponding to the request object, create a request object library and a response object library.
[0107] Specifically, based on the response data returned by each gateway under test obtained by the middleware adaptation testing device, the identification information and gateway information of each gateway under test are extracted. The identification information and gateway information of each gateway under test are encapsulated into a request object and a response object, respectively. The gateway under test corresponding to the request object and the response object are the same, so one request object corresponds to one response object. The collection of request objects is used as a request object library, and the collection of response objects is used as a response object library.
[0108] In practical applications, the identification information and gateway information of the gateway under test can be of various types, and can be selected according to the actual production needs. There are no restrictions on this. In one example, the identification information of the gateway under test includes the gateway's manufacturer information, model, and supported network communication protocols. The creation module can specifically be used for:
[0109] According to the gateway model, the request objects of each gateway under test are divided to obtain a request object class corresponding to each gateway model; according to the manufacturer information, the request object classes are combined to obtain a request object library corresponding to each gateway manufacturer; according to the gateway model, the response objects are divided to obtain a response object class corresponding to each request object class, wherein the gateway model corresponding to the request object class and the corresponding response object class is the same; according to the manufacturer information, the response object classes are combined to obtain a response object library corresponding to each request object library, wherein the manufacturer information corresponding to the request object library and the corresponding response object library is the same.
[0110] Specifically, the identification information of the gateway under test may include the gateway manufacturer information, model and supported network communication protocol information (such as EPON and GPON). After the encapsulation of the request object and response object is completed as described above, the request objects with the same gateway model are divided into a set as a request object class, and the request object classes with the same gateway manufacturer are divided into a set as a request object library. The processing of the response object is similar and will not be repeated here.
[0111] To improve testing efficiency, middleware adaptation testing can be performed using multi-threading. In one example, the testing module can also be used for:
[0112] Each request object library is assigned to a Python sub-thread within the Python multithreading, with different request object libraries corresponding to different Python sub-threads, so that the sub-threads can execute middleware adaptation tests for the gateway under test corresponding to each request object in the respective request object library.
[0113] In practical applications, using multithreading to execute tests can improve efficiency. Sub-threads can share memory and it is easy to add new sub-threads. Other computer technologies can also be used to implement the testing process, and there are no restrictions on them here.
[0114] Furthermore, in one example, the test module can specifically be used for:
[0115] Based on the manufacturer information in each request object, determine the first response object library corresponding to the first request object library to which the request object belongs; based on the model in the request object, match the corresponding first response object class in the first response object library; based on the network communication protocol information in the request object, match the corresponding response object in the first response object class, and use it as the response object corresponding to the request object.
[0116] Specifically, to obtain the response object corresponding to each request object, for a given request object, the system matches the request object library corresponding to that request object to determine the manufacturer of the gateway under test; matches the corresponding request object class within the request object library to determine the model of the gateway under test; and matches the request object under the corresponding request object class to determine the network communication protocol of the gateway under test. Based on the correspondence between request objects and response objects, and according to the manufacturer of the gateway under test, the system matches the response object library corresponding to the response object; according to the model of the gateway under test, the system matches the corresponding response object class within the response object library; and according to the network communication protocol of the gateway under test, the system matches the response object under the corresponding response object class, thereby uniquely identifying the gateway under test and its gateway information.
[0117] There are various ways to conduct adaptation testing. In one example, the testing module can be specifically used for:
[0118] Extract the response data from the response object and compare it with the standard gateway information;
[0119] If they match, the test result indicates that the middleware is compatible with the gateway under test.
[0120] If there is a discrepancy, the test result is determined to be that the middleware is incompatible with the gateway under test.
[0121] Specifically, the response data in the response object, i.e. the gateway information obtained from the communication between the middleware and the gateway, is compared with the standard gateway information of the gateway. If they match, it indicates that the middleware and gateway are compatible; otherwise, they are not compatible.
[0122] In the middleware adaptation testing device provided in this embodiment, based on the communication results between the middleware and the gateway, relevant gateway information in the gateway's response to the middleware is extracted. The identification information and gateway information of each gateway under test are encapsulated into request objects and response objects, ensuring that one request object corresponds to one response object. A request object library and a response object library are then established based on this. Using multi-threading, the response object corresponding to each request object and the standard gateway information of the gateway under test corresponding to the request object are obtained to complete the adaptation test. This solution utilizes the uniqueness of the request object to determine the gateway under test for each test, and determines the gateway information of the gateway under test based on the correspondence between the request object and the response object. Combined with the standard gateway information of the gateway under test, it automatically performs traversal testing of the gateway and middleware without manual intervention, solving the problem of time-consuming and labor-intensive middleware adaptation testing.
[0123] Example 3
[0124] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure, such as... Figure 6 As shown, the electronic device includes:
[0125] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, memory 292, and communication interface 293 can communicate with each other via the bus 294. The communication interface 293 can be used for information transmission. The processor 291 can invoke logical instructions stored in the memory 292 to execute the methods of the above embodiments.
[0126] Furthermore, the logic instructions in the aforementioned memory 292 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0127] The memory 292, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, thereby implementing the methods in the above-described method embodiments.
[0128] The memory 292 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 292 may include high-speed random access memory and may also include non-volatile memory.
[0129] This disclosure provides a non-transitory computer-readable storage medium storing computer-executable instructions that, when executed by a processor, are used to implement the methods described in the foregoing embodiments.
[0130] Example 4
[0131] This disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the methods provided in any of the embodiments described above.
[0132] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0133] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A middleware adaptation testing method, characterized in that, include: Based on the response data returned by each gateway under test according to the communication request of the middleware, a request object library and a response object library are created. The request object library includes the request object corresponding to each gateway under test, and the request object includes the identification information of the gateway under test. The response object library includes the response object corresponding to each request object, and the response object includes the gateway information of the gateway under test corresponding to the request object. Using Python multithreading, the middleware adaptation test processing of each gateway under test is executed to obtain the test results; The middleware adaptation test process includes: obtaining the standard gateway information corresponding to each request object based on the standard gateway information of each gateway; and performing adaptation tests based on the response object corresponding to each request object and the standard gateway information. The creation of the request object library and response object library includes: According to the gateway model, the request objects of each gateway under test are divided to obtain the request object class corresponding to each gateway model; according to the manufacturer information, the request object classes are combined to obtain the request object library corresponding to each gateway manufacturer. The response objects are divided according to the gateway model to obtain a response object class corresponding to each request object class. The gateway model corresponding to the request object class and the corresponding response object class is the same. The response object classes are combined according to the manufacturer information to obtain a response object library corresponding to each request object library. The manufacturer information corresponding to the request object library and the corresponding response object library is the same.
2. The method according to claim 1, characterized in that, The process of creating a request object library and a response object library based on the response data returned by each gateway under test according to the communication request from the middleware includes: For each response data returned by the gateway under test, the identification information of the gateway under test is extracted from the response data, and the identification information of the gateway under test is encapsulated into a request object corresponding to the gateway under test. The identification information of the gateway under test includes the gateway's manufacturer information, model and supported network communication protocol information. Extract the gateway information of the gateway under test from the response data, and encapsulate the gateway information of the gateway under test into a response object corresponding to the request object of the gateway under test; Based on the request object corresponding to each gateway under test and the response object corresponding to the request object, create a request object library and a response object library.
3. The method according to claim 2, characterized in that, The middleware adaptation test process also includes: Based on the vendor information in each request object, determine the first response object library corresponding to the first request object library to which the request object belongs; Based on the model number in the request object, the corresponding first response object class is obtained by matching it in the first response object library; Based on the network communication protocol information in the request object, a corresponding response object is obtained from the first response object class and used as the response object corresponding to the request object.
4. The method according to claim 1, characterized in that, The middleware adaptation test processing for each gateway under test is performed based on Python multithreading to obtain test results, including: Each request object library is assigned to a Python sub-thread within the Python multithreading, with different request object libraries corresponding to different Python sub-threads, so that the sub-threads can execute middleware adaptation tests for the gateway under test corresponding to each request object in the respective request object library.
5. The method according to any one of claims 1-4, characterized in that, The adaptation test based on the response object and standard gateway information corresponding to each request object includes: Extract the response data from the response object and compare it with the standard gateway information; If they match, the test result indicates that the middleware is compatible with the gateway under test. If there is a discrepancy, the test result is determined to be that the middleware is incompatible with the gateway under test.
6. A middleware adaptation testing device, characterized in that, include: A creation module is used to create a request object library and a response object library based on the response data returned by each gateway under test according to the communication request of the middleware. The request object library includes the request object corresponding to each gateway under test, and the request object includes the identification information of the gateway under test. The response object library includes the response object corresponding to each request object, and the response object includes the gateway information of the gateway under test corresponding to the request object. The testing module is used to perform middleware adaptation testing on each gateway under test based on Python multithreading and obtain test results. The middleware adaptation test process includes: obtaining the standard gateway information corresponding to each request object based on the standard gateway information of each gateway; and performing adaptation tests based on the response object corresponding to each request object and the standard gateway information. The creation module is specifically used for: According to the gateway model, the request objects of each gateway under test are divided to obtain the request object class corresponding to each gateway model; according to the manufacturer information, the request object classes are combined to obtain the request object library corresponding to each gateway manufacturer. The response objects are divided according to the gateway model to obtain a response object class corresponding to each request object class. The gateway model corresponding to the request object class and the corresponding response object class is the same. The response object classes are combined according to the manufacturer information to obtain a response object library corresponding to each request object library. The manufacturer information corresponding to the request object library and the corresponding response object library is the same.
7. The apparatus according to claim 6, characterized in that, The creation module is also specifically used for: For each response data returned by the gateway under test, the identification information of the gateway under test is extracted from the response data, and the identification information of the gateway under test is encapsulated into a request object corresponding to the gateway under test. The identification information of the gateway under test includes the gateway's manufacturer information, model and supported network communication protocol information. Extract the gateway information of the gateway under test from the response data, and encapsulate the gateway information of the gateway under test into a response object corresponding to the request object of the gateway under test; Based on the request object corresponding to each gateway under test and the response object corresponding to the request object, create a request object library and a response object library.
8. The apparatus according to claim 7, characterized in that, The test module is also used for: Based on the gateway vendor information in each request object, determine the first response object library corresponding to the first request object library to which the request object belongs; Based on the gateway model in the request object, the corresponding first response object class is obtained by matching in the first response object library; Based on the network communication protocol information supported by the gateway in the request object, a corresponding response object is obtained in the first response object class and used as the response object corresponding to the request object.
9. The apparatus according to claim 6, characterized in that, The test module is specifically used for: Each request object library is assigned to a Python sub-thread within the Python multithreading, with different request object libraries corresponding to different Python sub-threads, so that the sub-threads can execute middleware adaptation tests for the gateway under test corresponding to each request object in the respective request object library.
10. The apparatus according to any one of claims 6-9, characterized in that, The test module is specifically used for: Extract the response data from the response object and compare it with the standard gateway information; If they match, the test result indicates that the middleware is compatible with the gateway under test. If there is a discrepancy, the test result is determined to be that the middleware is incompatible with the gateway under test.
11. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-5.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-5.