CN115080424A - Service instance testing method and device - Google Patents

Service instance testing method and device Download PDF

Info

Publication number
CN115080424A
CN115080424A CN202210741581.9A CN202210741581A CN115080424A CN 115080424 A CN115080424 A CN 115080424A CN 202210741581 A CN202210741581 A CN 202210741581A CN 115080424 A CN115080424 A CN 115080424A
Authority
CN
China
Prior art keywords
control layer
test case
target control
code
service
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.)
Pending
Application number
CN202210741581.9A
Other languages
Chinese (zh)
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202210741581.9A priority Critical patent/CN115080424A/en
Publication of CN115080424A publication Critical patent/CN115080424A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to the technical field of data processing, and provides a service instance testing method and device. The method comprises the following steps: performing byte code enhancement on a target control layer in a project to increase an external access interface of the target control layer; and sending the test case to the target control layer through the external access interface for testing to obtain a test result. The service instance testing method provided by the embodiment of the application can reduce redundant codes and improve the service instance testing efficiency.

Description

Service instance testing method and device
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for testing a service instance.
Background
With the development of computer technology, most services are performed online, and before the services are performed online, test cases related to the services need to be tested, so as to improve the stability of the services after the services are online. In the existing example test for the service, a Quartz framework is mostly used for implementing the execution of the test example. And the execution of the test case is realized by utilizing the Quartz framework, the specified time needs to be set, and then the execution state and the result of the test case are tested by continuously polling the change of the table field of the database. At this time, a cron expression needs to be configured for the code to be produced, so that redundant codes appear, and a certain delay exists through polling, which affects the efficiency of the service instance test.
Disclosure of Invention
The present application is directed to solving at least one of the technical problems occurring in the related art. Therefore, the application provides a service instance testing method, which can reduce redundant codes and improve the service instance testing efficiency.
The application also provides a service instance testing device.
The application also provides an electronic device.
The present application also provides a computer-readable storage medium.
An example test method for a service according to an embodiment of the first aspect of the present application includes:
performing byte code enhancement on a target control layer in a project to increase an external access interface of the target control layer;
and sending the test case to the target control layer through the external access interface for testing to obtain a test result.
According to the service instance testing method provided by the embodiment of the application, the byte code enhancement is carried out on the control layer, an externally accessible interface is added to the enhanced control layer, and the interface is used for sending the test instance to the target control layer for testing, so that the externally accessible interface is only executed in a testing environment in an enhanced mode, the codes put into production cannot be affected, the project codes and the enhancement are separated, the generation of redundant codes is avoided, and the safety and the reliability are improved. Meanwhile, the enhanced externally accessible interface is used for directly calling the test case, so that the test case can be executed after calling without delay waiting.
According to an embodiment of the present application, the performing byte code enhancement on a target control layer in a project to enable the target control layer to add an external access interface includes:
acquiring a target control layer of which the current task amount is smaller than a preset task amount from each control layer of the project;
and carrying out byte code enhancement on the target control layer.
According to an embodiment of the present application, performing bytecode enhancement on the target control layer includes:
and according to the Javaagent, performing byte code enhancement on the target control layer.
According to an embodiment of the present application, the sending the test case to the target control layer through the external access interface for testing includes:
and sending the class name of the test case to the external access interface so that the target control layer calls the test case to test according to the class name.
According to an embodiment of the present application, further comprising:
acquiring a corresponding code running path when any service is executed;
according to each code running path corresponding to each service, acquiring a task group corresponding to any code running path from each service;
and generating a test case capable of covering one type of code running path according to task execution data in the task group.
According to an embodiment of the present application, further comprising:
determining that the test result is the test case fault, and acquiring performance monitoring data and log data under the fault state of the test case;
and inputting the performance monitoring data and the log data into a trained data analysis model, and determining the code fault position in the test case.
According to an embodiment of the present application, inputting the performance monitoring data and the log data into a trained data analysis model, and determining a code fault location in the test case includes:
inputting the performance monitoring data and the log data into a trained data analysis model, and acquiring a first code operation logic of the test case in a normal state;
and comparing the first code operation logic with a second code operation logic acquired under the fault state of the test case, and determining the fault position of the code in the test case.
An example test apparatus for a service according to an embodiment of the second aspect of the present application includes:
the byte code enhancement module is used for carrying out byte code enhancement on a target control layer in a project so as to increase an external access interface of the target control layer;
and the test result acquisition module is used for sending a test case to the target control layer through the external access interface for testing to acquire a test result.
The electronic device according to the third aspect of the present application includes a processor and a memory storing a computer program, and when the processor executes the computer program, the processor implements the example testing method for the service according to any of the embodiments.
A computer-readable storage medium according to a fourth aspect of the present application, having stored thereon a computer program which, when executed by a processor, implements a method for instance testing of a service according to any of the embodiments described above.
The computer program product according to an embodiment of the fifth aspect of the application comprises: the computer program, when executed by a processor, implements a method for instance testing of a service as described in any of the embodiments above.
One or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
the byte code enhancement is carried out on the control layer, so that an externally accessible interface is added to the enhanced control layer, and the interface is used for sending the test case to the target control layer for testing, so that the externally accessible interface is only executed in a test environment in an enhanced mode, the code of the production cannot be affected, the project code is separated from the enhancement, the generation of redundant codes is avoided, and the safety and the reliability are improved. Meanwhile, the enhanced externally accessible interface is used for directly calling the test case, so that the test case can be executed after calling without delay waiting.
Furthermore, the control layer with the current task amount smaller than the preset task amount is selected from the control layers to be used as a target control layer to carry out byte code enhancement, so that the target control layer for obtaining the test case can carry out case test more quickly, and the test efficiency is improved.
Further, bytecode enhancement is carried out through a Javaagent bytecode enhancement technology, so that bytecode enhancement can be more flexible, and only a java agent is added to a startup script, wherein xxx is xxx.
Furthermore, after the code running paths corresponding to the services are grouped to form a task group, the task execution data of each service in the task group in the execution process is generated to generate a test case capable of covering the code running paths of the task group, so that the generated test case can cover at least one type of code running paths, and the generation efficiency and the code coverage rate of the test case are further effectively improved.
Furthermore, a first code running logic of the test case in a normal state is determined by using the trained data analysis model, and the first code running logic is compared with a second code running logic obtained in a fault state of the test case to determine the code fault position in the test case, so that when the test result of the test case is a fault, a fault point can be quickly found for repairing.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow diagram illustrating an example method for testing services provided by an embodiment of the present application;
FIG. 2 is a schematic diagram of interaction between Javaagent and project provided by the embodiment of the present application;
FIG. 3 is a flow diagram illustrating an example method for testing services provided by another embodiment of the present application;
FIG. 4 is a flow diagram illustrating an example method for testing services provided by another embodiment of the present application;
FIG. 5 is a schematic diagram of an example testing apparatus for services provided by embodiments of the present application;
fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Hereinafter, an example testing method and an example testing device for services provided by the embodiments of the present application will be described and explained in detail through several specific embodiments.
In the existing example test for the service, a Quartz framework is mostly used for implementing the execution of the test example. When a Quartz framework is used for executing a test case, if a test case needs to be tested, a cron expression needs to be configured for a code to be produced, and the cron expression is operated according to specified time. According to different service implementation modes, when the Quartz framework is used for executing the test cases, the execution time of the test cases is modified and the service needs to be restarted sometimes, so that a large amount of time is wasted. Furthermore, what is currently being undertaken for Quartz implemented timed instance test tasks is to modify a specified execution time and then test the execution status and results of the timed instance test task by continually polling the database for changes in table fields. However, by modifying the time, the modified time needs the scheduler in the Quartz framework to be valid next time, that is, if the test task is being executed, if the next test task is set to be executed in the next minute at this time, the next test task will be executed in the next minute at the next day, and the execution state is not controllable. Secondly, the change of the table field of the polling database is used for detecting that the result of the test case has certain time delay, the result cannot be directly and immediately obtained, and if the execution fails, the polling is stopped until the set overtime, so that the checking efficiency of the test result is low, and the test efficiency of the service case is influenced.
In order to improve the efficiency of testing the service instance, an http interface can be added to the control layer of the project when the Spring project is constructed, so that the control layer can acquire the test instance at any time through the http interface to test, and the efficiency of testing the service instance is improved. However, if an http interface is to be added at build time, the code to be shipped needs to be modified, which is intrusive and also presents many redundant codes.
In order to solve the above problem, in an embodiment, a method for testing an instance of a service is provided, and the method is applied to a server and used for testing the instance of the service. The server can be an independent server or a server cluster formed by a plurality of servers, and can also be a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (content delivery network), big data and artificial intelligence sampling point equipment and the like.
As shown in fig. 1, the method for testing an instance of a service provided by this embodiment includes:
101, performing byte code enhancement on a target control layer in a project to increase an external access interface of the target control layer;
and 102, sending a test case to the target control layer through the external access interface for testing, and acquiring a test result.
The byte code enhancement is carried out on the control layer, so that an externally accessible interface is added to the enhanced control layer, and the interface is used for sending the test case to the target control layer for testing, so that the externally accessible interface is only executed in a test environment in an enhanced mode, the code of the production cannot be affected, the project code is separated from the enhancement, the generation of redundant codes is avoided, and the safety and the reliability are improved. Meanwhile, the enhanced externally accessible interface is used for directly calling the test case, so that the test case can be executed after calling without delay waiting,
in addition, automated cases can be quickly written. Originally, the automatic execution of a test case is required to be realized, the execution time needs to be modified in advance, the system test needs to be avoided, the normal system test cannot be influenced, and sometimes, the automatic test case needs to be executed after manual restart. And the byte code enhancement is carried out on the target control layer, so that the interface can be called at any time for execution, the appointed execution time does not need to be configured, the test case does not need to be executed after the restart, and the test efficiency of the service case is greatly improved.
In an embodiment, the project may be a SpringBoot project, which includes a DAO layer, a Service layer, and a controller layer. The DAO layer, i.e. the data access layer, belongs to a comparison bottom layer, and compares basic operations, specifically to the add-delete modify-check of a certain table. The Service layer is a Service layer, and is to encapsulate one or more DAOs into one Service. And the controller layer is used for requesting and forwarding, receiving the parameters from the page, transmitting the parameters to the service layer for processing, receiving a return value and transmitting the return value to the page. The control layer mainly calls an interface in the service layer to control a specific business process, and the configuration of the control layer is also carried out in a configuration file.
A plurality of control layers are typically provided in a project, and a target control layer may be determined from the plurality of control layers. For example, the user may designate a control layer from among the plurality of control layers, thereby determining the designated control layer as the target control layer. After the target control layer is determined, the target control layer is enhanced through a byte code enhancement technology, so that an externally accessible http interface is added to the enhanced target control layer, and the interface can acquire the spring container context, so that the test case can be acquired. Because the target control layer is added with an externally accessible http interface in a byte code enhancement mode, the enhancement is non-intrusive, the code to be produced does not need to be modified, and code redundancy is not caused.
In order to improve the efficiency of subsequent testing, in an embodiment, the performing byte code enhancement on the target control layer in the project to increase an external access interface of the target control layer includes:
acquiring a target control layer of which the current task amount is smaller than a preset task amount from each control layer of the project;
and carrying out byte code enhancement on the target control layer.
In an embodiment, each control layer is detected, and the current task amount of the instance test task currently executed by each control layer is obtained. And if the current task amount of a certain control layer is smaller than the preset task amount, taking the control layer as a target control layer. If the current task quantity of the control layers is smaller than the preset task quantity, one control layer can be randomly selected from the control layers with the current task quantity smaller than the preset task quantity to serve as a target control layer. The preset task amount can be set according to an actual situation, for example, the preset task amount is set to 0, which indicates that the control layer is in an idle state, and at this time, when a control layer is detected to be in the idle state, the control layer is determined as a target control layer.
And when detecting that the current task quantities of all the control layers are larger than the preset task quantity, randomly selecting one control layer as a target control layer.
After the target control layer is obtained, the byte code enhancement can be carried out on the target control layer.
The control layer with the current task amount smaller than the preset task amount is selected from the control layers to serve as a target control layer to carry out byte code enhancement, so that the target control layer for obtaining the test case can carry out case test more quickly, and the test efficiency is improved.
In one embodiment, the target control layer may be bytecode-enhanced according to Javaagent. Specifically, adding-Java agnet, my, jar and the like through a start command, wherein the name of the enhanced control layer class is specified, for example, adding Java, myagnet, jar and the com, pingan, appcontroller, jar and the like through the start command to enhance the controller class of the target control layer, so that the target control layer is added with an http interface for external access.
Bytecode enhancement is carried out through a Javaagent bytecode enhancement technology, so that the bytecode enhancement can be more flexible, and only a controller class which needs to be enhanced needs to be added into a startup script, wherein the controller class is xxx.
After the target control layer is added with the http interface for external access, the test case can be sent to the target control layer added with the http interface for external access at any time for testing, and the protector sends the class name of the test case to the external access interface, so that the target control layer calls the test case for testing according to the class name.
In an embodiment, as shown in fig. 2, a Spring project includes a plurality of control layers and class names of test cases to be tested, bytecode enhancement is performed on a target control layer specified in each control layer through java agent, so that after an http interface for external access is added, the class names of the test cases are transmitted to the target control layer through the http interface for external access, that is, the corresponding test cases can be directly called through the target control layer according to the class names for testing without configuring specified execution time, and calling and executing are performed.
After completing the execution of the test case, the server waits for the return of the test result, and the returned test result contains the execution state of the test case. If the test result fails, the failure reason is returned, and the checking efficiency of the test result is greatly improved.
In the testing process, in order to improve the production efficiency and the code coverage rate of the test case, in an embodiment, as shown in fig. 3, the generating of the test case includes:
step 201, acquiring a corresponding code running path when executing any service;
step 202, acquiring a task group corresponding to any code operation path from each service according to each code operation path corresponding to each service;
step 203, generating a test case capable of covering one type of the code running path according to the task execution data in the task group.
In one embodiment, a service corresponds to an input parameter during execution, and when at least the service is executed, task execution data of a task is output for the service. In the service execution process, the execution process of the service is recorded to collect a code operation path corresponding to the service. Wherein, the code running path is the code running process of the server in the process of executing the service. The code run process may be reflected in the dimensions of the code line number, the function used or CLASS loaded. After collecting the code operation paths corresponding to each service, classifying the services according to the code operation paths, and dividing the services with the consistent code operation paths into the same task group, so that N code operation paths corresponding to N task groups one by one can be divided, wherein N is a positive integer.
After the tasks of each service in the task group are executed in the execution process after the tasks are grouped to form the task group through each code operation path corresponding to each service, a test case capable of covering the code operation path of the task group is generated, so that the generated test case can cover at least one type of code operation path, and the generation efficiency and the code coverage rate of the test case are effectively improved.
In order to quickly locate the fault location of the code when the test result of the test case has a problem, so as to facilitate repair, in an embodiment, as shown in fig. 4, in addition to the steps shown in fig. 1, the method further includes:
step 301, determining that the test result is the test case fault, and acquiring performance monitoring data and log data of the test case in a fault state;
step 302, inputting the performance monitoring data and the log data into a trained data analysis model, and determining a code fault position in the test case.
In one embodiment, the data analysis model is trained from performance monitoring data and log data acquired at runtime of a large number of test case samples. Illustratively, performance monitoring data and log data of any test case sample during operation are collected through a byte code technology, then the collected performance monitoring data and log data of all the test case samples are input into a data analysis model, training is carried out through a convolutional neural network in the data analysis model, and prediction code operation logic of each test case sample is output. And if the predicted code operation logic of each test case sample is different from the actual code operation logic of the test case sample, adjusting parameters in the data analysis model until the performance monitoring data and the log data of any test case sample are input into the data analysis model, and finishing the training of the data analysis model if the predicted code operation logic output by the data analysis model is the same as the actual code operation logic of the test case sample. Wherein the test case sample is a positive sample, i.e., a test sample without a code failure.
After the training of the data analysis model is completed, when the test result of a certain test case is a fault, collecting performance monitoring data and log data of the test case in a fault state, inputting the performance monitoring data and the log data into the trained data analysis model, and determining the code fault position in the test case.
Specifically, inputting the performance monitoring data and the log data into a trained data analysis model, and determining a code fault location in the test case includes:
inputting the performance monitoring data and the log data into a trained data analysis model, and acquiring a first code operation logic of the test case in a normal state;
and comparing the first code operation logic with a second code operation logic acquired under the fault state of the test case, and determining the fault position of the code in the test case.
In one embodiment, after the performance monitoring data and the log data of the test case are input into a trained data analysis model, the performance monitoring data and the log data are classified by the data analysis model, and the first code operation logic of the test case in a normal state is output. Meanwhile, second code operation logic of the test case in the fault state is obtained, then the first code operation logic is compared with the second code operation logic, a code segment different from the second code operation logic is determined from the first code operation logic, and therefore the position of the code segment is determined as the code fault position in the test case.
The method comprises the steps of determining a first code running logic of a test case in a normal state by using a trained data analysis model, comparing the first code running logic with a second code running logic obtained in a fault state of the test case, and determining a code fault position in the test case, so that when a test result of the test case is a fault, a fault point can be quickly found for repairing.
The following describes an example testing device for a service provided by the present application, and the example testing device for a service described below and the example testing method for a service described above may be referred to correspondingly.
In one embodiment, as shown in FIG. 5, there is provided an example test apparatus for a service, comprising:
the bytecode enhancement module 210 is configured to perform bytecode enhancement on a target control layer in a project, so that the target control layer is provided with an external access interface;
the test result obtaining module 220 is configured to send the test case to the target control layer through the external access interface to perform a test, and obtain a test result.
The byte code enhancement is carried out on the control layer, so that an externally accessible interface is added to the enhanced control layer, and the interface is used for sending the test case to the target control layer for testing, so that the externally accessible interface is only executed in a test environment in an enhanced mode, the code of the production cannot be affected, the project code is separated from the enhancement, the generation of redundant codes is avoided, and the safety and the reliability are improved. Meanwhile, the enhanced externally accessible interface is used for directly calling the test case, so that the test case can be executed after calling without delay waiting.
In an embodiment, the bytecode augmentation module 210 is specifically configured to:
acquiring a target control layer of which the current task amount is smaller than a preset task amount from each control layer of the project;
and carrying out byte code enhancement on the target control layer.
The control layer with the current task amount smaller than the preset task amount is selected from the control layers to serve as a target control layer to carry out byte code enhancement, so that the target control layer for obtaining the test case can carry out case test more quickly, and the test efficiency is improved.
In an embodiment, the bytecode augmentation module 210 is specifically configured to:
and performing byte code enhancement on the target control layer according to the Javaagent.
Bytecode enhancement is carried out through a Javaagent bytecode enhancement technology, so that the bytecode enhancement can be more flexible, and only a controller class which needs to be enhanced needs to be added into a startup script, wherein the controller class is xxx.
In an embodiment, the test result obtaining module 220 is specifically configured to:
and sending the class name of the test case to the external access interface so that the target control layer calls the test case to test according to the class name.
In an embodiment, the test result obtaining module 220 is further configured to:
acquiring a corresponding code running path when any service is executed;
acquiring a task group corresponding to any code running path from each service according to each code running path corresponding to each service;
and generating a test case capable of covering one type of code running path according to task execution data in the task group.
After the tasks of each service in the task group are executed in the execution process after the tasks are grouped to form the task group through each code operation path corresponding to each service, a test case capable of covering the code operation path of the task group is generated, so that the generated test case can cover at least one type of code operation path, and the generation efficiency and the code coverage rate of the test case are effectively improved.
In an embodiment, the test result obtaining module 220 is further configured to:
determining that the test result is the test case fault, and acquiring performance monitoring data and log data under the fault state of the test case;
and inputting the performance monitoring data and the log data into a trained data analysis model, and determining the code fault position in the test case.
In an embodiment, the test result obtaining module 220 is specifically configured to:
inputting the performance monitoring data and the log data into a trained data analysis model, and acquiring a first code operation logic of the test case in a normal state;
and comparing the first code operation logic with a second code operation logic acquired under the fault state of the test case, and determining the fault position of the code in the test case.
The method comprises the steps of determining a first code running logic of a test case in a normal state by using a trained data analysis model, comparing the first code running logic with a second code running logic obtained in a fault state of the test case, and determining a code fault position in the test case, so that when a test result of the test case is a fault, a fault point can be quickly found for repairing.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: a processor (processor)810, a Communication Interface 820, a memory 830 and a Communication bus 840, wherein the processor 810, the Communication Interface 820 and the memory 830 communicate with each other via the Communication bus 840. The processor 810 may invoke computer programs in the memory 830 to perform instance test methods for services, including, for example:
performing byte code enhancement on a target control layer in a project to increase an external access interface of the target control layer;
and sending the test case to the target control layer through the external access interface for testing to obtain a test result.
In addition, the logic instructions in the memory 830 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present application further provides a storage medium, where the storage medium includes a computer program, where the computer program is storable on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, a computer can perform an example testing method for a service provided in the foregoing embodiments, for example, the method includes:
performing byte code enhancement on a target control layer in a project to increase an external access interface of the target control layer;
and sending the test case to the target control layer through the external access interface for testing to obtain a test result.
On the other hand, embodiments of the present application further provide a processor-readable storage medium, where a computer program is stored in the processor-readable storage medium, where the computer program is configured to cause a processor to execute the method provided in each of the above embodiments, for example, the method includes:
performing byte code enhancement on a target control layer in a project to increase an external access interface of the target control layer;
and sending the test case to the target control layer through the external access interface for testing to obtain a test result.
The processor-readable storage medium can be any available medium or data storage device that can be accessed by a processor, including but not limited to magnetic memory (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical memory (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor memory (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND FLASH), Solid State Disks (SSDs)), etc.
The above-described embodiments of the apparatus are merely illustrative, and units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method for instance testing of a service, comprising:
performing byte code enhancement on a target control layer in a project to increase an external access interface of the target control layer;
and sending the test case to the target control layer through the external access interface for testing to obtain a test result.
2. The method for testing the instance of the service according to claim 1, wherein the byte-code enhancing the target control layer in the project to enable the target control layer to add an external access interface comprises:
acquiring a target control layer of which the current task amount is smaller than a preset task amount from each control layer of the project;
and carrying out byte code enhancement on the target control layer.
3. The method of claim 2, wherein performing bytecode enhancement on the target control layer comprises:
and performing byte code enhancement on the target control layer according to the Javaagent.
4. The method according to claim 1, wherein the sending the test case to the target control layer through the outbound access interface for testing comprises:
and sending the class name of the test case to the external access interface so that the target control layer calls the test case to test according to the class name.
5. The method for instance testing of a service of claim 1, further comprising:
acquiring a corresponding code running path when any service is executed;
acquiring a task group corresponding to any code running path from each service according to each code running path corresponding to each service;
and generating a test case capable of covering one type of the code running path according to the task execution data in the task group.
6. The method of instance testing of a service according to any of claims 1-5, further comprising:
determining that the test result is the test case fault, and acquiring performance monitoring data and log data under the fault state of the test case;
and inputting the performance monitoring data and the log data into a trained data analysis model, and determining the code fault position in the test case.
7. The method of claim 6, wherein inputting the performance monitoring data and the log data into a trained data analysis model to determine a location of a code failure in the test case comprises:
inputting the performance monitoring data and the log data into a trained data analysis model, and acquiring a first code operation logic of the test case in a normal state;
and comparing the first code operation logic with a second code operation logic acquired under the fault state of the test case, and determining the fault position of the code in the test case.
8. An apparatus for instance testing of a service, comprising:
the byte code enhancement module is used for carrying out byte code enhancement on a target control layer in a project so as to increase an external access interface of the target control layer;
and the test result acquisition module is used for sending the test case to the target control layer through the external access interface for testing and acquiring a test result.
9. An electronic device comprising a processor and a memory storing a computer program, wherein the processor implements the method of testing an instance of a service of any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method for instance testing of a service according to any one of claims 1 to 7.
CN202210741581.9A 2022-06-27 2022-06-27 Service instance testing method and device Pending CN115080424A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210741581.9A CN115080424A (en) 2022-06-27 2022-06-27 Service instance testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210741581.9A CN115080424A (en) 2022-06-27 2022-06-27 Service instance testing method and device

Publications (1)

Publication Number Publication Date
CN115080424A true CN115080424A (en) 2022-09-20

Family

ID=83255479

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210741581.9A Pending CN115080424A (en) 2022-06-27 2022-06-27 Service instance testing method and device

Country Status (1)

Country Link
CN (1) CN115080424A (en)

Similar Documents

Publication Publication Date Title
CN109189665B (en) Method and device for recording, replaying and automatically testing data
US20110179398A1 (en) Systems and methods for per-action compiling in contact handling systems
CN111124919A (en) User interface testing method, device, equipment and storage medium
CN111897724B (en) Automatic testing method and device suitable for cloud platform
AU2019403474A1 (en) Real time application error identification and mitigation
CN108628748B (en) Automatic test management method and automatic test management system
CN110941528A (en) Log buried point setting method, device and system based on fault
US20110179304A1 (en) Systems and methods for multi-tenancy in contact handling systems
CN106656927A (en) Method and device for enabling Linux account to be added to AD domain
EP4246332A1 (en) System and method for serverless application testing
US11169910B2 (en) Probabilistic software testing via dynamic graphs
CN112650676A (en) Software testing method, device, equipment and storage medium
CN114609995A (en) Fault control method, device, system, equipment, medium and product
CN116194894A (en) Fault localization of native cloud applications
CN110875832B (en) Abnormal service monitoring method, device and system and computer readable storage medium
CN116069334B (en) Cloud-protogenesis-based online development and code hosting method and system
CN115080424A (en) Service instance testing method and device
US20230297496A1 (en) System and method for serverless application testing
CN116599881A (en) Cloud platform tenant modeling test method, device, equipment and storage medium
CN112860502A (en) Fault simulation method, equipment, server and storage medium
CN115617668A (en) Compatibility testing method, device and equipment
JP2023044720A (en) Computer implemented method for recovering crashed application, computer program product, and remote computer server (remote recovery of crashed process)
CN103019927B (en) A kind of performance test methods and system
CN115167896A (en) Method and device for updating software version, storage medium and electronic equipment
Xu et al. Real-Time Diagnosis of Configuration Errors for Software of AI Server Infrastructure

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination