CN106294113B - creation method and device based on programmable test service - Google Patents

creation method and device based on programmable test service Download PDF

Info

Publication number
CN106294113B
CN106294113B CN201510301053.1A CN201510301053A CN106294113B CN 106294113 B CN106294113 B CN 106294113B CN 201510301053 A CN201510301053 A CN 201510301053A CN 106294113 B CN106294113 B CN 106294113B
Authority
CN
China
Prior art keywords
class
service
test
code
environment information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510301053.1A
Other languages
Chinese (zh)
Other versions
CN106294113A (en
Inventor
涂学军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510301053.1A priority Critical patent/CN106294113B/en
Publication of CN106294113A publication Critical patent/CN106294113A/en
Application granted granted Critical
Publication of CN106294113B publication Critical patent/CN106294113B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses programmable test service-based creation method and device, and the method comprises the steps that a test platform receives codes corresponding to test environment information, compiles the codes, determines service types corresponding to the test environment information according to the compiled codes, and issues the compiled codes according to a preset issuing mode corresponding to the service types so as to process different types of test requests.

Description

creation method and device based on programmable test service
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for creating programmable test services.
Background
With the development of information technology, a service system of a background of a network service provider can provide various abundant service services for users. The successful implementation of business services generally depends on the interaction between the functional units inside the service system and the interaction between the service system and external systems.
At present, in the process of developing and testing a business service, in order to ensure that the business service can normally run in actual application, a running simulation test needs to be performed on the business service, that is, a mock is performed on the business service, where a mock refers to a object a to be tested, a virtual running environment is constructed, and a running logic of the object a to be tested in an actual running scene is simulated, and the mock includes calling and interaction between the object a to be tested and each functional unit in a service system, calling and interaction between the object a to be tested and an external system, and the like in actual application.
In the prior art, when a developer wants to perform mock on a business service to be tested, the developer usually deploys a business code of the business service to be tested to a server with a mock function, and can perform mock under different operation scenes according to actual needs according to the business code deployed in the server, wherein the specific mode is as follows: the developer deploys the required operation scene and the operation parameters to the server in a mock code manner, and couples the operation scene and the operation parameters with the service codes of the service to be tested, so that the server converts the mock codes into a mock service (the mock service only aims at the service to be tested), and the mock service is simulated and tested under the corresponding operation scene.
However, in practical application, many specific business services need multiple types of test results, since the mock codes and the business codes of the business services to be tested are coupled at , only fixed types of tests can be performed, if developers want to obtain different types of test results, only the mock codes can be rewritten, and the above coupling process is repeated.
Disclosure of Invention
The embodiment of the invention provides creation methods and devices based on programmable test services, which are used for solving the problem of low efficiency when the traditional mock service is used for carrying out simulation test.
The creation method based on the programmable test service provided by the embodiment of the invention comprises the following steps:
the test platform receives a code corresponding to the test environment information;
compiling the code;
determining a service type corresponding to the test environment information according to the compiled code;
and releasing the compiled code according to a preset release mode corresponding to the service type so as to process different types of test requests.
The creation methods based on the programmable test service provided by the embodiment of the invention further include:
the test platform receives a test request;
determining test environment information corresponding to the test request;
searching codes which are the same as the testing environment information corresponding to the testing request in all issued codes according to the testing environment information;
and calling the searched code to process the test request.
Another creating apparatus based on programmable testing service provided in this embodiment of the present invention includes:
the receiving module is used for receiving a code corresponding to the test environment information;
the compiling module is used for compiling the codes;
the determining module is used for determining the service type corresponding to the test environment information according to the compiled code;
and the release module is used for releasing the compiled codes according to a preset release mode corresponding to the service type so as to process different types of test requests.
Another creating apparatus based on programmable testing service provided in this embodiment of the present invention includes:
the receiving module is used for receiving the test request;
the determining module is used for determining the test environment information corresponding to the test request;
the searching module is used for searching codes which are the same as the testing environment information corresponding to the testing request in all the issued codes according to the testing environment information;
and the processing module is used for processing the test request.
The embodiment of the invention provides programmable test service-based creating methods and devices, wherein a test platform receives a code corresponding to test environment information, compiles the code to determine a service type corresponding to the test environment information, and issues the compiled code in the test platform according to different issuing methods.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and constitute a part of , illustrate embodiments of the invention and together with the description serve to explain the invention without limiting it, and in which:
FIG. 1 is a schematic diagram illustrating a process for creating a received programmable test-based service according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a platform interface of a test platform according to an embodiment of the present invention;
fig. 3 is a schematic process diagram of mock request processing according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a creating apparatus based on a programmable test service according to an embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a creating apparatus based on a programmable test service according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the present invention clearer and more complete description of the technical solutions of the present invention will be given below with reference to specific embodiments of the present invention and accompanying drawings.
Fig. 1 is a process for creating a programmable test service according to an embodiment of the present invention, where the process specifically includes the following steps:
s101, the test platform receives a code corresponding to the test environment information.
It should be noted that, in the present application, a test platform is adopted, so that the received codes are disclosed, that is, any developer can call codes uploaded by other developers on the test platform.
In the step S101, the test environment information is information required for performing the simulation test on the service to be tested, and the test environment information defines information such as an operation scenario of the service to be tested during the simulation test, an interface interacting with each functional unit in the service system, an interactive data value, and a return value.
The code in the embodiment of the present application may be specifically written in a mock script, that is, for step S101, the code corresponding to the test environment information is received, specifically: receiving a mock script, wherein the mock script comprises test environment information written in a code mode.
S102, compiling the codes.
In this embodiment of the present application, the server compiles the code corresponding to the test environment information, which is a process in which the server reads the content included in the code. That is, by compiling the code, the server can obtain the specific content of the test environment information, so as to perform the simulation test subsequently.
Wherein, the compiling mode includes but is not limited to: static compilation or dynamic compilation. Wherein, static compiling refers to that all classes and methods related in the code are loaded no matter whether the classes and methods are used at the time; dynamic compilation refers to loading only when needed for use, for classes and methods involved in the code. Both loading methods can be used in the compiling process of the code in the present application, and the present application is not limited herein.
S103, determining the service type corresponding to the test environment information according to the compiled code.
In practical applications, different service types usually correspond to different business services, for example: the website provides a service displayed by a web page, and the type corresponding to the service is a Hypertext transfer protocol (Http) service. Another example is: the server system obtains a service of the weather information from the weather station, and the corresponding type of the service is a Transmission Control Protocol (TCP) service (that is, the weather information transmitted by the weather station is received through a specific TCP interface).
Therefore, for any business service to be tested, the corresponding service type is the service type corresponding to the test environment code thereof.
It should be noted here that, in the embodiment of the present application, the service type corresponding to the test environment information includes, but is not limited to: http service, TCP service, webservice service, tair service, etc.
And S104, issuing the compiled code according to a preset issuing mode corresponding to the service type so as to process different types of test requests.
Different service types, related interaction modes and functions required to be called by a background are different, and in order to enable codes of different service types to run smoothly, the codes are issued in different modes according to the service types corresponding to the test environment information after the codes are compiled by the server.
It should be noted that, in the embodiment of the present application, the issued code will be used as test services of the test platform, and is visible in the full platform, that is, a developer accessing the platform can browse, refer and use the issued code, which changes the traditional "privatization" way when mock is performed, that is, the test code is no longer coupled with the service code of the service to be tested, and is converted into test services that are common to the full platform.
The method is different from the method of binding and coupling the test codes and the service codes in the prior art, and a developer can search the released and applicable codes for simulation test through the test platform and can test other service services with the same test scene according to the test environment information corresponding to the released codes, so that the defects that different service services with the same operation scene in the prior art cannot use the same test codes are overcome, and the simulation test efficiency under the condition of developing a large number of test is effectively improved.
In a practical application scenario, the implementation of code is based on classes, where a class is a template of methods and variables used to define an object of a particular type. That is, the logic method and variable assignment used in the code are defined by classes, so when the test platform needs to execute the code, the logic method and variable assignment of the code need to be known, that is, the test platform needs to load the classes in the code. In this embodiment of the present application, the code is carried in the mock script, and therefore, in this embodiment of the present application, the code is compiled, specifically: and loading classes contained in the code in the mock script so as to compile the code.
In this embodiment of the present application, the loading of the class of the code in the mock script is often implemented by a class loader, for example, a Java Virtual Machine (JVM) loads the class (that is, loads a class file corresponding to the class in the code from a corresponding class library), in some cases, the class used in the code written by the user is a default class, where the default class is a class corresponding to a class file stored in the default class library by default, that is, the server may directly use the default class loader to load the class in the code (load the class file in the default class library), and in actual applications, the class used in the code written by the user is not a default class (that is, the class file corresponding to the class included in the code is not a class file in the default class library but is a third class file), so that the server cannot use the default class loader to load the classes, so that in the script included in the mock script should load the class, and the default class loader should be a specific class that the class of the code loaded by default loader does not belong to the default class loader.
It should be noted that, in the embodiment of the present application, the test platform determines the type to which the class included in the code belongs, and specifically, may determine the type to which the class in the code belongs by determining a combination of a class name of the class in the code and a logic method used in the code. And are not to be construed as limiting the application herein.
In the embodiment of the present application, the processes of loading classes using the default class loader and the custom class loader are different, and the following two types of processes are described specifically:
in a case that the server calls the default class loader, it indicates that a class included in the code in the mock script is a default class, but in consideration of an actual application scenario, when a developer user writes the code, a used class name may be defined by himself/herself according to a preference of the user (a method and a variable defined in the class are still the same as the default class and do not change), in such a case, due to the class whose class name has changed, the default class loader cannot accurately load a class file corresponding to the class from the default class library, that is, the class loader cannot effectively load the class in the code, and therefore in this embodiment of the present application, the class loader is called to load the class, specifically: determining a class name corresponding to a class contained in the code, judging whether the class name is the class name of a default class, if so, calling the default class loader to directly load the class, otherwise, renaming the class name to the default class name, and calling the default class loader to load the class. That is, the default class loader renames the class name of the class in the code to the default class name, so that the default class loader can smoothly load the class of the code in the mock script.
That is to say, if the class name of the default class in the code has not changed, the test platform may directly load the class file corresponding to the class in the default class library for the class included in the code. If the class name of the default class in the code changes, the test platform renames the class name of the class to the class name of the default class, so that the class file corresponding to the class can be found in the default class library and loaded.
In the case where the server calls a custom class loader, it indicates that the class used in the code is not the default class. This requires that the server searches the class files corresponding to the non-default classes through the corresponding paths when loading the non-default classes (at this time, the server cannot search the class files in the default class library).
In addition, considering that in practical application, a server may receive a plurality of different mock scripts, and codes in the mock scripts may all use non-default classes, so , the server may respectively call a respective custom class loader for each mock script, and load the non-default classes of the codes in the mock scripts by searching different paths, so as not to generate a call confusion phenomenon, the server may use a marking method, that is, in this application embodiment, a custom class loader is called to load the classes, specifically, a storage path of the class file is determined, the custom class loader is called, an identity is set for the custom class loader, a corresponding relationship between the identity and the storage path is established, and a class file pointed by the storage path corresponding to the identity of the custom loader is loaded through the custom class loader.
It should be noted here that the storage path may point to a class file or a file directory storing the class file. If the storage path points to a class file, the custom class loader searches a non-default class from the class file. And if the file directory pointed by the storage path is available, the user-defined class loader searches the class file in the file directory, and after the class file is found, the non-default class is searched in the class file. If the non-default class is found successfully, the non-default class can be loaded, but if the non-default class is not found, the server returns exception prompt information to inform a developer that the user cannot find the non-default class successfully, so that the developer can readjust the storage path or upload a correct class file again.
In practical applications, when a developer user uses a non-default class in the written code, the developer user generally uploads a class file required by the non-default class to the test platform so that the test platform can use the code in the mock script when compiling. The file format of the class file uploaded by the developer user may be jar, zip, etc., and is not limited in this respect. Certainly, in actual application, the custom class loader may also be uploaded to the test platform by the developer, so that when the test platform loads the non-default class in the code of the developer, the custom class loader uploaded by the developer is called to load the non-default class file uploaded by the developer. The above modes are only examples in the embodiments of the present application, and the practical application is not limited to the above modes, for example: in practical application, the custom class loader can be provided by a test platform, and the custom class loader provided by the test platform can be suitable for loading various types of class files. And are not to be construed as limiting the application herein.
When the test platform successfully compiles the codes, the compiled codes are published in the whole test platform, so that the codes can be visible to different developers accessing the test platform, and the developers can call the codes to perform corresponding simulation tests according to use requirements.
It should be noted that, in practical application, different service types are defined by different testing environment information, and the testing platform can determine, according to the compiled code, the service type to which the testing environment information corresponding to the code belongs. In the embodiment of the present application, the service type corresponding to the testing environment information is as described above, that is, at least includes: http service, TCP service, webservice service, tair service. For different service types, the running logic of the service to be called and the testing environment and the like are different in the testing process, so that the testing platform needs to issue codes of different service types in different modes in order to ensure that the codes of different service types can run normally and effectively during the simulation test.
Specifically, in this embodiment of the present application, the code is issued according to a preset issuing manner corresponding to the service type, specifically: and when the service type is an Http service, storing an object in the mock script in a memory of the server to issue the mock script, when the service type is a TCP service, issuing the mock script through a mina service framework, and when the service type is a webservice service and a tair service, issuing the mock script through an xfire.
It should be noted that, when the service type corresponding to the test environment information is Http service, it indicates that the running environment during the simulation test is basic network service, and then the test platform stores objects (such as various network parameters) included in the class of the code in the memory of the server, so as to implement the release of the code. When the simulation test of the Http service is performed, the test platform can call the stored network parameters required by the test from the memory to complete the test.
When the service type corresponding to the test environment information is a TCP service, it indicates that the operating environment during the simulation test needs to simulate the process of interacting with an external system through TCP connection, and at this time, the server uses a mina frame ( network communication application frames which are mainly aiming at the communication frames of TCP/IP and UDP/IP protocol stacks) to issue the mock script to realize the simulation of communication interaction scenes based on the TCP connection.
When the service type corresponding to the test environment information is web service or tair service, it is indicated that the mock service is website services or data storage services, both of which simulate a service end, and at this time, the server uses a web service (such as Xfire, a web service engine) to issue the mock script so as to simulate the service end.
It can be seen from the above contents that programmable test platforms (that is, mock platforms) are constructed in the embodiment of the application, and such test platforms are different from the prior art in that a developer can write various required test environment information by himself (to simulate different operation scenes), form a mock script and send the mock script to the test platform, and the test platform can issue the mock script in different ways according to different service types, so that the mock script is visible to the whole platform, the issued mock script can not only perform simulation tests on the current service to be tested, but also other developers can call the mock script on the test platform to perform simulation tests on other services to be tested.
The test platform is described below with an application example of :
fig. 2 shows a platform interface that is provided by a test platform in the embodiment of the present application and can be used by developers who visit the test platform at any point , where the platform interface in fig. 2 shows each codes published on the test platform, so that different developers can intuitively browse the codes published by the developers themselves and by other developers through the platform interface, and for each developer, the codes published by any point can be used through the platform interface.
The area a1 in fig. 2 shows the identifiers of different codes that have been issued on the test platform, which specifically includes: the number and name of the code.
The service type of each code is shown in the area a2, and the platform interface includes 4 service types, which are Http (i.e., Http service), TCP (i.e., TCP service), ws (i.e., webservice service), and tr (i.e., tair service).
Shown in area a3 is the address corresponding to each code, specifically, for http, the code's address is the Uniform Resource Locator (URL).
In the platform interface in fig. 2, an operation option (a column named "operation" on the right side in fig. 2) is further provided, and a developer can edit a code issued by the developer through the operation option, and other developers can perform simulation tests using the corresponding code through the operation option.
It can be seen from the above example that, different from the prior art, the mock service depth provided by the mock platform in the prior art is embedded in the service code of the service to be tested, and a developer can only use the mock service to test the service to be tested, but in the embodiment of the present application, the user can freely construct various mock services required by the user by using the test platform in the embodiment of the present application, and the mock service is not deeply coupled with the service to be tested, and other developers can also use the code of the developer to perform simulation tests on other service, so that the usability of the mock service in the test platform is effectively improved, and the user can also select a mode that the published code belonging to the user is cancelled from the test platform, i.e., the mode of plugging and unplugging, so that the flexibility of the test platform is greatly enhanced.
The above is the process of establishing the programmable testing platform in the embodiment of the present application. After the programmable test platform is established, different test requests may be processed, specifically, a data processing process based on the programmable test platform is as shown in fig. 3, and the process specifically includes the following steps:
s301, the test platform receives a test request.
In the embodiment of the present application, when the test platform is formed by a server cluster, any servers in the server cluster may receive the test request.
It should be noted that the test request described in the embodiment of the present application is a test request of an object to be tested. In the embodiment of the application, the object to be tested is the business service to be tested.
S302, determining the test environment information corresponding to the test request.
Different business services to be tested need to determine the test environment information of the business services to be tested when performing simulation test. In the application, the test environment information required by the service to be tested is carried in the test request, so that the test platform can determine the test environment information corresponding to the test request after receiving the test request.
S303, searching codes which are the same as the test environment information corresponding to the test request in all the issued codes according to the test environment information.
In the method for creating a programmable test service as shown in fig. 1, different developers release codes corresponding to test environment information written by the developers in the test platform, so that, after the test platform receives the test request, a code matched with the test request of the current business service to be tested is determined in each released code and is used for testing the business service to be tested.
S304, calling the searched code to process the test request.
After the corresponding code is found, the test platform calls the code to process the test request.
Through the above steps, in the test platform in the embodiment of the present application, after receiving the test request, the test platform will perform a test according to the test environment information corresponding to the test request, and finding out the codes matched with the test environment information from all the codes released by the test platform to perform simulation test on the test object, wherein due to the common use of the test platform, so that different test objects can be subjected to simulation test by calling the existing codes in the test platform, the efficiency of the simulation test on the object to be tested is effectively improved, and similarly, for a specific object to be tested, various types of simulation tests are required, and applicable codes can be searched from the test platform to perform different types of simulation tests, so that the development test efficiency is improved, and the convenience in the test process is also improved.
For example, suppose that a certain weather service is an object to be tested, the default service type of the weather service is http service, and the operating environment defaults to successfully receive weather information of a weather station, in practical application, in order to test a processing scheme when the weather service encounters a service error in an actual operating process, a developer may designate the operating environment as failure to receive the weather information, so that the operating environment designated by the user is changed from the operating environment of the weather service itself.
Then, in step S302, the test environment information corresponding to the test request is determined, specifically: when the test request contains a service type and/or an operation scene specified by a user, determining the service type and/or the operation scene specified by the user as test environment information corresponding to the test request; and when the test request does not contain the service type and/or the operation scene specified by the user, determining the default service type and/or the operation environment corresponding to the object to be tested as the test environment information corresponding to the test request.
Based on the same idea, the above method for creating a programmable test service according to the embodiment of the present invention further provides types of creating apparatuses based on the programmable test service.
As shown in fig. 4, the apparatus for creating a programmable test service includes: a receiving module 401, a compiling module 402, a determining module 403 and a publishing module 404, wherein,
the receiving module 401 is configured to receive a code corresponding to the test environment information.
The compiling module 402 is configured to compile the code.
The determining module 403 is configured to determine a service type corresponding to the test environment information according to the compiled code.
The publishing module 404 is configured to publish the compiled code according to a preset publishing manner corresponding to the service type, so as to process different types of test requests.
In the embodiment of the present application, the service types include, but are not limited to: hypertext transfer protocol Http service, transmission control protocol TCP service, webservice service, tair service, etc.
The compiling module 402 is specifically configured to receive a mock script. The mock script comprises test environment information written in a code mode.
The issuing module 404 is specifically configured to, when the service type is Http service, store an object included in a code in the mock script in a memory of the server to issue the mock script; when the service type is TCP service, the mock script is issued through a mina framework; and when the service type is webservice service or tair service, the mock script is issued through web service.
The compiling module 402 is specifically configured to determine a type to which a class included in the mock script belongs, call a default class loader to load the class if the class belongs to a default class, and call a custom class loader to load the class if the class does not belong to the default class.
More specifically, the compiling module 402 is specifically configured to determine a class name corresponding to a class included in the mock script, determine whether the class name is a class name of a default class, if so, invoke the default class loader to directly load the class, otherwise, rename the class name to the default class name, and invoke the default class loader to load the class.
And the compiling module 402 is specifically configured to determine a storage path of the class file, invoke a custom class loader, set an identity for the custom class loader, establish a correspondence between the identity and the storage path, and load, through the custom class loader, the class file pointed by the storage path corresponding to the identity of the custom loader.
Accordingly, in the embodiment of the present application, there are also provided creating devices based on programmable testing services, as shown in fig. 5, the device includes:
a receiving module 501, configured to receive a test request.
A determining module 502, configured to determine test environment information corresponding to the test request.
The searching module 503 is configured to search, according to the testing environment information, codes that are the same as the testing environment information corresponding to the testing request in all issued codes.
A processing module 504, configured to process the test request.
The test request carries a default service type and/or a running environment of the object to be tested.
The determining module 502 is specifically configured to determine, when the test request includes a service type and/or an operation scenario specified by a user, the service type and/or the operation scenario specified by the user as test environment information corresponding to the test request; and when the test request does not contain the service type and/or the operation scene specified by the user, determining the service type and/or the operation environment corresponding to the object to be tested as the test environment information corresponding to the test request.
In typical configurations, a computing device includes or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises the series of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
Furthermore, the present invention may take the form of a computer program product embodied on or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The above description is only an example of the present invention, and is not intended to limit the present invention. Various modifications and alterations to this invention will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (18)

1, A creation method based on programmable test service, which is characterized in that it includes:
the test platform receives a code corresponding to the test environment information;
compiling the code;
determining a service type corresponding to the test environment information according to the compiled code;
and releasing the compiled code according to a preset release mode corresponding to the service type so as to process different types of test requests.
2. The method of claim 1, wherein receiving a code corresponding to test environment information specifically comprises:
receiving a mock script, wherein the mock script comprises test environment information written in a code mode;
the service types comprise at least of hypertext transfer protocol Http service, transmission control protocol TCP service, webservice service and tair service;
the test request comprises a mock request.
3. The method according to claim 2, wherein publishing the compiled code according to a preset publishing manner corresponding to the service type specifically includes:
when the service type is an Http service, storing an object contained in a code in the mock script in a memory of the server to issue the mock script;
when the service type is TCP service, the mock script is issued through a mina framework;
and when the service type is webservice service or tair service, the mock script is issued through web service.
4. The method of claim 2, wherein compiling the code specifically comprises:
and loading classes contained in the code in the mock script so as to compile the code.
5. The method of claim 4, wherein loading the classes contained in the code in the mock script specifically comprises:
determining a type to which a class contained in the code belongs;
if the class belongs to the default class, calling a default class loader to load the class;
and if the class does not belong to the default class, calling a custom class loader to load the class.
6. The method of claim 5, wherein invoking a default class loader to load the class specifically comprises:
determining a class name corresponding to a class contained in the code;
judging whether the class name is the class name of the default class or not;
if so, calling the default class loader to directly load the class;
otherwise, renaming the class name to a default class name, and calling a default class loader to load the class.
7. The method of claim 5, wherein invoking a custom class loader to load the class specifically comprises:
determining a storage path of a class file corresponding to a class contained in the code;
calling a custom class loader and setting an identity for the custom class loader;
establishing a corresponding relation between the identity and the storage path;
and loading the class file pointed by the storage path corresponding to the identity of the custom class loader through the custom class loader.
8, A creation method based on programmable test service, which is characterized in that it includes:
a test platform receives a test request, wherein the test request is a service test request;
determining test environment information corresponding to the test request, wherein the corresponding test environment information is information required by the business service to be tested during simulation test, and the test environment information is carried in the test request;
searching codes which are the same as the testing environment information corresponding to the testing request in all issued codes according to the testing environment information;
and calling the searched code to process the test request.
9. The method of claim 8, wherein the test request carries a default service type and/or operating environment of the object to be tested;
determining test environment information corresponding to the test request, specifically including:
when the test request contains a service type and/or an operation scene specified by a user, determining the service type and/or the operation scene specified by the user as test environment information corresponding to the test request;
and when the test request does not contain the service type and/or the operation scene specified by the user, determining the default service type and/or the operation environment corresponding to the object to be tested as the test environment information corresponding to the test request.
10, A programmable test service-based creation device, comprising:
the receiving module is used for receiving a code corresponding to the test environment information;
the compiling module is used for compiling the codes;
the determining module is used for determining the service type corresponding to the test environment information according to the compiled code;
and the release module is used for releasing the compiled codes according to a preset release mode corresponding to the service type so as to process different types of test requests.
11. The apparatus according to claim 10, wherein the receiving module is specifically configured to receive a mock script, where the mock script includes test environment information written in a code manner;
the service types comprise at least of hypertext transfer protocol Http service, transmission control protocol TCP service, webservice service and tair service;
the test request comprises a mock request.
12. The apparatus of claim 11, wherein the publishing module is specifically configured to:
when the service type is an Http service, storing an object contained in a code in the mock script in a memory of the server to issue the mock script;
when the service type is TCP service, the mock script is issued through a mina framework;
and when the service type is webservice service or tair service, the mock script is issued through web service.
13. The apparatus of claim 10, wherein the compiling module is specifically configured to load classes included in the code in the mock script to compile the code.
14. The apparatus of claim 13, wherein the compiling module is specifically configured to determine a type to which a class included in the code belongs, and if the class belongs to a default class, call a default class loader to load the class, and if the class does not belong to the default class, call a custom class loader to load the class.
15. The apparatus according to claim 14, wherein, when a default class loader is invoked, the compiling module is specifically configured to determine a class name corresponding to a class included in the code, determine whether the class name is a class name of a default class, if so, invoke the default class loader to directly load the class, otherwise, rename the class name to the default class name, and then invoke the default class loader to load the class.
16. The apparatus of claim 14, wherein in a case of invoking a custom class loader, the compiling module is specifically configured to determine a storage path of a class file corresponding to a class included in the code, invoke the custom class loader, set an identity for the custom class loader, establish a correspondence between the identity and the storage path, and load, through the custom class loader, a class file pointed to by the storage path corresponding to the identity of the custom class loader.
17, A programmable test service-based creation device, comprising:
the system comprises a receiving module, a test module and a processing module, wherein the receiving module is used for receiving a test request which is a business service test request;
a determining module, configured to determine test environment information corresponding to the test request, where the corresponding test environment information is information required by a to-be-tested business service during a simulation test, and the test environment information is carried in the test request;
the searching module is used for searching codes which are the same as the testing environment information corresponding to the testing request in all the issued codes according to the testing environment information;
and the processing module is used for processing the test request.
18. The apparatus of claim 17, wherein the test request carries a default service type and/or operating environment of the object to be tested;
the determining module is specifically configured to determine, when the test request includes a service type and/or an operation scenario specified by a user, the service type and/or the operation scenario specified by the user as test environment information corresponding to the test request; and when the test request does not contain the service type and/or the operation scene specified by the user, determining the default service type and/or the operation environment corresponding to the object to be tested as the test environment information corresponding to the test request.
CN201510301053.1A 2015-06-03 2015-06-03 creation method and device based on programmable test service Active CN106294113B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510301053.1A CN106294113B (en) 2015-06-03 2015-06-03 creation method and device based on programmable test service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510301053.1A CN106294113B (en) 2015-06-03 2015-06-03 creation method and device based on programmable test service

Publications (2)

Publication Number Publication Date
CN106294113A CN106294113A (en) 2017-01-04
CN106294113B true CN106294113B (en) 2020-01-31

Family

ID=57655800

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510301053.1A Active CN106294113B (en) 2015-06-03 2015-06-03 creation method and device based on programmable test service

Country Status (1)

Country Link
CN (1) CN106294113B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106970873B (en) * 2017-01-10 2021-07-09 创新先进技术有限公司 On-line mock testing method, device and system
CN108460612B (en) * 2017-02-20 2023-01-06 腾讯科技(北京)有限公司 Advertisement delivery test method, device and equipment
CN109086059B (en) * 2017-06-14 2023-05-09 腾讯科技(北京)有限公司 Code loading updating method, device and server
CN108228452B (en) * 2017-12-28 2021-04-06 微梦创科网络科技(中国)有限公司 Test method and test device based on simple factory mode
CN109101430B (en) * 2018-08-24 2022-08-09 创新先进技术有限公司 Test method, device and equipment
CN110413314A (en) * 2019-07-24 2019-11-05 深圳市盟天科技有限公司 A kind of file publishing method, device, equipment and storage medium
CN110727589A (en) * 2019-09-30 2020-01-24 北京创鑫旅程网络技术有限公司 Test method, device and equipment
CN113176994A (en) * 2021-04-28 2021-07-27 中国工商银行股份有限公司 Mock data method and device based on function calculation
CN113656268B (en) * 2021-07-30 2024-02-06 北京百度网讯科技有限公司 Performance test method and device for business service, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425585A (en) * 2013-08-31 2013-12-04 华南理工大学 OSGI (Open Service Gateway Initiative) integration testing method
CN104111888A (en) * 2014-07-03 2014-10-22 曹建楠 Code evaluation method, device and system for teaching
CN104391792A (en) * 2014-11-27 2015-03-04 北京国双科技有限公司 Test environment information processing method, device and system
CN104536890A (en) * 2014-12-26 2015-04-22 小米科技有限责任公司 Testing system, method and device
CN104536899A (en) * 2015-01-20 2015-04-22 成都益联科创科技有限公司 Software deploying and maintaining method based on intelligent cluster

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100571167C (en) * 2006-02-24 2009-12-16 国际商业机器公司 The method and apparatus of the unit testing of Web service operation flow
CN103164334B (en) * 2011-12-19 2016-03-30 国际商业机器公司 Detect the system and method for the breakaway poing in web application automatic test case

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425585A (en) * 2013-08-31 2013-12-04 华南理工大学 OSGI (Open Service Gateway Initiative) integration testing method
CN104111888A (en) * 2014-07-03 2014-10-22 曹建楠 Code evaluation method, device and system for teaching
CN104391792A (en) * 2014-11-27 2015-03-04 北京国双科技有限公司 Test environment information processing method, device and system
CN104536890A (en) * 2014-12-26 2015-04-22 小米科技有限责任公司 Testing system, method and device
CN104536899A (en) * 2015-01-20 2015-04-22 成都益联科创科技有限公司 Software deploying and maintaining method based on intelligent cluster

Also Published As

Publication number Publication date
CN106294113A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN106294113B (en) creation method and device based on programmable test service
CN111680253B (en) Page application data packet generation method and device, computer equipment and storage medium
CN101571809A (en) Implementation method of plug-in registration and device thereof
CN111399840B (en) Module development method and device
CN111897623B (en) Cluster management method, device, equipment and storage medium
CN111767226B (en) Cloud computing platform resource testing method, system and equipment
CN110673923A (en) XWIKI system configuration method, system and computer equipment
US10803166B1 (en) Automated determination of application privileges
CN107391182B (en) Generation method, device, server and storage medium of theme installation package
CN108255708A (en) Method, apparatus, storage medium and the equipment of production file are accessed in test environment
CN107798064A (en) Page processing method, electronic equipment and computer-readable recording medium
CN109542754B (en) Access method of mobile equipment, debugging method, device and system of application program
CN113885935A (en) Resource packaging method and device, electronic equipment and computer readable storage medium
CN109857432A (en) A kind of hot update method and device of game application
CN117112060A (en) Component library construction method and device, electronic equipment and storage medium
CN104252413A (en) Automatic script generation method, device and system
CN106775916B (en) Method and device for reducing application installation packages and electronic equipment
CN111240987B (en) Method and device for detecting migration program, electronic equipment and computer readable storage medium
CN112860507A (en) Method and device for controlling sampling rate of distributed link tracking system
CN111679828A (en) Data processing method and device, electronic equipment and storage medium
CN112689199B (en) Plug-in loading method and device for television homepage, television and storage medium
CN111708519B (en) Service component processing method, device, equipment and storage medium
CN110502251B (en) Application installation method and device
CN111367512B (en) Method and device for creating Android library module dependency relationship in application development
CN114064176A (en) View interaction method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201012

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20201012

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.