CN113986713A - Method and system for acquiring Java project code quality report - Google Patents

Method and system for acquiring Java project code quality report Download PDF

Info

Publication number
CN113986713A
CN113986713A CN202111072693.1A CN202111072693A CN113986713A CN 113986713 A CN113986713 A CN 113986713A CN 202111072693 A CN202111072693 A CN 202111072693A CN 113986713 A CN113986713 A CN 113986713A
Authority
CN
China
Prior art keywords
test
code
risk
checking
project code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111072693.1A
Other languages
Chinese (zh)
Inventor
王超
孟繁杰
安瑞娥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aisino Corp
Original Assignee
Aisino Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aisino Corp filed Critical Aisino Corp
Priority to CN202111072693.1A priority Critical patent/CN113986713A/en
Publication of CN113986713A publication Critical patent/CN113986713A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

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)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a system for acquiring a Java project code quality report, and belongs to the technical field of Java code quality improvement. The method comprises the following steps: step 1, configuring a code check item in an xml file of a preset white box test tool, and checking a code specification of a target project code after configuration is finished; step 2, if the coding standard is in compliance, configuring the risk checking item in an xml file of a preset white box test tool, and checking the coding risk of the target project code after the configuration is finished; and 3, if the coding risk is in compliance, selecting a preset white box test tool, carrying out layered test on the target project code, acquiring test data, and outputting the test data in the form of the test data as a quality report of the project code. According to the invention, various white box test tool technologies are integrated and configured, so that the research personnel can improve the code quality and improve the working efficiency in the encoding stage; the code detection item supports xml configuration, and is easy to use and maintain.

Description

Method and system for acquiring Java project code quality report
Technical Field
The present invention relates to the field of Java code quality promotion technology, and more particularly, to a method and system for obtaining Java project code quality reports.
Background
White box test tools based on java projects are available in the market at present, such as JUnit, TestNG, JTest, Findbugs, Checkstyle, an Ali code protocol plug-in, JacOCO, Eclemma and the like.
Disclosure of Invention
In view of the above problem, the present invention provides a method for obtaining a Java project code quality report, including:
step 1, configuring a code check item in an xml file of a preset white box test tool, and checking a code specification of a target project code after configuration is finished;
step 2, if the coding standard is in compliance, configuring the risk checking item in an xml file of a preset white box test tool, and checking the coding risk of the target project code after the configuration is finished;
and 3, if the coding risk is in compliance, selecting a preset white box test tool, carrying out layered test on the target project code, acquiring test data, and outputting the test data in the form of the test data as a quality report of the project code.
Optionally, the preset white-box test tools involved in step 1, step 2 and step 3 are the same or different.
Optionally, encoding the risk, comprising: risk of multithreading, risk of performance errors, and risk of poor practice.
Optionally, the layering test includes: simulating foreground access test, service test and database test;
the database test determines whether the expected output and the actual output are consistent.
Optionally, the method further comprises: presetting an execution task, wherein the execution task synchronizes the quality report to a public platform, and the public platform is used for viewing the quality report of the target project code.
The invention also provides a system for obtaining the Java project code quality report, which comprises:
the code specification checking unit is used for configuring the code checking item in an xml file of a preset white box test tool and checking the code specification of the target project code after the configuration is finished;
the coding risk checking unit is used for configuring the risk checking item in an xml file of a preset white box testing tool after the coding standard is in compliance, and checking the coding risk of the target project code after the configuration is finished;
and the test unit selects a preset white box test tool after the coding risk compliance, performs hierarchical test on the target project code, acquires test data, and outputs the test data in the form of the test data as a quality report of the project code.
Optionally, the preset white-box test tools involved in step 1, step 2 and step 3 are the same or different.
Optionally, encoding the risk, comprising: risk of multithreading, risk of performance errors, and risk of poor practice.
Optionally, the layering test includes: simulating foreground access test, service test and database test;
the database test determines whether the expected output and the actual output are consistent.
Optionally, the test unit is further configured to: presetting an execution task, wherein the execution task synchronizes the quality report to a public platform, and the public platform is used for viewing the quality report of the target project code.
According to the invention, various white box test tool technologies are integrated and configured, so that the research personnel can improve the code quality and improve the working efficiency in the encoding stage; the code detection item supports xml configuration, and is easy to use and maintain.
Drawings
FIG. 1 is a flow chart of the method of the present invention;
FIG. 2 is a block diagram of the system of the present invention.
Detailed Description
The exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, however, the present invention may be embodied in many different forms and is not limited to the embodiments described herein, which are provided for complete and complete disclosure of the present invention and to fully convey the scope of the present invention to those skilled in the art. The terminology used in the exemplary embodiments illustrated in the accompanying drawings is not intended to be limiting of the invention. In the drawings, the same units/elements are denoted by the same reference numerals.
Unless otherwise defined, terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. Further, it will be understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense.
The invention provides a method for obtaining a Java project code quality report, as shown in FIG. 1, comprising:
step 1, configuring a code check item in an xml file of a preset white box test tool, and checking a code specification of a target project code after configuration is finished;
step 2, if the coding standard is in compliance, configuring the risk checking item in an xml file of a preset white box test tool, and checking the coding risk of the target project code after the configuration is finished;
and 3, if the coding risk is in compliance, selecting a preset white box test tool, carrying out layered test on the target project code, acquiring test data, and outputting the test data in the form of the test data as a quality report of the project code.
The invention is further illustrated by the following examples:
the invention selects JUnit on the test, an Ali code protocol plug-in on the code specification check, Findbugs on the code risk control, Eclemma on the code coverage, Jenkins on the integration tool and Sonar on the quality platform, and the technologies summarize a set of tool for improving the quality of project codes capable of being configured integrally through the exploration and practice in 51 cloud invoicing projects.
The tool for improving the quality of the project code is convenient for research and development personnel, testing personnel, maintenance personnel and project QA personnel to use, is easy to maintain, reduces the review code time of the research and development personnel, improves the code quality, automatically issues the code coverage rate and generates a code quality report for related personnel in the project to check and analyze.
With the increasing complexity of projects today, there is an ongoing involvement of developers at any time in the project. To guarantee the quality of the project, more potential bugs and risks should be throttled in advance in the encoding phase. This requires the code quality inspection to be assisted by a set of code quality improvement tools capable of being configured integrally, and the implementation steps are as follows:
the method comprises the following steps: in an ari coding protocol plug-in, a coding check item is configured in an xml file in advance, and after the configuration is finished, an automatic check function is opened;
step two: in the Findbugs plug-in, allocating risk checking items in an xml file in advance (such as multithreading risk, performance error, poor practice and the like), and opening an automatic checking function after the allocation is finished;
step three: simulating a foreground access test by using a unit mock method on a Controller layer;
step four: using a unit compiling unit to test and carry out Service test on a Service layer;
step five: performing a database operation test by using a unit writing test at a Dao layer, and judging whether an expected output is consistent with an actual output by using an assertesquares method;
step six: a timed execution task is configured in Jenkins to synchronize the project quality condition to a Sonar platform, and related personnel in the project can check and analyze a code quality report of a current project by logging in the Sonar platform.
According to the invention, various white box test tool technologies are integrated and configured, so that research personnel can improve the code quality and improve the working efficiency through a unit test technology and a static code inspection technology at the encoding stage; the code detection item supports xml configuration, and is easy to use and maintain; project managers can view and analyze the code quality report of the current project through the Sonar platform.
The present invention also proposes a system 200 for obtaining a Java project code quality report, as shown in fig. 2, comprising:
the code specification checking unit 201 is used for configuring the code checking item in an xml file of a preset white box test tool, and checking the code specification of the target project code after the configuration is finished;
the coding risk checking unit 202 is used for configuring the risk checking item in an xml file of a preset white box test tool after the coding standard is in compliance, and checking the coding risk of the target project code after the configuration is finished;
and the test unit 203 selects a preset white box test tool after the coding risk compliance, performs hierarchical test on the target project code, acquires test data, and outputs the test data in the form of a quality report as the project code.
Wherein, the preset white box test tools involved in step 1, step 2 and step 3 are the same or different.
Wherein encoding the risk comprises: risk of multithreading, risk of performance errors, and risk of poor practice.
Wherein, the layering test includes: simulating foreground access test, service test and database test;
the database test determines whether the expected output and the actual output are consistent.
Wherein the test unit 203 is further configured to: presetting an execution task, wherein the execution task synchronizes the quality report to a public platform, and the public platform is used for viewing the quality report of the target project code.
The invention integrates and configures a plurality of white box testing technologies, and can run through the white box testing of the whole flow of the java project. Every branch and path in the code can be detected, the risk and error hidden in the code are revealed, and the code is tested thoroughly. The invention greatly reduces the workload of manual review code, particularly in the regression test of the project, the system automatically executes all unit test scripts to generate a code quality inspection report, thereby reducing the labor input of the project and reducing the cost of later-stage project maintenance.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein. The scheme in the embodiment of the invention can be realized by adopting various computer languages, such as object-oriented programming language Java and transliterated scripting language JavaScript.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (10)

1. A method for obtaining a Java project code quality report, the method comprising:
step 1, configuring a code check item in an xml file of a preset white box test tool, and checking a code specification of a target project code after configuration is finished;
step 2, if the coding standard is in compliance, configuring the risk checking item in an xml file of a preset white box test tool, and checking the coding risk of the target project code after the configuration is finished;
and 3, if the coding risk is in compliance, selecting a preset white box test tool, carrying out layered test on the target project code, acquiring test data, and outputting the test data in the form of the test data as a quality report of the project code.
2. The method of claim 1, wherein the predetermined white-box test tools involved in steps 1, 2 and 3 are the same or different.
3. The method of claim 1, the encoding a risk, comprising: risk of multithreading, risk of performance errors, and risk of poor practice.
4. The method of claim 1, the hierarchical testing comprising: simulating foreground access test, service test and database test;
the database test determines whether the expected output and the actual output are consistent.
5. The method of claim 1, further comprising: presetting an execution task, wherein the execution task synchronizes the quality report to a public platform, and the public platform is used for viewing the quality report of the target project code.
6. A system for obtaining Java project code quality reports, the system comprising:
the code specification checking unit is used for configuring the code checking item in an xml file of a preset white box test tool and checking the code specification of the target project code after the configuration is finished;
the coding risk checking unit is used for configuring the risk checking item in an xml file of a preset white box testing tool after the coding standard is in compliance, and checking the coding risk of the target project code after the configuration is finished;
and the test unit selects a preset white box test tool after the coding risk compliance, performs hierarchical test on the target project code, acquires test data, and outputs the test data in the form of the test data as a quality report of the project code.
7. The system of claim 6, wherein the predetermined white-box test tools involved in steps 1, 2 and 3 are the same or different.
8. The system of claim 6, the encoded risk, comprising: risk of multithreading, risk of performance errors, and risk of poor practice.
9. The system of claim 6, the tiered test comprising: simulating foreground access test, service test and database test;
the database test determines whether the expected output and the actual output are consistent.
10. The system of claim 6, the test unit further to: presetting an execution task, wherein the execution task synchronizes the quality report to a public platform, and the public platform is used for viewing the quality report of the target project code.
CN202111072693.1A 2021-09-14 2021-09-14 Method and system for acquiring Java project code quality report Pending CN113986713A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111072693.1A CN113986713A (en) 2021-09-14 2021-09-14 Method and system for acquiring Java project code quality report

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111072693.1A CN113986713A (en) 2021-09-14 2021-09-14 Method and system for acquiring Java project code quality report

Publications (1)

Publication Number Publication Date
CN113986713A true CN113986713A (en) 2022-01-28

Family

ID=79735773

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111072693.1A Pending CN113986713A (en) 2021-09-14 2021-09-14 Method and system for acquiring Java project code quality report

Country Status (1)

Country Link
CN (1) CN113986713A (en)

Similar Documents

Publication Publication Date Title
CN103365770B (en) Mobile terminal software test macro and method for testing software
US7895565B1 (en) Integrated system and method for validating the functionality and performance of software applications
Sharma Quantitative analysis of automation and manual testing
CN103984612B (en) A kind of method of the unattended pressure test based on HPL instruments
US20120209557A1 (en) Methods, apparatus and articles of manufacture to test batch configurations
EP2546749A1 (en) Method and system for test suite control
CA2773981C (en) System and method of substituting parameter sets in self-contained mini-applications
US7895575B2 (en) Apparatus and method for generating test driver
CN107463362A (en) The method and system of lasting deployment based on multiple Jenkins
CN106708718A (en) Service framework interface testing method and device
CN105786695A (en) Data test method and system
CN106776326B (en) Modeling method and system of data analysis model
CN110532021B (en) Processing method of configuration file of distributed control system, client and service device
CN110910081A (en) Workflow configuration implementation method and system based on laboratory information management system
CN105591779A (en) Method and device for inspecting network element
CN112131116A (en) Automatic regression testing method for embedded software
CN104133768A (en) Program code review method and program code review device
CN111611157A (en) Automatic testing method and system for GMS continuous integration construction
US10592703B1 (en) Method and system for processing verification tests for testing a design under test
US20180217922A1 (en) Application testing
CN116069334B (en) Cloud-protogenesis-based online development and code hosting method and system
CN111767205A (en) Online detection method and system supporting task splitting
CN113986713A (en) Method and system for acquiring Java project code quality report
KR20200145269A (en) Test automation system
KR20120111618A (en) Apparatus and method for testing plc command

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