Code quality detection method, device and equipment
By introducing playback applications to automatically obtain and process business traffic data for code quality detection, the problem of low detection efficiency in the existing technology is solved, and efficient and accurate code quality detection is achieved.
Patent Information
- Application Number
- CN202410073123.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-17
- Publication Date
- 2024-09-17
AI Technical Summary
The existing code quality detection process requires R&D personnel to manually write test code and perform multiple operations, resulting in low detection efficiency.
By introducing the playback application, the business traffic data of the target application is automatically obtained for playback processing, and the quality of the business code is directly inspected, avoiding the need to write test code and manual operations.
It greatly improves the efficiency of code quality detection, reduces the workload and errors of R&D personnel, and ensures the accuracy of detection.
Smart Images

Figure CN118656287A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a code quality detection method, device and equipment. Background Art
[0002] Applications (APPs) are not unfamiliar to people. They are created by R&D personnel who write codes according to business needs. In order to ensure the quality of the code, R&D personnel often test the code quality by themselves after writing the code, and after passing the self-test, they will conduct formal testing and go online. At present, R&D personnel need to test the code quality by themselves, and in the process of testing based on the written test code, they need to manually participate in the operation many times, so the efficiency of code quality detection is low. Summary of the invention
[0003] The present application provides a code quality detection method, device and equipment to improve the efficiency of code quality detection.
[0004] In a first aspect, an embodiment of the present application provides a code quality detection method, comprising:
[0005] Get the business code of the target application;
[0006] Deploy the target application according to the business code;
[0007] Acquire playback data of a playback application; the playback data is obtained by the playback application replaying the service flow data of the target application;
[0008] The service code is subjected to quality inspection processing according to the playback data to obtain a quality inspection result.
[0009] It can be seen that in the embodiment of the present application, when the business code of the target application is obtained, the deployment process of the target application is performed according to the business code; and the playback data obtained by the playback application replaying the business traffic data of the target application is obtained, and the business code is quality tested according to the playback data to obtain the quality test result. Therefore, after the target application is deployed, the playback data of the target application for code quality testing can be automatically obtained based on the playback application, and the R&D personnel no longer need to spend time writing test code, and the user does not need to manually operate the parameters during the detection process, thereby greatly improving the efficiency of code quality detection.
[0010] In a second aspect, an embodiment of the present application provides a code quality detection device, including:
[0011] A first acquisition module, used to acquire the service code of the target application;
[0012] A deployment module, used to deploy the target application according to the business code;
[0013] A second acquisition module is used to acquire playback data of a playback application; the playback data is obtained by the playback application replaying the service flow data of the target application;
[0014] The detection module is used to perform quality detection processing on the business code according to the playback data to obtain a quality detection result.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0016] A processor; and a memory arranged to store computer executable instructions, wherein the executable instructions are configured to be executed by the processor, and the executable instructions include instructions for executing the steps in the code quality detection method provided in the first aspect above.
[0017] In a fourth aspect, an embodiment of the present application provides a storage medium, wherein the storage medium is used to store computer-executable instructions, and the executable instructions enable a computer to execute the code quality detection method provided in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate one or more embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0019] Figure 1 A schematic diagram of a code quality detection method provided in an embodiment of the present application
[0020] Figure 2 A first flow chart of a code quality detection method provided in an embodiment of the present application;
[0021] Figure 3 A second flow chart of a code quality detection method provided in an embodiment of the present application;
[0022] Figure 4 A third flow chart of a code quality detection method provided in an embodiment of the present application;
[0023] Figure 5 A fourth flow chart of a code quality detection method provided in an embodiment of the present application;
[0024] Figure 6 A schematic diagram of the module composition of a code quality detection device provided in an embodiment of the present application;
[0025] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of the present application, the technical solutions in one or more embodiments of the present application will be clearly and completely described below in conjunction with the drawings in one or more embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on one or more embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0027] With the continuous development of Internet technology, various applications (Application, App for short) have also emerged. Among them, applications are created by R&D personnel who write business codes according to business needs. In order to ensure the quality of the code, after writing the business code, the R&D personnel will also write the test code, and submit the business code and the test code to the code detection tool together. Then, for multiple different detection indicators, the R&D personnel need to operate the corresponding detection controls of the code detection tool respectively. The code detection tool responds to the operation of the detection control by the R&D personnel, and performs detection processing on the business code submitted by the R&D personnel based on the test code submitted by the R&D personnel to obtain the corresponding detection indicators; and according to the obtained detection indicators, it is determined whether the business code submitted by the R&D personnel passes the quality inspection. It can be seen that in the existing code quality inspection process, on the one hand, R&D personnel need to write test codes; and manually writing test codes not only takes time and effort, but also inevitably has some errors, but the errors are often only discovered after the aforementioned detection processing, so that the R&D personnel have to go back and modify the test code, and re-perform the aforementioned detection processing based on the modified test code, and the detection efficiency is low. On the other hand, during the detection process, R&D personnel are required to manually participate in the operation many times, which not only increases the operation of R&D personnel, but also reduces the efficiency of code quality detection. Based on this, the embodiment of the present application provides a code quality detection method, device and equipment.
[0028] Figure 1 A schematic diagram of a code quality detection method provided in an embodiment of the present application is shown as follows: Figure 1As shown, when the R&D personnel write the business code of the target application, they introduce the dependency package of the playback application so that the target application can access the playback application, and after the business code of the target application is written, the business code of the target application is submitted to the delivery tool. After obtaining the business code submitted by the R&D personnel, the delivery tool performs deployment processing of the target application according to the business code; and obtains the playback data obtained by the playback application replaying the business traffic data of the target application, and performs quality inspection processing on the business code according to the playback data to obtain the quality inspection result. In some embodiments, the delivery tool can be a CICD (CI stands for Continuous Integration, which means continuous integration, and CD stands for Continuous Delivery and Continuous Deployment, which respectively mean continuous delivery and continuous deployment) pipeline. The target application can be any application that provides any business, such as a shopping application that provides shopping services, order query services, etc., a resource management application that provides resource query services, resource transfer services, etc., and examples are no longer given one by one in this application. Since the target application is connected to the playback application, after the target application is deployed, the playback data of the target application for code quality detection can be automatically obtained based on the playback application. R&D personnel no longer need to spend time writing test code, and users do not need to manually participate in the detection process, which greatly improves the efficiency of code quality detection.
[0029] In order to facilitate understanding of the technical solution of the present application, the following technical terms are first explained.
[0030] Traffic: refers to the network request initiated by the user or program and the response data obtained from the server.
[0031] Traffic replay: Record every network request, its execution and response data, and re-initiate the same network request based on the recorded data.
[0032] Based on the above content, the code quality detection method provided by the embodiment of the present application is described in detail below. Specifically, Figure 2 A flowchart of a code quality detection method provided for one or more embodiments of the present application is provided. Figure 2 The method in can be Figure 1 The delivery tool in the delivery tool can be set in an electronic device. The electronic device can be a terminal device or a server. The terminal device can be a mobile phone, a tablet computer, a desktop computer, a portable notebook, etc. The server can be an independent server, a server cluster composed of multiple servers, or a cloud server capable of cloud processing. Figure 2 As shown, the method comprises the following steps:
[0033] Step S102, obtaining the service code of the target application;
[0034] Specifically, the delivery tool may include a submission module. When the developer has finished writing the business code of the target application, the developer may operate the submission module of the delivery tool to submit the business code of the target application. Accordingly, the delivery tool obtains the business code submitted by the developer. In some embodiments, the submission module may include a hook function, and the developer may submit the business code by calling the hook function.
[0035] In order to enable the delivery tool to automatically and quickly obtain the playback data of the business code for quality inspection processing after obtaining the business code of the target application, in one or more embodiments of the present application, the target application is connected to the playback application, so that after the delivery tool deploys the target application, the playback application connected to the target application can be directly called to obtain the playback data obtained by the playback application based on the deployed target application for playback processing.
[0036] Step S104, deploying the target application according to the business code;
[0037] In order to facilitate quality inspection of the business code of the target application, in one or more embodiments of the present application, when the delivery tool obtains the business code of the target application, it first deploys the target application according to the business code, and then replays the business traffic data of the target application based on the deployed target application.
[0038] Step S106, obtaining playback data of the playback application; the playback data is obtained by the playback application replaying the service flow data of the target application based on the deployed target application;
[0039] Specifically, after the delivery tool has completed the deployment of the target application, it can start the target application and call the playback application to obtain the playback data obtained by the playback application replaying the service flow data of the target application based on the deployed target application. The service flow data includes the service request and the first request result of the service request. The service flow data of the target application is replayed, that is, according to the service request in the service flow data, the service request is re-initiated to the target application and the playback data is obtained.
[0040] The playback application in one or more embodiments of the present application can not only play back the business traffic data, but also record the business traffic data. Accordingly, when the target application is the initial version, since the target application has never been online, the playback application cannot record the real business traffic data of the target application, so some business traffic data can be set in advance according to the business processing flow of the target application for playback, that is, the business traffic data of the target application can include preset business traffic data. When the target application is not the initial version, that is, the target application has been online before, the business code targeted by this code quality detection is the business code after the previous business code is updated. Since the target application has been online before, the playback application can record the real historical business traffic data of the target application. Therefore, not only can the preset business traffic data be used for playback, but also the historical business traffic data can be used for playback, that is, the business traffic data of the target application can include one or more of the preset business traffic data and the historical business traffic data of the target application.
[0041] Step S108, performing quality inspection on the service code according to the playback data to obtain a quality inspection result.
[0042] In one or more embodiments of the present application, when the business code of the target application is obtained, the deployment process of the target application is performed according to the business code; and the playback data obtained by the playback application replaying the business traffic data of the target application is obtained, and the business code is quality tested according to the playback data to obtain the quality test result. Therefore, after the target application is deployed, the playback data of the target application for code quality testing can be automatically obtained based on the playback application, and the R&D personnel no longer need to spend time writing test code, and the user does not need to manually operate the parameters during the detection process, thereby greatly improving the efficiency of code quality detection.
[0043] In order to facilitate the acquisition of playback data, in one or more embodiments of the present application, after acquiring the business code, the delivery tool first performs deployment processing of the target application, specifically, Figure 3 As shown, step S104 may include the following steps S104-2:
[0044] Step S104-2: If it is determined according to the business code that the target application meets the deployment condition, the target application is deployed based on the business code.
[0045] Specifically, the business code is compiled; if the result of the compilation process is that the compilation is passed, it is determined that the target application meets the deployment conditions, and the target application is deployed to the specified location based on the business code. In some embodiments, the specified location may be an electronic device where the delivery tool is located. The corresponding specified location is not specifically limited in this application, and it can be set as needed in actual applications.
[0046] It can be understood that compiling the business code is equivalent to performing the first level of testing on the business code. The quality testing based on the playback data is equivalent to performing the second level of testing on the business code. Therefore, through double testing, the accuracy of code quality testing is greatly guaranteed.
[0047] In order to facilitate the delivery tool to obtain playback data, in one or more embodiments of the present application, the target application's business code introduces the playback application's dependency package, and accesses the playback application in this way. That is, the target application's business code includes the playback application's dependency package, and accordingly, Figure 4 As shown, step S106 may include the following steps S106-2 and S106-4:
[0048] Step S106-2, calling the dependent package of the playback application in the business code, and sending a playback request to the playback application;
[0049] Among them, the playback request is used to request the playback application to replay the business traffic data of the target application based on the deployed target application, obtain the playback data and return the playback data. The dependent package of the playback application includes codes for implementing functions such as recording of business traffic data, statistics of code coverage, and comparison of request results. When the playback application receives the playback request, it obtains the business traffic data of the target application from the specified storage area, and inputs the business request in the business traffic data into the target application for business processing to obtain the second request result; compares the first request result in the business traffic data with the obtained second request result to obtain the comparison result; and determines the code coverage of the business code, and determines the comparison result and code coverage as the playback data; and returns the playback data to the delivery tool.
[0050] Furthermore, considering that in actual applications, the business code may include some codes that are not related to code quality detection, in order to ensure the accuracy of code coverage, in one or more embodiments of the present application, the playback application can also identify the target code to be detected in the business code of the target application, and determine the code coverage of the business code based on the target code. Specifically, the above determination of the code coverage of the business code may include: determining the target code to be detected in the business code; determining the first line number of the target code executed during the business processing; and determining the code coverage of the business code based on the first line number and the total number of lines of the target code.
[0051] In some implementations, the playback request may include scope information of the code that is not involved in the detection, and accordingly, the playback application determines the target code to be counted based on the scope information in the playback request. The specific method for determining the target code is not limited thereto, and it can be set as needed in actual applications. As an example, if the scope information included in the playback request is com.msxf.modle.*, it is determined that all codes under the com.msxf.medle package do not need to participate in the code coverage detection, and each code in the business code of the target application except the com.msxf.medle package is determined as the target code to be detected.
[0052] In some implementations, determining the code coverage of the business code based on the first number of lines and the total number of lines of the target code may include: dividing the first number of lines by the total number of lines of the target code to obtain the code coverage of the business code.
[0053] In some implementations, the target application can determine the code coverage of the business code based on the byte coding stub. For the specific implementation process of the byte coding stub, reference can be made to the relevant technology, which will not be described in detail in this application.
[0054] Step S106-4: receiving playback data returned by the playback application.
[0055] Therefore, by introducing the dependency package of the playback application into the business code of the target application, the business traffic data of the target application can be replayed by calling the dependency package without installing the playback application separately. Therefore, on the basis of ensuring that effective playback data can be obtained, the installation of the playback application and other operations are reduced, and the efficiency of code quality detection is improved.
[0056] After the delivery tool obtains the playback data, it can perform quality inspection on the business code of the target application according to the playback data. Specifically, the above step S108 may include: if the comparison result in the playback data indicates that the first request result is consistent with the second request result, and the code coverage in the playback data is greater than the coverage threshold, then a quality inspection result indicating that the inspection has passed is obtained. The coverage threshold can be set as needed in actual applications, such as 90%.
[0057] In order to make the R&D personnel aware of the test results, in one or more embodiments of the present application, step S108 may also include: displaying the quality test results.
[0058] Further, when the quality inspection result indicates that the inspection has passed, the R&D personnel can initiate a test request to the tester, and the tester can test the business code, and when the test result of the tester indicates that the test has passed, the target application is launched online. When the quality inspection result indicates that the inspection has not passed, in order to let the R&D personnel know the reason why the inspection has not passed, the quality inspection result can also include prompt information that the inspection has not passed. When the prompt information indicates that the first request result is inconsistent with the second request result, the R&D personnel need to check whether the business code of the target application needs to be adjusted, and whether the business traffic data of the target application needs to be updated. After all the problems found are solved (such as the business code has been adjusted and the business traffic data has been updated), the aforementioned quality inspection process is performed again. When the prompt information indicates that the code coverage rate does not reach the coverage rate threshold, the business traffic data of the target application can be updated. In some embodiments, updating the business traffic data of the target application can include: sending a business request to the target application so that the playback application records the business traffic data corresponding to the business request, and saves the business traffic data to a specified storage area to achieve the update of the business traffic data of the target application in the storage area. Alternatively, the developer edits the corresponding business flow data according to the business processing logic of the target application, and operates the console (such as the server) of the playback application to submit the edited business flow data; after the console obtains the business flow data submitted by the developer, it saves the business flow data to a designated storage area to update the business flow data of the target application in the storage area. The update method of the business flow data can be set by the developer according to the actual application needs.
[0059] It is understandable that the business traffic data in the embodiments of the present application can be replayed multiple times after being recorded once. For example, the target application has multiple versions, and both its V1 version and V2 version provide service 1. Then the business traffic data of service 1 can be used to perform quality inspection on the business code of the target application of the V1 version, and can also be used to perform quality inspection on the business code of the target application of the V2 version. Furthermore, when the target application is not the initial version, considering that as the number of businesses processed by the target application increases, its business traffic data also increases, and there may be a large amount of duplicate business traffic data. Based on this, in one or more embodiments of the present application, the method may also include: regularly managing the business traffic data through the console of the playback application. Among them, regularly managing business traffic data may include: according to the preset time period, determining whether the business traffic data corresponding to the current time period contains the business traffic data of each business; if so, deleting the business traffic data corresponding to the previous time period of the current time period; if not, the business traffic data corresponding to the current time period determines the target business that is not carried out in the current time period, and determines whether the business traffic data corresponding to the previous time period of the current time period contains the business traffic data of the target business, if it does, then the business traffic data of the target business is determined as the business traffic data corresponding to the current time period, and deletes other business traffic data corresponding to the previous time period; if not, then deletes the business traffic data corresponding to the previous time period of the current time period. In this way, it can be ensured that the business traffic data of the target application covers the various services provided by the target application as much as possible, and does not occupy too much storage space due to storing too much business traffic data. It should be pointed out that the management method for business traffic data is not limited to the above-mentioned management method, and it can be set according to needs in actual applications.
[0060] In a specific embodiment, Figure 5 As shown, the method may include the following steps S10 to S28:
[0061] Step S10: The delivery tool obtains the service code of the target application submitted by the user.
[0062] Step S12, the delivery tool compiles the business code;
[0063] Step S14: if the delivery tool determines that the compilation process is successful, the target application is deployed according to the business code;
[0064] Step S16, the delivery tool starts the target application, calls the dependent package of the playback application in the business code, and sends a playback request to the playback application;
[0065] Step S18, the playback application obtains the service flow data of the target application from the specified storage area;
[0066] Step S20, the playback application inputs the service request in the service flow data into the target application for service processing, and obtains a second request result;
[0067] Step S22, the playback application compares the first request result in the service flow data with the obtained second request result to obtain a comparison result;
[0068] Step S24, replay the application to determine the code coverage of the business code;
[0069] Step S26, the playback application determines the comparison result and the code coverage as playback data, and returns the playback data to the delivery tool;
[0070] Step S28: Perform quality inspection on the service code according to the playback data to obtain a quality inspection result.
[0071] The specific implementation of steps S10 to S28 can be found in the above description, and the repeated parts will not be repeated here.
[0072] In one or more embodiments of the present application, when the business code of the target application is obtained, the deployment process of the target application is performed according to the business code; and the playback data obtained by the playback application replaying the business traffic data of the target application is obtained, and the business code is quality tested according to the playback data to obtain the quality test result. Therefore, after the target application is deployed, the playback data of the target application for code quality testing can be automatically obtained based on the playback application, and the R&D personnel no longer need to spend time writing test code, and the user does not need to manually operate the parameters during the detection process, thereby greatly improving the efficiency of code quality detection.
[0073] Corresponding to the code quality detection method described above, based on the same technical concept, one or more embodiments of the present application also provide a code quality detection device. Figure 6 A schematic diagram of the module composition of a code quality detection device provided in one or more embodiments of the present application, such as Figure 6 As shown, the device comprises:
[0074] The first acquisition module 201 is used to acquire the service code of the target application;
[0075] A deployment module 202, used to deploy a target application according to the business code;
[0076] The second acquisition module 203 is used to acquire playback data of the playback application; the playback data is obtained by the playback application replaying the service flow data of the target application;
[0077] The detection module 204 is used to perform quality detection processing on the business code according to the playback data to obtain a quality detection result.
[0078] The code quality detection device provided in the embodiment of the present application, when the business code of the target application is obtained, performs deployment processing of the target application according to the business code; and obtains the playback data obtained by the playback application replaying the business traffic data of the target application, and performs quality detection processing on the business code according to the playback data to obtain the quality detection result. Therefore, after the target application is deployed, the playback data of the target application for code quality detection can be automatically obtained based on the playback application, and the R&D personnel no longer need to spend time writing test code, and the user does not need to manually operate the parameters during the detection process, thereby greatly improving the efficiency of code quality detection.
[0079] It should be noted that the embodiment of the code quality detection device in the present application and the embodiment of the code quality detection method in the present application are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding code quality detection method mentioned above, and the repeated parts will not be repeated.
[0080] Each module in the above-mentioned code quality detection device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the terminal device or the processor on the server side in the form of hardware, or can be stored in the memory in the terminal device or the memory on the server side in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0081] Furthermore, corresponding to the code quality detection method described above, based on the same technical concept, one or more embodiments of the present application further provide an electronic device, which is used to execute the code quality detection method described above. Figure 7 A schematic diagram of the structure of an electronic device provided for one or more embodiments of the present application.
[0082] like Figure 7As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 301 and memory 302, and the memory 302 may store one or more storage applications or data. Among them, the memory 302 may be a temporary storage or a permanent storage. The application stored in the memory 302 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 301 can be configured to communicate with the memory 302 to execute a series of computer executable instructions in the memory 302 on the electronic device. The electronic device may also include one or more power supplies 303, one or more wired or wireless network interfaces 304, one or more input and output interfaces 305, one or more keyboards 306, etc.
[0083] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions:
[0084] Get the business code of the target application;
[0085] Deploy the target application according to the business code;
[0086] Acquire playback data of a playback application; the playback data is obtained by the playback application replaying the service flow data of the target application;
[0087] The service code is subjected to quality inspection processing according to the playback data to obtain a quality inspection result.
[0088] The electronic device provided by one or more embodiments of the present application, when acquiring the business code of the target application, performs deployment processing of the target application according to the business code; and obtains the playback data obtained by the playback application replaying the business traffic data of the target application, and performs quality detection processing on the business code according to the playback data to obtain the quality detection result. Therefore, after the target application is deployed, the playback data of the target application for code quality detection can be automatically obtained based on the playback application, and the R&D personnel no longer need to spend time writing test code, and the user does not need to manually operate the parameters during the detection process, thereby greatly improving the efficiency of code quality detection.
[0089] It should be noted that the embodiment of the electronic device in the present application and the embodiment of the code quality detection method in the present application are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding code quality detection method mentioned above, and the repeated parts will not be repeated.
[0090] Furthermore, corresponding to the code quality detection method described above, based on the same technical concept, one or more embodiments of the present application further provide a storage medium for storing computer executable instructions. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instructions stored in the storage medium are executed by the processor, the following process can be implemented:
[0091] Get the business code of the target application;
[0092] Deploy the target application according to the business code;
[0093] Acquire playback data of a playback application; the playback data is obtained by the playback application replaying the service flow data of the target application;
[0094] The service code is subjected to quality inspection processing according to the playback data to obtain a quality inspection result.
[0095] When the computer executable instructions stored in the storage medium provided by one or more embodiments of the present application are executed by the processor, when the business code of the target application is obtained, the deployment process of the target application is performed according to the business code; and the playback data obtained by the playback application replaying the business traffic data of the target application is obtained, and the business code is quality-checked according to the playback data to obtain the quality test result. Therefore, after the target application is deployed, the playback data of the target application for code quality detection can be automatically obtained based on the playback application, and the R&D personnel no longer need to spend time writing test code, and the user does not need to manually operate the parameters during the detection process, thereby greatly improving the efficiency of code quality detection.
[0096] It should be noted that the embodiment of the storage medium in the present application and the embodiment of the code quality detection method in the present application are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding code quality detection method mentioned above, and the repeated parts will not be repeated.
[0097] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0098] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0099] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0100] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0101] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0102] Those skilled in the art will appreciate that one or more embodiments of the present application may be provided as methods, systems or computer program products. Therefore, one or more embodiments of the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0103] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0104] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0106] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0107] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0108] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0109] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0110] One or more embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present application may also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0111] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0112] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A code quality detection method, characterized in that: include: Get the business code of the target application; Deploy the target application according to the business code; Get the playback data of the playback application; The playback data is obtained by the playback application replaying the service flow data of the target application based on the deployed target application; The service code is subjected to quality inspection processing according to the playback data to obtain a quality inspection result.
2. The method according to claim 1, characterized in that The business code includes the dependency package of the playback application; The obtaining of playback data of the playback application includes: Calling the dependent package and sending a playback request to the playback application; Receive playback data returned by the playback application.
3. The method according to claim 1, characterized in that The service flow data includes a service request and a first request result of the service request; The playback process includes: Inputting the service request into the target application for service processing to obtain a second request result; Comparing the first request result and the second request result to obtain a comparison result; and, Determining code coverage of the business code; The comparison result and the code coverage are determined as the playback data.
4. The method according to claim 3, characterized in that The determining of the code coverage of the business code includes: Determining a target code to be detected in the business code; Determine the first line number of the target code executed during the business processing; The code coverage of the business code is determined according to the first number of lines and the total number of lines of the target code.
5. The method according to claim 3, characterized in that: The performing quality detection processing on the service code according to the playback data to obtain a quality detection result includes: If the comparison result indicates that the first request result is consistent with the second request result, and the code coverage is greater than a coverage threshold, a quality test result indicating that the test has passed is obtained.
6. The method according to claim 1, characterized in that The deploying the target application according to the business code includes: If it is determined according to the business code that the target application meets the deployment condition, the target application is deployed based on the business code.
7. The method according to claim 1, characterized in that The determining, according to the business code, that the target application meets the deployment condition includes: Compiling the business code; If the result of the compilation process is that the compilation passes, it is determined that the target application meets the deployment condition.
8. A code quality detection device, characterized in that: include: A first acquisition module, used to acquire the service code of the target application; A deployment module, used to deploy the target application according to the business code; A second acquisition module is used to acquire playback data of the playback application; The playback data is obtained by the playback application replaying the service flow data of the target application; The detection module is used to perform quality detection processing on the business code according to the playback data to obtain a quality detection result.
9. An electronic device, characterized in that: include: processor; as well as, A memory arranged to store computer executable instructions, wherein the executable instructions are configured to be executed by the processor, and the executable instructions include instructions for executing the steps in the code quality detection method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is used to store computer-executable instructions, and the executable instructions enable a computer to execute the code quality detection method according to any one of claims 1 to 7.
