CN114201400A - Code debugging method and device, computer readable storage medium and server - Google Patents
Code debugging method and device, computer readable storage medium and server Download PDFInfo
- Publication number
- CN114201400A CN114201400A CN202111524742.0A CN202111524742A CN114201400A CN 114201400 A CN114201400 A CN 114201400A CN 202111524742 A CN202111524742 A CN 202111524742A CN 114201400 A CN114201400 A CN 114201400A
- Authority
- CN
- China
- Prior art keywords
- test server
- server group
- target
- code
- group
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3628—Software debugging of optimised code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3664—Environments for testing or debugging software
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 invention belongs to the technical field of artificial intelligence, and particularly relates to a code debugging method and device, a computer readable storage medium and a server. The method comprises the steps that a bridge server obtains a test environment code debugging instruction sent by code source equipment; searching a corresponding target service interface configuration file in a preset configuration file library according to the target service interface identifier in the test environment code debugging instruction; selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file; and calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group, and sending the debugging result to the code source equipment. According to the invention, the bridge server is preset between the code source equipment and the test environment, so that the complex process of packaging and deploying codes is omitted, and the code debugging efficiency is greatly improved.
Description
Technical Field
The invention belongs to the technical field of artificial intelligence, and particularly relates to a code debugging method and device, a computer readable storage medium and a server.
Background
In the process of developing codes for system software or application software, a development environment and a test environment need to be used, the development environment and the test environment are usually isolated from each other, a developer generally needs to write codes in the development environment, when the written codes need to be debugged, the codes need to be packaged and deployed in the test environment, then debugging work is performed in the test environment, and the packaging and deployment process needs to take a long time. Moreover, in the fast-paced development process, the codes are frequently changed, and the changed codes need to be packaged and deployed again after each change, so that a large amount of repetitive labor of developers is caused, and the efficiency is extremely low.
Disclosure of Invention
In view of this, embodiments of the present invention provide a code debugging method, a code debugging device, a computer-readable storage medium, and a server, so as to solve the problem that the existing code debugging method is low in efficiency.
A first aspect of an embodiment of the present invention provides a code debugging method, which may include:
acquiring a test environment code debugging instruction sent by a code source device;
searching a corresponding target service interface configuration file in a preset configuration file library according to the target service interface identifier in the test environment code debugging instruction;
selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file;
and calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group, and sending the debugging result to the code source equipment.
In a specific implementation manner of the first aspect, the invoking the target test server group to debug the target code, and obtaining a debugging result output by the target test server group may include:
acquiring a first service logic execution sequence of each test server in the target test server group from the target service interface configuration file;
sequentially calling each test server in the target test server group according to the execution sequence of the first service logic to debug the target code;
and taking the output of the last test server in the target test server group as the debugging result.
In a specific implementation manner of the first aspect, the code debugging method may further include:
acquiring the execution states of all the test servers in the target test server group and summarizing the execution states to form an execution set;
if the execution set comprises an execution state with abnormal content, setting the target test server group as an abnormal group;
selecting a replacement test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file;
and transferring the code debugging task which is being executed in the abnormal group to the replacement test server group to be continuously executed.
In a specific implementation manner of the first aspect, the transferring the code debugging task being executed in the exception group to the replacement test server group for continued execution may include:
determining the rest tasks of the code debugging task according to the position of an abnormal server in the first service logic execution sequence; the abnormal server is a test server with abnormal execution state content in the target test server group;
acquiring a second service logic execution sequence of each test server in the replacement test server group from the target service interface configuration file;
selecting a subgroup corresponding to the remaining tasks from the replacement test server group according to the second service logic execution sequence;
and sequentially calling each test server in the subgroup according to the execution sequence of the second service logic to debug the target code.
In a specific implementation manner of the first aspect, the selecting a target test server group in the test environment according to the test server group identifier set and the group selection manner in the target service interface configuration file may include:
if the group selection mode is a preset first value, randomly selecting the target test server group from each candidate test server group according to a preset random selection probability; wherein each of the candidate test server groups corresponds to a test server group identity in the set of test server group identities;
and if the group selection mode is a preset second value, selecting the target test server group in each candidate test server group according to a preset polling sequence.
In a specific implementation manner of the first aspect, the randomly selecting the target test server group from the candidate test server groups according to a preset random selection probability may include:
setting numerical value intervals respectively corresponding to the candidate test server groups according to the random selection probability;
generating a random number using a preset pseudo random number generator;
taking a candidate test server group corresponding to the target value interval as the target test server group; the target value interval is the value interval in which the random number is located.
In a specific implementation manner of the first aspect, before randomly selecting the target test server group from the candidate test server groups according to a preset random selection probability, the method may further include:
respectively calculating the average task execution duration of each candidate test server group according to a preset historical task execution record;
and respectively setting random selection probability corresponding to the average task execution duration for each candidate test server group.
A second aspect of an embodiment of the present invention provides a code debugging apparatus, which may include:
the code debugging instruction acquisition module is used for acquiring a testing environment code debugging instruction sent by the code source equipment;
the interface configuration file searching module is used for searching a corresponding target service interface configuration file in a preset configuration file library according to the target service interface identifier in the test environment code debugging instruction;
the test server group selection module is used for selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file;
and the code debugging module is used for calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group and sending the debugging result to the code source equipment.
In a specific implementation manner of the second aspect, the code debugging module may specifically include:
a first execution sequence obtaining unit, configured to obtain, from the target service interface configuration file, a first service logic execution sequence of each test server in the target test server group;
the first code debugging unit is used for sequentially calling each test server in the target test server group according to the execution sequence of the first service logic to debug the target code;
and the debugging result acquisition unit is used for taking the output of the last test server in the target test server group as the debugging result.
In a specific implementation manner of the second aspect, the code debugging module may further include:
the execution set acquisition unit is used for acquiring the execution states of all the test servers in the target test server group and summarizing the execution states to form an execution set;
an abnormal group setting unit, configured to set the target test server group as an abnormal group if the execution set includes an execution state in which the content is abnormal;
a replacement test server group selecting unit, configured to select a replacement test server group in the test environment according to the test server group identifier set and the group selection manner in the target service interface configuration file;
and the debugging task transferring unit is used for transferring the code debugging task which is being executed in the abnormal group to the replacement test server group to be continuously executed.
In a specific implementation manner of the second aspect, the debugging task transferring unit may be specifically configured to: determining the rest tasks of the code debugging task according to the position of an abnormal server in the first service logic execution sequence; the abnormal server is a test server with abnormal execution state content in the target test server group; acquiring a second service logic execution sequence of each test server in the replacement test server group from the target service interface configuration file; selecting a subgroup corresponding to the remaining tasks from the replacement test server group according to the second service logic execution sequence; and sequentially calling each test server in the subgroup according to the execution sequence of the second service logic to debug the target code.
In a specific implementation manner of the second aspect, the test server group selecting module may specifically include:
a random selection unit, configured to randomly select the target test server group from the candidate test server groups according to a preset random selection probability if the group selection manner is a preset first value; wherein each of the candidate test server groups corresponds to a test server group identity in the set of test server group identities;
and the polling selection unit is used for selecting the target test server group in each candidate test server group according to a preset polling sequence if the group selection mode is a preset second value.
In a specific implementation manner of the second aspect, the random selection unit may be specifically configured to: setting numerical value intervals respectively corresponding to the candidate test server groups according to the random selection probability; generating a random number using a preset pseudo random number generator; taking a candidate test server group corresponding to the target value interval as the target test server group; the target value interval is the value interval in which the random number is located.
In a specific implementation manner of the second aspect, the test server group selecting module may be further specifically configured to: respectively calculating the average task execution duration of each candidate test server group according to a preset historical task execution record; and respectively setting random selection probability corresponding to the average task execution duration for each candidate test server group.
A third aspect of the embodiments of the present invention provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of any one of the code debugging methods described above.
A fourth aspect of the embodiments of the present invention provides a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of any one of the code debugging methods when executing the computer program.
A fifth aspect of embodiments of the present invention provides a computer program product, which, when run on a server, causes the server to perform the steps of any of the code debugging methods described above.
Compared with the prior art, the embodiment of the invention has the following beneficial effects: the method comprises the steps that a testing environment code debugging instruction sent by code source equipment is obtained through a bridge server; searching a corresponding target service interface configuration file in a preset configuration file library according to the target service interface identifier in the test environment code debugging instruction; selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file; and calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group, and sending the debugging result to the code source equipment. According to the embodiment of the invention, the bridge server is preset between the code source equipment and the test environment, and the test server group in the test environment is directly called to debug the target code according to the test environment code debugging instruction sent by the code source equipment, so that the complex process of packaging and deploying the code is omitted, and the code debugging efficiency is greatly improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart of an embodiment of a method for debugging code according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of selecting a target test server group in a test environment according to a test server group identification set and a group selection manner in a target service interface configuration file;
FIG. 3 is a block diagram of an embodiment of a code debugging apparatus according to an embodiment of the present invention;
fig. 4 is a schematic block diagram of a server according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the 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 invention.
The embodiment of the invention can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
The execution subject of the embodiment of the present invention may be an artificial intelligence-based server, and is configured to execute the code debugging method in the embodiment of the present invention in a bridge connection manner, and for convenience of distinction, the execution subject is marked as a bridge server. The bridge server may be an independent server, or may be a cloud server that provides 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, Content Delivery Network (CDN), big data and an artificial intelligence platform.
Referring to fig. 1, an embodiment of a code debugging method according to an embodiment of the present invention may include:
step S101, a test environment code debugging instruction sent by code source equipment is obtained.
In the embodiment of the present invention, a code to be debugged may be recorded as an object code, and the code source device is a terminal device where the object code is located, and is generally a terminal device used by a developer when writing the code.
Generally, in the process of code Development of system software or application software, a Development Environment (Development Environment) and a Testing Environment (Testing Environment) are used.
The development environment is a set of software used for supporting engineering development and maintenance of system software and application software on the basis of basic hardware and digital software, and is composed of a software tool and an environment integration mechanism, wherein the former is used for supporting related processes, activities and tasks of software development, and the latter provides uniform support for tool integration and development, maintenance and management of software. The code source device is located in the development environment.
The test environment refers to the description of the software and hardware environment on which the test runs, and any other software interacting with the software under test, including computer hardware, software, network devices, test data, drivers, stubs, and the like, necessary to complete the software test work.
Typically, the development environment and the test environment are isolated from each other, and services in the test environment cannot be directly invoked in the development environment.
The test environment code debugging instruction comprises a target service interface identifier, and the target service interface identifier is the identifier of a service interface in the test environment, which is required to be called by the target code in the debugging process. It should be noted that each service interface identifier in the test environment is unique in the test environment, and therefore, the corresponding service interface can be uniquely determined according to the identifier.
When a developer needs to perform code debugging, the test environment code debugging instruction may be sent to the bridge server through the code source device, and the bridge server may receive the test environment code debugging instruction sent by the code source device and extract a target service interface identifier included therein.
Step S102, according to the target service interface identification in the test environment code debugging instruction, searching a corresponding target service interface configuration file in a preset configuration file library.
All service interface configuration files are stored in the configuration file library, and each service interface in the test environment has a unique service interface configuration file corresponding to the service interface.
For each service interface configuration file, the service interface configuration file may include a service interface identifier, a set of test server group identifiers, and a group selection manner.
In the test environment, a plurality of test server groups can be preset, each test server group comprises at least one test server, and each test server group has a unique test server group identifier corresponding to the test server group identifier in the test environment, so that the corresponding test server group can be uniquely determined according to the identifier. The number of the test server groups and the number of the test servers included in each test server group can be set according to actual conditions, and the embodiment of the invention does not specifically limit the number.
For each service interface, at least one test server group should be used to provide the corresponding service, and preferably, in order to cope with a possible failure of the test server group, in a specific implementation manner of the embodiment of the present invention, each service interface may be provided with the corresponding service by at least two test server groups, and therefore, each service interface identifier may correspond to a set of test server group identifiers, where the set includes at least two test server group identifiers.
Preferably, the services provided by the test server group are not fixed, but can be flexibly adjusted according to actual situations, for example, a certain test server group can be set to provide one service in a certain period of time, the test server group can be set to provide another service in another period of time, and developers only need to correspondingly modify the service interface configuration file.
Step S103, selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file.
The group selection mode may be set according to an actual situation, which is not specifically limited in the embodiment of the present invention.
In a specific implementation manner of the embodiment of the present invention, if the group selection manner is a preset first value, the target test server group is randomly selected from each candidate test server group according to a preset random selection probability, where each candidate test server group corresponds to one test server group identifier in the test server group identifier set. For example, if the test server group identifier set has 3 test server group identifiers in total, which are respectively recorded as a test server group identifier 1, a test server group identifier 2, and a test server group identifier 3, the test server group corresponding to the test server group identifier 1 is recorded as a test server group a, the test server group corresponding to the test server group identifier 2 is recorded as a test server group B, and the test server group corresponding to the test server group identifier 3 is recorded as a test server group C, then the test server group a, the test server group B, and the test server group C are all candidate test server groups.
The random selection probability may be set according to an actual situation, which is not specifically limited in the embodiment of the present invention.
Preferably, the corresponding random selection probability may be set according to the task processing capability of each test server group, and the random selection probability and the task processing capability of each test server group are in a positive correlation, that is, the stronger the task processing capability of a certain test server group is, the larger the corresponding random selection probability is, and conversely, the weaker the task processing capability of a certain test server group is, the smaller the corresponding random selection probability is. The task processing capacity of a test server group can be measured by the average task execution time of the processing task, that is, the longer the average task execution time of a certain test server group processing task is, the weaker the task processing capacity is, and conversely, the shorter the average task execution time of a certain test server group processing task is, the stronger the task processing capacity is. In the embodiment of the application, the average task execution duration of each candidate test server group can be respectively calculated according to a preset historical task execution record, and the random selection probability corresponding to the average task execution duration is respectively set for each candidate test server group.
For example, if there are three candidate test server groups, which are respectively the test server group a, the test server group B, and the test server group C, the order of the task processing capabilities from strong to weak is: the test server group B, the test server group A and the test server group C, the random selection probability of the test server group B is greater than that of the test server group A, the random selection probability of the test server group A is greater than that of the test server group C, and the sum of the random selection probabilities of the test server group B, the test server group A and the test server group C is 1.
Specifically, the randomly selecting the target test server group may specifically include the process shown in fig. 2:
and step S1031, setting numerical value intervals respectively corresponding to the candidate test server groups according to the random selection probability.
For example, if the random selection probability of the test server group a is 0.3, the random selection probability of the test server group B is 0.5, and the random selection probability of the test server group C is 0.2, the value interval of the test server group a may be set to [0, 0.3 ], the value interval of the test server group B may be set to [0.3, 0.8 ], and the value interval of the test server group C may be set to [0.8, 1 ].
Step S1032 generates a random number using a preset pseudo random number generator.
True random numbers are generated using physical phenomena such as coin rolls, dice, wheels, noise using electronic components, nuclear fission 25, and the like. Such random number generators are called physical random number generators and they have the disadvantage of relatively high technical requirements. In practical applications it is often sufficient to use pseudo random numbers. These series are "seemingly" random numbers, which are actually generated by a fixed, repeatable calculation. They are not truly random because they can actually be computed, but they have statistical characteristics similar to random numbers. Such a pseudo random number generator is employed in embodiments of the present invention to generate the required random numbers.
Step S1033, using the candidate test server group corresponding to the target value interval as the target test server group.
And the target numerical value interval is the numerical value interval in which the random number is positioned.
For example, if the random number is 0.13 and is within the value range [0, 0.3), the test server group a is regarded as the target test server group, if the random number is 0.55 and is within the value range [0.3, 0.8), the test server group a is regarded as the target test server group, and if the random number is 0.97 and is within the value range [0.8, 1], the test server group a is regarded as the target test server group.
And if the group selection mode is a preset second value, selecting the target test server group in each candidate test server group according to a preset polling sequence.
The polling sequence may be set according to actual situations, and this is not particularly limited in the embodiment of the present invention.
For example, if the polling sequence is: the test server group A, the test server group B and the test server group C are used for taking the test server group A as the target test server group during the first polling, taking the test server group B as the target test server group during the second polling, taking the test server group C as the target test server group during the third polling, taking the test server group A as the target test server group again during the fourth polling and so on.
The first value and the second value may be set according to an actual situation, for example, the first value may be set to 0, and the second value may be set to 1, or the first value may be set to 1 and the second value may be set to 0, and of course, the first value and the second value may also be set to other values, which is not specifically limited in this embodiment of the present invention.
Step S104, calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group, and sending the debugging result to the code source equipment.
In the embodiment of the present invention, a first service logic execution order of each test server in the target test server group may be obtained from the target service interface configuration file, each test server in the target test server group may be sequentially invoked according to the first service logic execution order to debug the target code, and finally, an output of a last test server in the target test server group is used as the debugging result, so as to implement debugging of the target code.
For example, if the target testing server group is testing server group a, which includes three testing servers, which are respectively designated as testing server a1, testing server a2 and testing server A3. The service logic execution sequence of the test server A1, the test server A2 and the test server A3 is sequentially, the test server A1 is called to execute a debugging task, then the result output by the test server A1 is input into the test server A2, the test server A2 is called to execute the debugging task, then the result output by the test server A2 is input into the test server A3, the test server A3 is called to execute the debugging task, and the final debugging result is output.
After receiving the debugging result, the code source device can display the debugging result on a preset human-computer interaction interface so as to present the debugging result to a developer, so that the developer can further perfect the target code according to the debugging result.
Further, in the process of invoking the target test server group to debug the target code, the execution states of the test servers in the target test server group may also be acquired and summarized to form an execution set, and whether the execution set has an execution state with abnormal content is determined, where the abnormality may include, but is not limited to, a down, a drop, a hang-up, and the like. And if so, generating state information with normal content, wherein the state information is used for reflecting that the target test server group is in a normal state. If not, generating state information with abnormal content, reflecting that the target test server group is in an abnormal state, and setting the target test server group as an abnormal group. And when the code is debugged subsequently, the abnormal group is not called any more, so that the problem that the thread of the service system is blocked because too many tasks cannot be processed in the service system is avoided.
The code debugging task being executed in the abnormal group is transferred to a replacement test server group to be continuously executed, the selection process of the replacement test server group is similar to the selection process of the target test server group, namely, the replacement test server group is selected in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file, which can be referred to the above contents specifically, only that the abnormal group is not considered in the selection process, and the specific selection process is not described in detail in the embodiment of the present invention.
In the process of transferring the code debugging task, the remaining tasks of the code debugging task can be determined according to the position of the abnormal server in the first business logic execution sequence. The abnormal server is a test server with abnormal execution state content in the target test server group. And then, acquiring a second service logic execution sequence of each test server in the replacement test server group from the target service interface configuration file, selecting subgroups corresponding to the remaining tasks from the replacement test server group according to the second service logic execution sequence, and finally sequentially calling each test server in the subgroups according to the second service logic execution sequence to debug the target code.
For example, if the target test server group is a test server group a, the service logic execution sequence thereof is a test server a1, a test server a2, and a test server A3, and an abnormality occurs when the test server a2 is called, group selection may be performed again to obtain a replacement test server group B, the service logic execution sequence thereof is a test server B1, a test server B2, and a test server B3 in order, at this time, the result output by the test server a1 is input to the test server B2, and the test server B2 is called to execute a debugging task, and then the result output by the test server B2 is input to the test server B3, and the test server B3 is called to execute the debugging task, and a final debugging result is output.
In summary, in the embodiments of the present invention, a test environment code debugging instruction sent by a code source device is obtained through a bridge server; searching a corresponding target service interface configuration file in a preset configuration file library according to the target service interface identifier in the test environment code debugging instruction; selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file; and calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group, and sending the debugging result to the code source equipment. According to the embodiment of the invention, the bridge server is preset between the code source equipment and the test environment, and the test server group in the test environment is directly called to debug the target code according to the test environment code debugging instruction sent by the code source equipment, so that the complex process of packaging and deploying the code is omitted, and the code debugging efficiency is greatly improved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 3 shows a structure diagram of an embodiment of a code debugging apparatus provided in an embodiment of the present invention, corresponding to a code debugging method described in the above embodiment.
In this embodiment, the code debugging apparatus is applied to a preset bridge server, and the apparatus may specifically include:
a code debugging instruction obtaining module 301, configured to obtain a test environment code debugging instruction sent by a code source device;
an interface configuration file searching module 302, configured to search, according to the target service interface identifier in the test environment code debugging instruction, a corresponding target service interface configuration file in a preset configuration file library;
a test server group selecting module 303, configured to select a target test server group in the test environment according to a test server group identifier set and a group selection manner in the target service interface configuration file;
the code debugging module 304 is configured to invoke the target test server group to debug the target code, obtain a debugging result output by the target test server group, and send the debugging result to the code source device.
In a specific implementation manner of the embodiment of the present invention, the code debugging module may specifically include:
a first execution sequence obtaining unit, configured to obtain, from the target service interface configuration file, a first service logic execution sequence of each test server in the target test server group;
the first code debugging unit is used for sequentially calling each test server in the target test server group according to the execution sequence of the first service logic to debug the target code;
and the debugging result acquisition unit is used for taking the output of the last test server in the target test server group as the debugging result.
In a specific implementation manner of the embodiment of the present invention, the code debugging module may further include:
the execution set acquisition unit is used for acquiring the execution states of all the test servers in the target test server group and summarizing the execution states to form an execution set;
an abnormal group setting unit, configured to set the target test server group as an abnormal group if the execution set includes an execution state in which the content is abnormal;
a replacement test server group selecting unit, configured to select a replacement test server group in the test environment according to the test server group identifier set and the group selection manner in the target service interface configuration file;
and the debugging task transferring unit is used for transferring the code debugging task which is being executed in the abnormal group to the replacement test server group to be continuously executed.
In a specific implementation manner of the embodiment of the present invention, the debugging task transferring unit may be specifically configured to: determining the rest tasks of the code debugging task according to the position of an abnormal server in the first service logic execution sequence; the abnormal server is a test server with abnormal execution state content in the target test server group; acquiring a second service logic execution sequence of each test server in the replacement test server group from the target service interface configuration file; selecting a subgroup corresponding to the remaining tasks from the replacement test server group according to the second service logic execution sequence; and sequentially calling each test server in the subgroup according to the execution sequence of the second service logic to debug the target code.
In a specific implementation manner of the embodiment of the present invention, the test server group selection module may specifically include:
a random selection unit, configured to randomly select the target test server group from the candidate test server groups according to a preset random selection probability if the group selection manner is a preset first value; wherein each of the candidate test server groups corresponds to a test server group identity in the set of test server group identities;
and the polling selection unit is used for selecting the target test server group in each candidate test server group according to a preset polling sequence if the group selection mode is a preset second value.
In a specific implementation manner of the embodiment of the present invention, the random selection unit may be specifically configured to: setting numerical value intervals respectively corresponding to the candidate test server groups according to the random selection probability; generating a random number using a preset pseudo random number generator; taking a candidate test server group corresponding to the target value interval as the target test server group; the target value interval is the value interval in which the random number is located.
In a specific implementation manner of the embodiment of the present invention, the test server group selection module may be further configured to: respectively calculating the average task execution duration of each candidate test server group according to a preset historical task execution record; and respectively setting random selection probability corresponding to the average task execution duration for each candidate test server group.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, modules and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Fig. 4 shows a schematic block diagram of a server provided by an embodiment of the present invention, and for convenience of explanation, only the parts related to the embodiment of the present invention are shown.
In this embodiment, the server 4 may include: a processor 40, a memory 41, and computer readable instructions 42 stored in the memory 41 and executable on the processor 40, such as computer readable instructions to perform the code debugging method described above. The processor 40, when executing the computer readable instructions 42, implements the steps in the various code debugging method embodiments described above, such as steps S101-S104 shown in fig. 1. Alternatively, the processor 40, when executing the computer readable instructions 42, implements the functions of the modules/units in the above device embodiments, such as the functions of the modules 301 to 304 shown in fig. 3.
Illustratively, the computer readable instructions 42 may be partitioned into one or more modules/units that are stored in the memory 41 and executed by the processor 40 to implement the present invention. The one or more modules/units may be a series of computer-readable instruction segments capable of performing certain functions, which are used to describe the execution of the computer-readable instructions 42 in the server 4.
Those skilled in the art will appreciate that fig. 4 is merely an example of a server 4 and does not constitute a limitation of server 4 and may include more or fewer components than shown, or some components in combination, or different components, e.g., server 4 may also include input output devices, network access devices, buses, etc.
The Processor 40 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may be an internal storage unit of the server 4, such as a hard disk or a memory of the server 4. The memory 41 may also be an external storage device of the server 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the server 4. Further, the memory 41 may also include both an internal storage unit of the server 4 and an external storage device. The memory 41 is used to store the computer readable instructions and other instructions and data required by the server 4. The memory 41 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/server and method may be implemented in other ways. For example, the above-described apparatus/server embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The 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 place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable storage medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable storage media that does not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will 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 of the embodiments of the present invention.
Claims (10)
1. A code debugging method is applied to a preset bridge server, and comprises the following steps:
acquiring a test environment code debugging instruction sent by a code source device;
searching a corresponding target service interface configuration file in a preset configuration file library according to the target service interface identifier in the test environment code debugging instruction;
selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file;
and calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group, and sending the debugging result to the code source equipment.
2. The code debugging method of claim 1, wherein the invoking the target test server group to debug the target code and obtain the debugging result output by the target test server group comprises:
acquiring a first service logic execution sequence of each test server in the target test server group from the target service interface configuration file;
sequentially calling each test server in the target test server group according to the execution sequence of the first service logic to debug the target code;
and taking the output of the last test server in the target test server group as the debugging result.
3. The code debugging method according to claim 2, further comprising:
acquiring the execution states of all the test servers in the target test server group and summarizing the execution states to form an execution set;
if the execution set comprises an execution state with abnormal content, setting the target test server group as an abnormal group;
selecting a replacement test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file;
and transferring the code debugging task which is being executed in the abnormal group to the replacement test server group to be continuously executed.
4. The code debugging method of claim 3, wherein the transferring the code debugging task being executed in the exception group to the replacement test server group for continuing execution comprises:
determining the rest tasks of the code debugging task according to the position of an abnormal server in the first service logic execution sequence; the abnormal server is a test server with abnormal execution state content in the target test server group;
acquiring a second service logic execution sequence of each test server in the replacement test server group from the target service interface configuration file;
selecting a subgroup corresponding to the remaining tasks from the replacement test server group according to the second service logic execution sequence;
and sequentially calling each test server in the subgroup according to the execution sequence of the second service logic to debug the target code.
5. The code debugging method according to any one of claims 1 to 4, wherein the selecting a target test server group in the test environment according to the test server group identification set and the group selection manner in the target service interface configuration file comprises:
if the group selection mode is a preset first value, randomly selecting the target test server group from each candidate test server group according to a preset random selection probability; wherein each of the candidate test server groups corresponds to a test server group identity in the set of test server group identities;
and if the group selection mode is a preset second value, selecting the target test server group in each candidate test server group according to a preset polling sequence.
6. The code debugging method of claim 5, wherein the randomly selecting the target test server group among the candidate test server groups according to a preset random selection probability comprises:
setting numerical value intervals respectively corresponding to the candidate test server groups according to the random selection probability;
generating a random number using a preset pseudo random number generator;
taking a candidate test server group corresponding to the target value interval as the target test server group; the target value interval is the value interval in which the random number is located.
7. The code debugging method of claim 5, further comprising, before randomly selecting the target test server group among the candidate test server groups according to a preset random selection probability:
respectively calculating the average task execution duration of each candidate test server group according to a preset historical task execution record;
and respectively setting random selection probability corresponding to the average task execution duration for each candidate test server group.
8. A code debugging device, applied to a preset bridge server, the device comprising:
the code debugging instruction acquisition module is used for acquiring a testing environment code debugging instruction sent by the code source equipment;
the interface configuration file searching module is used for searching a corresponding target service interface configuration file in a preset configuration file library according to the target service interface identifier in the test environment code debugging instruction;
the test server group selection module is used for selecting a target test server group in the test environment according to the test server group identification set and the group selection mode in the target service interface configuration file;
and the code debugging module is used for calling the target test server group to debug the target code, acquiring a debugging result output by the target test server group and sending the debugging result to the code source equipment.
9. A computer readable storage medium storing computer readable instructions, which when executed by a processor implement the steps of a code debugging method according to any one of claims 1 to 7.
10. A server comprising a memory, a processor and computer readable instructions stored in the memory and executable on the processor, wherein the processor when executing the computer readable instructions implements the steps of the code debugging method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111524742.0A CN114201400A (en) | 2021-12-14 | 2021-12-14 | Code debugging method and device, computer readable storage medium and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111524742.0A CN114201400A (en) | 2021-12-14 | 2021-12-14 | Code debugging method and device, computer readable storage medium and server |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114201400A true CN114201400A (en) | 2022-03-18 |
Family
ID=80653403
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111524742.0A Pending CN114201400A (en) | 2021-12-14 | 2021-12-14 | Code debugging method and device, computer readable storage medium and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114201400A (en) |
-
2021
- 2021-12-14 CN CN202111524742.0A patent/CN114201400A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104252481A (en) | Dynamic check method and device for consistency of main and salve databases | |
CN111010316A (en) | Flow playback method, device and system | |
CN110007921B (en) | Code publishing method and device | |
CN112035344A (en) | Multi-scenario test method, device, equipment and computer readable storage medium | |
CN111784318A (en) | Data processing method and device, electronic equipment and storage medium | |
CN112306837A (en) | Cloud pressure testing method and platform, equipment and readable storage medium | |
CN112445490A (en) | File sequence processing method and device, terminal equipment and storage medium | |
CN112948233A (en) | Interface testing method, device, terminal equipment and medium | |
CN112699648B (en) | Data processing method and device | |
CN111767218B (en) | Automatic test method, equipment and storage medium for continuous integration | |
CN107092556B (en) | Test method, device and equipment | |
CN112052070A (en) | Application containerization evaluation method and device, electronic equipment and storage medium | |
CN116009889A (en) | Deep learning model deployment method and device, electronic equipment and storage medium | |
CN114201400A (en) | Code debugging method and device, computer readable storage medium and server | |
CN117131545A (en) | Data processing method and device, storage medium and terminal | |
CN113672514A (en) | Test method, test device, server and storage medium | |
CN112965791A (en) | Timing task detection method, device, equipment and storage medium | |
CN116136813B (en) | Method, device and storage medium for simulating adaptive multi-model avionics signals | |
CN107885659A (en) | Method and device, the equipment of request analog response to client | |
CN109783331B (en) | Database cluster pressure testing method and device | |
CN112115046B (en) | Software fault positioning method, device and terminal | |
CN113672278B (en) | Service node version control method and device under micro-service architecture | |
CN114637474B (en) | Data block processing method and device and electronic equipment | |
CN108628750B (en) | Test code processing method and device | |
CN113485938A (en) | Automatic testing method and device for large host |
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 |