Enhanced coverage detection system and method for account-related code based on JaCoCo

By introducing intelligent analysis modules into JaCoCo tools, code execution data can be captured and analyzed in real time, the shortcomings of traditional tools in accounting data processing code detection are solved, and the in-depth coverage detection and evaluation of account-related codes are realized, and the software's accounting audit and compliance capabilities are improved.

CN119127712BActive Publication Date: 2025-04-18MIANYANG CITY COMMERCIAL BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411298609.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2025-04-18
Estimated Expiration
2044-09-18

AI Technical Summary

Technical Problem

The traditional code coverage tool JaCoCo, the traditional code coverage tool, has problems such as inaccurate identification, lack of data source integration and insufficient dynamic keyword matching when processing codes for accounting data, resulting in the inability to accurately evaluate the coverage of accounting codes.

Method used

Introducing an intelligent analysis module, combining JaCoCo tools, code execution data is captured in real time, matching accounting-related keywords are retrieved in full text, and detailed coverage reports are generated to ensure that each code involving accounting processing logic is fully tested.

Benefits of technology

It realizes a deep understanding and evaluation of account-related codes, ensures that the code of accounting processing logic is fully tested, and improves the transparency and credibility of the software in accounting auditing and compliance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005046895570000051
    Figure BDA0005046895570000051
  • Figure BDA0005046895570000061
    Figure BDA0005046895570000061
  • Figure BDA0005046895570000071
    Figure BDA0005046895570000071
Patent Text Reader

Abstract

The present invention discloses an enhanced coverage detection system and method for accounting-related codes based on JaCoCo. The method comprises real-time capturing of code execution data in the software development process, and analyzing the code execution data using an intelligent analysis algorithm and generating a code report. By constructing semantic models and compliance rules specific to the accounting field, the execution of the accounting-related codes can be deeply understood and evaluated to ensure that each code involved in the accounting processing logic is fully tested. The present invention can provide accurate and dynamic code testing information to help the development team promptly discover the code areas covered by the accounting-related codes, thereby significantly improving the comprehensiveness of the accounting-related codes and the efficiency of development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of code detection, and in particular relates to an enhanced coverage detection system and method for account-related codes based on JaCoCo. Background Art

[0002] The traditional code coverage tool JaCoCo focuses on general code coverage, such as line coverage, branch coverage, etc., and cannot provide sufficient detection accuracy for the code part that processes accounting data. Accounting software involves a large amount of accounting data processing logic, and it is crucial to accurately evaluate the coverage of these codes; traditional coverage detection tools have the following problems when dealing with these specific needs: First, the accounting data processing code is not accurately identified, and it is impossible to distinguish between general code and key code involving accounting data processing. Second, there is a lack of data source integration, and coverage detection cannot be combined with the accounting database. Third, the dynamic keyword matching is insufficient, and it is impossible to dynamically identify and match accounting keywords, resulting in some key codes not being detected. Summary of the invention

[0003] In view of the above problems, the purpose of the present invention is to provide an enhanced coverage detection system and method for accounting-related codes based on the JaCoCo tool. The method introduces an intelligent analysis module designed specifically for accounting software into the traditional JaCoCo tool to achieve in-depth understanding and evaluation of the execution of accounting-related codes, ensuring that every code involved in accounting processing logic is fully tested.

[0004] To achieve the above object, the present invention adopts the following technical solutions:

[0005] An enhanced coverage detection method for account-related codes based on JaCoCo, comprising real-time capture of code execution data during software development, and using an intelligent analysis algorithm to analyze the code execution data and generate a code report;

[0006] The real-time capture of code execution data in the software development process is achieved by connecting to the software data source, scanning the tables and fields related to the accounts in the data source, recording the scan results in a local file, marking it as "project-related account keywords", reading the "project-related account keywords" line by line, opening the "project source code directory", reading the contents of the java source code files in the "project source code directory" one by one by directory, performing full-text search and matching, recording the hit java classes and the number of code lines in the hit file, and marking it as "project-related account hit class file";

[0007] Analyzing the code execution data and generating a code report using an intelligent analysis algorithm refers to using a JaCoCo tool to scan the code execution data and generate a JaCoCo report, importing the JaCoCo report data into a database, and matching it with a "project-related account hit class file", and recording the unit test coverage of the hit Java class; wherein the JaCoCo report includes line coverage and branch coverage of the code.

[0008] Furthermore, the real-time capture of code execution data during software development specifically includes the following steps:

[0009] Use a configuration file to define database connection information and the tables and fields to be scanned; the configuration file includes the database URL, user name, password, and the table name and field name to be scanned;

[0010] Read the configuration file and connect to the accounting database, scan all tables and fields involving amounts, record the scan results to a local file, and mark them as "keywords related to project accounts";

[0011] Configure the GitLab URL address of the project. By configuring the GitLab URL, project name, and access permissions, you can automatically obtain the latest project source code.

[0012] Read the "Project Accounting Keywords" file line by line. This file contains all the keywords related to accounting data processing. These keywords are extracted from the database tables and fields in the previous step and represent all the parts of the code that may involve accounting data.

[0013] In the "project source code directory", match the accounting-related keywords one by one by file, record the hit Java class and the number of code lines, and mark it as "project accounting-related hit class file". Through full-text search technology, ensure that all code snippets containing accounting-related keywords are accurately identified and recorded. By scanning and identifying "project accounting-related keywords", the keywords can be dynamically matched with the relevant parts of the execution code data, and the results can be recorded. This method can not only ensure that all codes involving accounting data are detected.

[0014] Furthermore, the actual coverage of the account-related code is obtained by summarizing the unit test coverage of the project as a whole, especially the coverage of the account-related code, to obtain the final project account-related unit test coverage result. Through statistical analysis, a detailed coverage report is generated to help the development team understand and improve the test coverage.

[0015] The present invention also provides an enhanced coverage detection system for account-related codes based on JaCoCo, including a real-time data capture module for capturing code execution data in real time during code execution testing; connecting a data source through a configuration file to scan a data source, and scanning all tables and fields involving amounts; recording the scanning results to a local file, and marking them as "project account-related keywords"; reading "project account-related keywords" line by line, opening a "project source code directory", reading the contents of java source code files in the "project source code directory" one by one according to the directory, performing full-text search matching, and recording the hit java class and the number of code lines in the hit file, and marking them as "project account-related hit class file";

[0016] A data analysis module is used to analyze the code execution data using an intelligent analysis algorithm; use the JaCoCo tool to scan the code execution data and generate a JaCoCo report, import the JaCoCo report data into a database, and match it with the "project account-related hit class file" to record the unit test coverage of the hit Java class;

[0017] The report generation module is used to generate a report based on the results of coverage detection.

[0018] An interactive user interface is used to display coverage test results, generate various functional diagrams based on interactive functions, and implement data screening and analysis.

[0019] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method when executing the computer program.

[0020] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0021] Compared with the prior art, the present invention has the following beneficial effects:

[0022] (1) By building semantic models and compliance rules specific to the accounting field (tables and fields related to accounting), we can deeply understand and evaluate the execution of accounting-related codes to ensure that every code involving accounting processing logic can be fully tested. It has the ability to dynamically adjust test strategies to respond to changes in accounting rules and business development needs. At the same time, the integrated compliance verification and automated reporting functions significantly improve the transparency and credibility of the software in accounting auditing and compliance.

[0023] (2) It can dynamically analyze the deep connection between business logic and accounting principles in accounting-related codes. By combining formal methods with machine learning, the algorithm can identify and track accounting rules, transaction patterns and their compliance requirements in the code, and achieve accurate mapping even in highly modular and abstract code structures; significantly improving the depth of understanding of complex accounting logic and the breadth of test coverage.

[0024] (3) It can provide accurate and dynamic code testing information to help the development team promptly identify the code areas covered by the accounting-related codes, thereby significantly improving the comprehensiveness of the accounting-related codes and the efficiency of development. DETAILED DESCRIPTION

[0025] Example 1

[0026] This embodiment provides an enhanced coverage detection method for account-related code based on the JaCoCo tool, which includes capturing code execution data in the software development process in real time, and using an intelligent analysis algorithm to analyze the code execution data and generate a code report.

[0027] The real-time capture of code execution data in the software development process is achieved by connecting to the software data source, scanning the tables and fields related to accounting in the data source, recording the scan results in a local file, marking them as "project-related accounting keywords", reading the "project-related accounting keywords" line by line, opening the "project source code directory", reading the contents of the java source code files in the "project source code directory" one by one by directory, performing full-text search and matching, recording the hit java classes and the number of code lines in the hit file, marking them as "project-related accounting hit class files", and using advanced data stream processing technology to capture and analyze code execution data in real time, thereby ensuring the real-time and accuracy of the data.

[0028] The specific steps include:

[0029] (1) Use a configuration file to define database connection information and the tables and fields to be scanned; the configuration file includes the database URL, user name, password, and the table and field names to be scanned. By configuring and scanning the data source, all tables and fields involving accounting data are identified, ensuring the comprehensiveness and accuracy of the detection process.

[0030] Implementation code:

[0031]

[0032] (2) Read the configuration file and connect to the accounting database, scan all tables and fields involving amounts, record the scan results in a local file, and mark them as "keywords related to project accounts." This ensures that all database tables and fields related to accounting data processing are identified and recorded.

[0033] Implementation code:

[0034]

[0035]

[0036] (3) Configure the GitLab URL address of the project to facilitate subsequent source code retrieval. By configuring the GitLab URL, project name, and access permissions, the latest project source code can be automatically obtained.

[0037] Connect to GitLab to pull the project source code to a specified local directory. Write a script to connect to GitLab, pull the source code of the specified project to a specified local directory, and mark it as "project source code directory". By writing scripts or tools, regularly pull the latest source code to ensure that the detected code is the latest version.

[0038] (4) Read the "Project Accounting Keywords" file line by line. This file contains all the keywords related to accounting data processing. These keywords are extracted from the database tables and fields in the previous step and represent all the parts of the code that may involve accounting data.

[0039] (5) In the "project source code directory", match the accounting-related keywords one by one, record the hit Java class and the number of code lines, and mark it as "project accounting-related hit class file". Through full-text search technology, ensure that all code snippets containing accounting-related keywords are accurately identified and recorded. By scanning and identifying "project accounting-related keywords", the keywords can be dynamically matched with the relevant parts of the execution code data and the results can be recorded. This method can not only ensure that all codes involving accounting data are detected.

[0040]

[0041]

[0042] The use of an intelligent analysis algorithm to analyze the code execution data and generate a code report is achieved by the following steps:

[0043] (1) Obtain the JaCoCo report of the JaCoCo tool scanning result of the project and save it in CSV format; the JaCoCo report includes information such as code line coverage and branch coverage, which is the basic data for subsequent matching and analysis.

[0044] (2) Import the JaCoCo report data into the database and match it with the "project account-related hit class file" to record the unit test coverage of the hit Java class. Through comparative analysis, determine the actual coverage of the account-related code and find out the key code parts that are not covered by the test.

[0045] Match the JaCoCo coverage report with the identified accounting-related code to calculate the precise accounting-related code coverage. This process can help the development team understand which accounting-critical code is not fully tested, so as to make targeted improvements.

[0046] Implementation code:

[0047]

[0048]

[0049]

[0050]

[0051] Specifically, the actual coverage of the account-related code is obtained by summarizing the unit test coverage of the project as a whole, especially the coverage of the account-related code, to obtain the final project account-related unit test coverage result. Through statistical analysis, a detailed coverage report is generated to help the development team understand and improve the test coverage.

[0052]

[0053] }catch(SQLException e){

[0054] e.printStackTrace();

[0055] }

[0056] }

[0057] }

[0058] This embodiment collects code execution and test coverage data in real time by implanting monitoring agents in the software development and testing environment; these data are processed by machine learning algorithms and improvement suggestions are generated; finally, the system presents the analysis results and optimization suggestions to users in an intuitive manner through dynamic reports and dashboards, connects to a unified scheduling center, regularly archives scan results, and generates reports.

[0059] Example 2

[0060] This embodiment provides an enhanced coverage detection system for account-related codes based on the JaCoCo tool, including a real-time data capture module, a data analysis module, and a report generation module.

[0061] The real-time data capture module is deployed in a software development environment, and captures code execution data in real time during code execution testing. Specifically, the real-time data capture module connects to the data source through a configuration file to scan the data source, scans all tables and fields involving amounts; records the scan results to a local file, and marks them as "project account-related keywords"; reads the "project account-related keywords" line by line, opens the "project source code directory", reads the contents of the java source code files in the "project source code directory" one by one according to the directory, performs full-text search and matching, records the hit java class and the number of code lines in the hit file, and marks it as "project account-related hit class file".

[0062] The data analysis module uses an intelligent analysis algorithm to analyze the code execution data; uses the JaCoCo tool to scan the code execution data and generate a JaCoCo report, imports the JaCoCo report data into a database, and matches it with the "project account-related hit class file", and records the unit test coverage of the hit Java class.

[0063] The report generation module generates a report based on the coverage detection results. This embodiment supports customized report content, including but not limited to test summary, module test details, risk point analysis, and improvement suggestions.

[0064] The interactive user interface is used to display the coverage detection results, and various functional graphs can be generated according to the interactive functions, including heat maps, line graphs, pie charts, etc., and supports users to filter and analyze data according to different dimensions (such as time, module, team, etc.).

[0065] This embodiment uses machine learning algorithms to process and generate improvement suggestions. Through dynamic reports and dashboards, the analysis results and optimization suggestions are presented to users in an intuitive way. It is connected to a unified scheduling center to archive scanning results and generate reports on a regular basis. Through detailed coverage reports, it helps the development team find key code parts that are not covered by tests, conduct targeted testing and improvements, and improve the quality and reliability of accounting data processing codes.

[0066] The above description is only a preferred implementation manner of the present invention, but the protection scope of the present invention is not limited thereto, and any modification and replacement based on the technical solution and inventive concept provided by the present invention should be included in the protection scope of the present invention.

Claims

1. An enhanced coverage detection method for account-related code based on JaCoCo, characterized by: It includes capturing the code execution data in the software development process in real time, analyzing the code execution data using intelligent analysis algorithms and generating code reports; The real-time capture of code execution data in the software development process is achieved by connecting to the software data source, scanning the tables and fields related to the accounts in the data source, recording the scan results in a local file, marking it as "project-related account keywords", reading the "project-related account keywords" line by line, opening the "project source code directory", reading the contents of the java source code files in the "project source code directory" one by one by directory, performing full-text search and matching, recording the hit java classes and the number of code lines in the hit file, and marking it as "project-related account hit class file"; Analyzing the code execution data and generating a code report using an intelligent analysis algorithm refers to using a JaCoCo tool to scan the code execution data and generate a JaCoCo report, importing the JaCoCo report data into a database, and matching it with the "project account-related hit class file", and recording the unit test coverage of the hit Java class; wherein the JaCoCo report includes the line coverage and branch coverage of the code; The real-time capture of code execution data during software development specifically includes the following steps: Use a configuration file to define database connection information and the tables and fields to be scanned; the configuration file includes the database URL, user name, password, and the table name and field name to be scanned; Read the configuration file and connect to the accounting database, scan all tables and fields involving amounts, record the scan results to a local file, and mark them as "keywords related to project accounts"; Configure the GitLab URL address of the project. By configuring the GitLab URL, project name, and access permissions, you can automatically obtain the latest project source code. Read the "Project Accounting Keywords" file line by line, which contains all the keywords involved in accounting data processing; match the accounting keywords one by one in the "Project Source Code Directory" file, record the number of code lines that match, and mark it as "Project Accounting Hit Files"; Scan and identify "project-related account keywords" through full-text search, match the keywords with execution code data, and record the results.

2. The enhanced coverage detection method of the account-related code based on JaCoCo according to claim 1 is characterized in that: The coverage rate of the account-related code is obtained by summarizing and calculating the unit test coverage rate of the entire project to obtain the final project account-related unit test coverage rate result.

3. An enhanced coverage detection system for account-related codes based on JaCoCo, characterized by: It includes a real-time data capture module, which is used to capture the code execution data in real time during the execution code test; connect to the data source through the configuration file to scan the data source, and scan all tables and fields involving the amount; record the scan results to a local file and mark it as "project account-related keywords"; read the "project account-related keywords" line by line, open the "project source code directory", read the contents of the java source code files in the "project source code directory" one by one by directory, perform full-text search and matching, record the hit java class and the number of code lines in the hit file, and mark it as "project account-related hit class file"; A data analysis module is used to analyze the code execution data using an intelligent analysis algorithm; use the JaCoCo tool to scan the code execution data and generate a JaCoCo report, import the JaCoCo report data into a database, and match it with the "project account-related hit class file" to record the unit test coverage of the hit Java class; A report generation module is used to generate a report based on the results of coverage detection; The real-time capture of code execution data during software development specifically includes the following steps: Use a configuration file to define database connection information and the tables and fields to be scanned; the configuration file includes the database URL, user name, password, and the table name and field name to be scanned; Read the configuration file and connect to the accounting database, scan all tables and fields involving amounts, record the scan results to a local file, and mark them as "keywords related to project accounts"; Configure the GitLab URL address of the project. By configuring the GitLab URL, project name, and access permissions, you can automatically obtain the latest project source code. Read the "Project Accounting Keywords" file line by line, which contains all the keywords involved in accounting data processing; match the accounting keywords one by one in the "Project Source Code Directory" file, record the number of code lines that match, and mark it as "Project Accounting Hit Files"; Scan and identify "project-related account keywords" through full-text search, match the keywords with execution code data, and record the results.

4. The enhanced coverage detection system for account-related codes based on JaCoCo according to claim 3 is characterized in that: It also includes an interactive user interface for displaying coverage detection results, generating various functional diagrams based on interactive functions, and realizing data screening and analysis.

5. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in claim 1 or 2 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method described in claim 1 or 3 are implemented.

Citation Information

Patent Citations

  • Coverage rate data processing method and device, computer equipment and storage medium

    CN115437905A

  • Automatic code scanning method and system

    CN116702151A