Test method and device

By responding to the test request of the extended interface's business identifier and extended interface identifier, it finds and tests the code segment to be tested, which solves the problem of high coupling in existing test methods and improves the flexibility and efficiency of testing.

CN118779205APending Publication Date: 2024-10-15BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310371252.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-10
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Due to the high degree of coupling with the middle platform, the existing testing methods cannot be tested before being deployed to the middle platform, and may affect other business codes after deployment, resulting in poor test flexibility and low efficiency.

Method used

By responding to the business identifier of the extended interface and the extended interface identifier test request, the matching code segment to be tested is found from the storage location, and the target test data is obtained from the test database. The business functions of the code segment are tested based on these data, overcoming the problem of deployment dependencies. Test coupling issues.

Benefits of technology

It improves the versatility, flexibility and efficiency of testing, allows testing without deploying to the middle platform, and reduces the impact on other business codes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779205A_ABST
    Figure CN118779205A_ABST
Patent Text Reader

Abstract

The invention discloses a test method and device, and relates to the technical field of application development. A specific embodiment of the method comprises the following steps: in response to a test request containing a service identifier and an expansion interface identifier for an expansion interface, searching a to-be-tested expansion code segment matched with the service identifier and the expansion interface identifier from at least one storage position; searching target test data associated with the to-be-tested extended code segment for the service identifier from a test database; and testing the service function of the to-be-tested extended code segment based on the target test data. According to the embodiment of the invention, the problem that the test coupling degree is relatively high due to the fact that the test needs to be deployed in the existing method is solved, and the test universality, the test flexibility and the test efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of application development technology, and in particular to a testing method and device. Background Art

[0002] More and more application providers are using the PaaS (Platform-As-A-Service) model to build application systems. The PaaS model can separate the middle platform and the front end to form a plug-in architecture, allowing the front end to be customized based on the interface provided by the middle platform.

[0003] Testing is an important part of the application development process. Usually, the front-end method of testing whether the customized code segment is running normally is to deploy the customized code to the middle platform and then test it. The existing testing methods are highly coupled with the middle platform, which makes it impossible to test before deployment to the middle platform, and there may be mutual influence with other business codes after deployment, resulting in poor testing flexibility, low testing efficiency, and low application development efficiency. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a testing method and device, which can respond to a test request for an extended interface including a service identifier and an extended interface identifier, search for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; search for target test data associated with the extended code segment to be tested for the service identifier from a test database; and test the service function of the extended code segment to be tested based on the target test data. The embodiment of the present invention overcomes the problem of a high degree of test coupling caused by the need for deployment of tests in existing methods, and improves the versatility, flexibility and efficiency of testing.

[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a testing method is provided, characterized in that it includes: responding to a test request for an extended interface including a service identifier and an extended interface identifier, wherein the same extended interface corresponds to at least one extended code segment for at least one service; searching for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; searching for target test data associated with the extended code segment to be tested for the service identifier from a test database; and testing the service function of the extended code segment to be tested based on the target test data.

[0006] Optionally, the testing method further includes: in the case where the extended code segment is obtained by updating an already running extended code segment, collecting historical call data of the business corresponding to the business identifier for the already running extended code segment; parsing from the historical call data a plurality of first parameters for calling the extended interface, a plurality of second parameters required for calling the already running extended code segment, and a code call relationship related to the already running extended code segment; based on the parsed plurality of first parameters, a plurality of second parameters, and the code call relationship, constructing a plurality of test data, and storing them in a test database.

[0007] Optionally, parsing the code calling relationship related to the executed extended code segment from the historical calling data includes: parsing multiple calling links for implementing the business corresponding to the business identifier from multiple historical calling data; and determining each calling link as a code calling relationship.

[0008] Optionally, testing the business function of the extended code segment to be tested based on the target test data includes: calling the extended interface using the input parameters contained in the first parameter in the target test data; calling the extended code segment to be tested using the input parameters contained in the second parameter in the target test data; and running other code segments associated with the extended code segment to be tested using the code calling relationship.

[0009] Optionally, the testing method further includes: using the test results to determine the test coverage of the target test data for the extended code segment to be tested; when the test coverage does not meet the set coverage threshold, determining the sub-code segment of the extended code to be tested that is not covered by the test, so as to construct corresponding test data for the sub-code segment.

[0010] Optionally, the testing method further includes: respectively obtaining a first output parameter value corresponding to the first parameter and a second output parameter value corresponding to the second parameter; respectively comparing the first expected output value in the target test data with the first output parameter value, and the second expected output value in the target test data with the second output parameter value; and evaluating the test results of the extended code segment to be tested based on the comparison results.

[0011] Optionally, the testing method further includes: when the extended code segment is a newly added extended code segment corresponding to any business, obtaining new parameters from the newly added extended code segment; searching for at least one test data corresponding to the business identifier from a test database; using the new parameters to update each test data corresponding to the business identifier to form new test data for testing the newly added extended code segment, and storing the new test data in the test database.

[0012] To achieve the above object, according to a second aspect of an embodiment of the present invention, a test device is provided, characterized in that it includes: a request receiving module, a data determining module and a test executing module; wherein:

[0013] The request receiving module is used to respond to a test request for an extended interface including a service identifier and an extended interface identifier, wherein the same extended interface corresponds to at least one extended code segment for at least one service;

[0014] The data determination module is used to search for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; and search for target test data associated with the extended code segment to be tested for the service identifier from a test database;

[0015] The execution test module is used to test the business function of the extended code segment to be tested based on the target test data.

[0016] Optionally, the testing device is further used to collect historical call data of the business corresponding to the business identifier for the running extended code segment in the case where the extended code segment is obtained by updating the running extended code segment; parse out from the historical call data a variety of first parameters for calling the extended interface, a variety of second parameters required for calling the running extended code segment, and a code call relationship related to the running extended code segment; and construct a variety of test data based on the parsed multiple first parameters, multiple second parameters, and the code call relationship, and store them in a test database.

[0017] Optionally, the testing device is used to parse out the code calling relationship related to the executed extended code segment from the historical calling data, including: parsing out multiple calling links for implementing the business corresponding to the business identifier from multiple historical calling data; and determining each calling link as a code calling relationship.

[0018] Optionally, the testing device is used to test the business function of the extended code segment to be tested based on the target test data, including: calling the extended interface using the input parameters contained in the first parameter in the target test data; calling the extended code segment to be tested using the input parameters contained in the second parameter in the target test data; and running other code segments associated with the extended code segment to be tested using the code calling relationship.

[0019] Optionally, the testing device is further used to use the test results to determine the test coverage of the target test data for the extended code segment to be tested; when the test coverage does not meet the set coverage threshold, determine the sub-code segment of the extended code to be tested that is not covered by the test, so as to construct corresponding test data for the sub-code segment.

[0020] Optionally, the testing device is further used to respectively obtain a first output parameter value corresponding to the first parameter and a second output parameter value corresponding to the second parameter; respectively compare the first expected output value in the target test data with the first output parameter value, and the second expected output value in the target test data with the second output parameter value; and evaluate the test results of the extended code segment to be tested based on the comparison results.

[0021] Optionally, the testing device is further used to obtain new parameters from the newly added extended code segment when the extended code segment is a newly added extended code segment corresponding to any business; search for at least one test data corresponding to the business identifier from a test database; use the new parameters to update each test data corresponding to the business identifier to form new test data for testing the newly added extended code segment, and store the new test data in the test database.

[0022] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided a testing electronic device, characterized in that it comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any method described in the above-mentioned testing methods.

[0023] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, a method as described in any one of the above-mentioned test methods is implemented.

[0024] An embodiment of the above invention has the following advantages or beneficial effects: in response to a test request for an extended interface including a service identifier and an extended interface identifier, it is possible to search for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; and to search for target test data associated with the extended code segment to be tested for the service identifier from a test database; and to test the service function of the extended code segment to be tested based on the target test data. The embodiment of the present invention overcomes the problem of a high degree of test coupling caused by the need for deployment of tests in existing methods, and improves the versatility, flexibility and efficiency of tests.

[0025] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0027] Figure 1 It is a flow chart of a testing method provided by one embodiment of the present invention;

[0028] Figure 2 It is a schematic diagram of a process for constructing test data provided by an embodiment of the present invention;

[0029] Figure 3 is a flow chart of another test provided by an embodiment of the present invention;

[0030] Figure 4 is a structural schematic diagram of a testing device provided by an embodiment of the present invention;

[0031] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0032] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0034] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0035] After collecting the historical call data of the extension code segment, we will de-identify the data through technical means.

[0036] In order to count the usage of our products / services, we will aggregate, analyze and use the technically processed user data and share the processed statistical information with third parties. We will use secure encryption technology and other methods to ensure that the recipient of the information cannot re-identify a specific individual.

[0037] like Figure 1 As shown, an embodiment of the present invention provides a testing method, which may include the following steps:

[0038] Step S101: responding to a test request for an extended interface including a service identifier and an extended interface identifier, wherein the same extended interface corresponds to at least one extended code segment for at least one service.

[0039] Specifically, the PaaS architecture model is a plug-in architecture that separates the front-end business from the middle-end business through a matrix framework. According to the front-end business identifier dynamically parsed at runtime, different extension point instances are selected to execute the customized business logic of the front-end business corresponding to the business identifier. That is, the middle-end provides one or more extension interfaces through code abstraction and other means, and the front-end writes business code (i.e., extension code segment) based on one or more extension interfaces to implement its own business logic according to business needs.

[0040] In the current testing methods, the front-end extension code segment cannot be tested before being deployed to the middle-end server, because the extension code segment, as a code segment, does not cover the complete closed-loop business process and cannot be tested according to the interface test dimension. Therefore, the interface test can only be tested after being deployed to the middle-end. In addition, by testing the extension code segment after deploying the middle-end, it is still impossible to determine whether it will affect the logic of the extension code segment of other businesses, because the same middle-end application contains multiple extension code segments.

[0041] In view of this, the embodiments of the present invention can receive a test request for an extended interface that includes a business identifier and an extended interface identifier, and execute a test of the extended code segment corresponding to the business identifier, so that the extended code segment does not need to be deployed to the middle platform, thereby overcoming the above-mentioned problems existing in the existing testing methods.

[0042] Furthermore, the extended interface may be one or more interfaces, methods, functions, etc. The present invention does not limit the specific form and content of the extended interface. Different services or applications can implement their own codes (i.e., the extended code segments of the services) based on the extended interface.

[0043] Step S102: searching for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; searching for target test data associated with the extended code segment to be tested for the service identifier from a test database.

[0044] Specifically, the extended code segments written by different services based on the extended interface can be stored in multiple storage locations, such as: local hard disk, file server, cloud storage, etc.; further, according to the business identifier and the extended interface identifier, the corresponding extended code segment is searched for the business from at least one storage location; it can be understood that the file to which the extended code segment belongs can have a unique identifier bound to the business identifier, so that the matching extended code segment (that is, the extended code segment to be tested) can be found through the binding relationship.

[0045] After finding the extended code segment to be tested, further, the target test data associated with the extended code segment to be tested is searched for the service identifier from the test database. In an embodiment of the present invention, different test data can be automatically constructed for the extended code segments corresponding to different services and stored in the test database, so that after determining the extended code segment to be tested, one or more target test data for testing the extended code segment is searched from the test database. Among them, the test data can include parameters required to run the extended code segment (for example, including the input and output parameters of the extended interface, the input and output parameters of the extended code segment to be tested, etc.), the code call relationship on which the extended code segment to be tested depends, etc.; for example: interface ABC contains 5 methods, namely 1 to 5, and the code call relationship is: 1->2->3->4->5, "->" represents the call relationship; among them, the business implemented by method 3 is customizable and extendable for each business, then method 3 can be extracted as an extended interface, and other multiple businesses are personalized based on method 3. Code implementation. It can be seen that, for example, if the extended code segment A to be tested of the test service A is tested, a certain code calling relationship for the extended code segment A to be tested is: 1->2->extension interface 3->extended code segment A to be tested->4->5.

[0046] Step S103: testing the service function of the extended code segment to be tested based on the target test data.

[0047] Specifically, the business function memory test of the extended code segment is performed based on the found target test data, wherein the target test data may include parameters required to run the extended code segment to be tested (for example, input and output parameters of the extended interface, input and output parameters of the extended code segment to be tested, etc.), the code calling relationship on which the extended code segment to be tested depends, and the like.

[0048] Furthermore, after determining the test data, the business function of the extended code segment to be tested is tested based on the target test data, including: calling the extended interface using the input parameters contained in the first parameter in the target test data; calling the extended code segment to be tested using the input parameters contained in the second parameter in the target test data; and running other code segments associated with the extended code segment to be tested using the code call relationship. That is, corresponding calls are made through the input parameters contained in the first parameter and the second parameter contained in the test data, and other code segments associated with the extended code segment to be tested are run according to different code call relationships. For example, the call link corresponding to the call relationship is: 1->2->3, assuming that 2 is the extended code segment to be tested, and 1 and 3 are other code segments associated with the extended code segment to be tested. By running other code segments associated with the extended code segment to be tested, the test of the extended code segment to be tested is completed.

[0049] Further, obtain the first output parameter value corresponding to the first parameter and the second output parameter value corresponding to the second parameter respectively; compare the first expected output value in the target test data with the first output parameter value, and the second expected output value in the target test data with the second output parameter value respectively; and evaluate the test result of the extended code segment to be tested according to the comparison result. Wherein, the first parameter and the second parameter both contain input parameters and output parameters (including return values, etc.); then the expected output value in the test data (the first output parameter value, the second output parameter value) can be compared with the output parameter value (the first expected output value, the second expected output value) obtained by running the target test data respectively, if they are consistent, the test passes, and if they are inconsistent, further analyze the specific reasons in a targeted manner. That is, the test result of the extended code segment to be tested is evaluated according to the comparison result, wherein the evaluation of the test result includes the evaluation of the correctness of the code of the extended code segment itself, and can also evaluate the coverage and compatibility of the generated target test data and the code segment to be extended.

[0050] It can be seen that through steps S101 to S103 of the embodiment of the present invention, the front-end extension interface implementer only needs to provide an extension code segment to implement code testing, without the need for deployment or creation of corresponding test cases for the extension code segment, thereby greatly improving the efficiency and automation of front-end development and testing.

[0051] like Figure 2 As shown, an embodiment of the present invention provides a method for constructing test data, which may include the following steps:

[0052] Steps S201 to S203 are for the case where the extended code segment is obtained by updating an already executed extended code segment.

[0053] Step S201: collecting historical call data of the service corresponding to the service identifier for the executed extended code segment.

[0054] Specifically, the extended code segment is obtained by updating the running extended code segment, that is, the extended code segment to be tested is obtained by modifying the code based on the existing extended code segment. It is understandable that in the development process, any modified code needs to be tested in multiple dimensions. Since the extended code segment is obtained by updating the running extended code segment, and there are multiple historical call data (for example, traffic data, etc.) in the use process of the running extended code segment; in an embodiment of the present invention, the historical call data of the business corresponding to the business identifier for the running extended code segment is collected, and the historical call data obtained by automatic parsing is used to construct corresponding test data for the extended code segment.

[0055] Among them, the method of collecting historical call data can be based on timing, or conditional triggering strategies to obtain the latest historical call data, so as to correspondingly construct the latest test data and store it in the test database; thereby improving the accuracy of the test and the test coverage.

[0056] Step S202: parsing the historical call data to obtain a plurality of first parameters for calling the extended interface, a plurality of second parameters required for calling the executed extended code segment, and a code call relationship related to the executed extended code segment;

[0057] Specifically, the historical call data for the extended code segment may include a variety of first parameters for calling the extended interface, a variety of second parameters required for calling the running extended code segment, and a code call relationship related to the running extended code segment. Among them, the first parameter is the parameter corresponding to calling the extended interface, and the first parameter may include one or more input parameters and one or more output parameters; the second parameter is the variety of second parameters required for calling the running extended code segment, and the second parameter may include one or more input parameters and one or more output parameters; and the code call relationship related to the running extended code segment; it can be understood that due to different parameters, the code call links are different to implement different business logics, so the same extended code segment can have multiple historical call data, and the multiple historical call data correspond to multiple code call relationships. The test of the code link of the extended code segment can be covered through multiple code call relationships, thereby improving the test effect. For example, due to different input parameters, the paths of the call links are different, that is, the code call relationships are different, for example, the path of link A is 1->2->3, the path of link B is 1->4->2, etc.; that is, the code call relationship related to the running extended code segment is parsed from the historical call data, including: parsing multiple call links that implement the business corresponding to the business identifier from multiple historical call data; and determining each call link as a code call relationship.

[0058] Step S203: constructing a plurality of test data based on the parsed plurality of first parameters, a plurality of second parameters and the code calling relationship, and storing the data in a test database.

[0059] Specifically, multiple test data are constructed from the multiple first parameters, multiple second parameters and the code call relationship parsed from the historical call data, and stored in the test database. The parsing method can be multiple text processing methods. It can be seen that the embodiment of the present invention can automatically construct multiple test data corresponding to the existing extended code segment through its historical call data, and store it in the test database, so that when a test request for any extended code segment is received, all test data for testing the extended code segment can be directly searched from the test database.

[0060] like Figure 3 As shown, the embodiment of the present invention provides a testing process, which may include the following steps:

[0061] Step S301: searching for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; searching for target test data associated with the extended code segment to be tested for the service identifier from a test database.

[0062] Specifically, the description of searching for the extended code segment to be tested that matches the service identifier and the extended interface identifier; and searching the test database for target test data associated with the extended code segment to be tested for the service identifier is consistent with the description of step S102 and will not be repeated here.

[0063] Step S302: determine whether the extended code segment to be tested is a newly added extended code segment, if yes, execute step S303; otherwise, execute step S304.

[0064] Specifically, the extended code segment can be updated based on an existing extended code segment, or can be a newly added extended code segment written for a newly added service; whether the extended code segment to be tested is a newly added extended code segment can be determined by whether the identifier of the extended code segment to be tested already exists.

[0065] If it is a newly added extended code segment, execute step S303.

[0066] Step S303: Acquire new parameters from the new extended code segment; search for at least one test data corresponding to the service identifier from the test database; use the new parameters to update each test data corresponding to the service identifier to form new test data for testing the new extended code segment, and store the new test data in the test database.

[0067] Specifically, when it is determined that the extended code segment to be tested is a newly added extended code segment, corresponding newly added test data can be automatically constructed for the newly added extended code segment. The method for constructing the newly added test data can be to use the multiple test data of the existing service as a template, combined with the newly added parameters in the newly added extended code segment, to form the newly added test data, that is, to update each test data corresponding to the service identifier using the newly added parameters, to form the newly added test data for testing the newly added extended code segment, and to store the newly added test data in the test database, so as to implement subsequent testing of the newly added extended code segment through the test database. That is, to obtain the newly added parameters from the newly added extended code segment; to search for at least one test data corresponding to the service identifier from the test database; to update each test data corresponding to the service identifier using the newly added parameters, to form the newly added test data for testing the newly added extended code segment, and to store the newly added test data in the test database.

[0068] Step S304: testing the service function of the extended code segment to be tested based on the target test data.

[0069] Specifically, the description of testing the business function of the extended code segment to be tested based on the target test data is consistent with the description of step S103 and will not be repeated here.

[0070] Step S305: using the test result, determine the test coverage of the target test data on the extended code segment to be tested.

[0071] Step S306: Determine whether the test coverage meets the set coverage threshold, if yes, execute step S308, otherwise execute step S307.

[0072] Step S307: determining the sub-code segments of the extended code to be tested that are not covered by the test, so as to construct corresponding test data for the sub-code segments, and executing step S301 in a loop.

[0073] Steps S305 to S307 are described as follows: after testing the extended code segment to be tested using various data included in the target test data, a test result is obtained, and the test result can indicate the code that has been tested in the extended code segment to be tested; therefore, further, the test coverage of the extended code segment to be tested by the target test data can be calculated. The test coverage can be the ratio of the code that has been tested to the total extended code segment to be tested.

[0074] Further, it is determined whether the test coverage meets the set coverage threshold, for example, the coverage threshold is set to 98%. If it meets the set coverage threshold, the test process is terminated, otherwise, the sub-code segment not covered by the test is obtained from the extended code segment to be tested, so as to construct corresponding test data for the sub-code segment. The associated prompt information with the sub-code segment not covered by the test can be sent to the business party providing the extended code end, so that the business party constructs corresponding test data for the sub-code segment not covered by the test, so as to further loop step S301 and subsequent steps until the test coverage meets the set coverage threshold.

[0075] That is, using the test results, determine the test coverage of the target test data on the extended code segment to be tested; when the test coverage does not meet the set coverage threshold, determine the sub-code segments of the extended code to be tested that are not covered by the test, so as to construct corresponding test data for the sub-code segments.

[0076] Step S308: End the test.

[0077] It can be seen that through the process of step S301-step S308, the test coverage can be calculated based on the automatic test extension code segment, further improving the degree of test automation and the test effect; in addition, the corresponding new test data can be automatically constructed for the new extension code based on the existing test data, further improving the scalability and flexibility of the test and improving the test efficiency.

[0078] like Figure 4As shown, the embodiment of the present invention provides a test device 400, including: a request receiving module 401, a data determining module 402 and a test executing module 403; wherein,

[0079] The request receiving module 401 is used to respond to a test request for an extended interface including a service identifier and an extended interface identifier, wherein the same extended interface corresponds to at least one extended code segment for at least one service;

[0080] The data determination module 402 is used to search for the extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; and search for target test data associated with the extended code segment to be tested for the service identifier from a test database;

[0081] The test execution module 403 is used to test the business function of the extended code segment to be tested based on the target test data.

[0082] An embodiment of the present invention also provides a testing electronic device, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.

[0083] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method provided in any of the above embodiments is implemented.

[0084] Figure 5 An exemplary system architecture 500 is shown to which a testing method or a testing device according to an embodiment of the present invention can be applied.

[0085] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0086] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various client applications can be installed on terminal devices 501, 502, 503, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, and email clients.

[0087] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0088] The server 505 may be a server providing various services, such as a background management server providing support for client applications used by users using the terminal devices 501, 502, and 503. The background management server may process the received test request for the extended interface including the service identifier and the extended interface identifier, and provide the test result to the terminal device.

[0089] It should be noted that the testing method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the testing device is generally disposed in the server 505 .

[0090] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0091] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0092] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0093] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0094] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0095] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0096] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0097] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be set in a processor, for example, they may be described as: a processor including a request receiving module, a data determination module, and a test execution module; wherein the names of these modules do not constitute a limitation on the modules themselves under certain circumstances, for example, the test execution module may also be described as "a module for testing the business functions of the extended code segment to be tested based on the target test data".

[0098] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: responding to a test request for an extended interface including a service identifier and an extended interface identifier, wherein the same extended interface corresponds to at least one extended code segment for at least one service; searching for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; searching for target test data associated with the extended code segment to be tested for the service identifier from a test database; and testing the service function of the extended code segment to be tested based on the target test data.

[0099] The embodiment of the present invention can respond to a test request for an extended interface including a service identifier and an extended interface identifier, search for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; search for target test data associated with the extended code segment to be tested for the service identifier from a test database; and test the service function of the extended code segment to be tested based on the target test data. The embodiment of the present invention overcomes the problem of a high degree of test coupling caused by the need for deployment of tests in existing methods, and improves test versatility, flexibility, and test efficiency.

[0100] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A testing method, characterized in that: include: Responding to a test request for an extended interface including a service identifier and an extended interface identifier, wherein the same extended interface corresponds to at least one extended code segment for at least one service; Searching for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; Searching for target test data associated with the extended code segment to be tested for the service identifier from a test database; The service function of the extended code segment to be tested is tested based on the target test data.

2. The method according to claim 1, characterized in that Further including: In the case where the extended code segment is obtained by updating an already executed extended code segment, Collecting historical call data of the business corresponding to the business identifier for the executed extended code segment; Parsing from the historical call data a plurality of first parameters for calling the extended interface, a plurality of second parameters required for calling the executed extended code segment, and a code call relationship related to the executed extended code segment; Based on the parsed multiple first parameters, multiple second parameters and the code calling relationship, multiple test data are constructed and stored in a test database.

3. The method according to claim 2, characterized in that The step of parsing the code calling relationship related to the executed extended code segment from the historical calling data includes: Parsing multiple call links for implementing the business corresponding to the business identifier from multiple historical call data; Determine each call link as a code call relationship.

4. The method according to claim 2, characterized in that: The testing the business function of the extended code segment to be tested based on the target test data includes: Calling the extended interface using the input parameters included in the first parameter in the target test data; Calling the extended code segment to be tested using the input parameter included in the second parameter in the target test data; The code calling relationship is used to run other code segments associated with the extended code segment to be tested.

5. The method according to claim 1, characterized in that Further including: Using the test result, determining the test coverage of the target test data on the extended code segment to be tested; When the test coverage does not meet the set coverage threshold, a sub-code segment of the extended code to be tested that is not covered by the test is determined, so as to construct corresponding test data for the sub-code segment.

6. The method according to claim 4, characterized in that Further including: Respectively obtaining a first output parameter value corresponding to the first parameter and a second output parameter value corresponding to the second parameter; Respectively comparing a first expected output value in the target test data with the first output parameter value, and a second expected output value in the target test data with the second output parameter value; According to the comparison result, the test result of the extended code segment to be tested is evaluated.

7. The method according to claim 1, characterized in that Further including: In the case where the extended code segment is a newly added extended code segment corresponding to any service, Acquire new parameters from the new extended code segment; Searching for at least one test data corresponding to the service identifier from a test database; Each type of test data corresponding to the service identifier is updated using the newly added parameter to form newly added test data for testing the newly added extended code segment, and the newly added test data is stored in the test database.

8. A testing device, characterized in that: include: Receive request module, determine data module and execute test module; wherein, The request receiving module is used to respond to a test request for an extended interface including a service identifier and an extended interface identifier, wherein the same extended interface corresponds to at least one extended code segment for at least one service; The data determination module is used to search for an extended code segment to be tested that matches the service identifier and the extended interface identifier from at least one storage location; and search for target test data associated with the extended code segment to be tested for the service identifier from a test database; The execution test module is used to test the business function of the extended code segment to be tested based on the target test data.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.