[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN113688031B - Test positioning method based on byte code enhancement technology - Google Patents

Test positioning method based on byte code enhancement technology Download PDF

Info

Publication number
CN113688031B
CN113688031B CN202110801329.8A CN202110801329A CN113688031B CN 113688031 B CN113688031 B CN 113688031B CN 202110801329 A CN202110801329 A CN 202110801329A CN 113688031 B CN113688031 B CN 113688031B
Authority
CN
China
Prior art keywords
code
test
byte code
enhancement
positioning
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.)
Active
Application number
CN202110801329.8A
Other languages
Chinese (zh)
Other versions
CN113688031A (en
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.)
Shanghai Pudong Development Bank Co Ltd
Original Assignee
Shanghai Pudong Development Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Pudong Development Bank Co Ltd filed Critical Shanghai Pudong Development Bank Co Ltd
Priority to CN202110801329.8A priority Critical patent/CN113688031B/en
Publication of CN113688031A publication Critical patent/CN113688031A/en
Application granted granted Critical
Publication of CN113688031B publication Critical patent/CN113688031B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/368Test management for test version control, e.g. updating test cases to a new software version
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention relates to a test positioning method based on a byte code enhancement technology, which comprises the following steps: configuring a byte code enhancement module; loading, analyzing and modifying a byte code file corresponding to the source code based on a byte code enhancement technology, and obtaining byte code static data; adding event buried points on the source code logic based on a byte code enhancement technology, and acquiring test information and code execution dynamic data when a test case is adopted for testing; and performing test positioning based on the static data of the byte code, the test information and the code execution dynamic data. Compared with the prior art, the invention has the advantages of simplicity, high efficiency, intelligence and the like.

Description

Test positioning method based on byte code enhancement technology
Technical Field
The invention relates to the technical field of software development and testing, in particular to a test positioning method based on a byte code enhancement technology.
Background
The common black box test in the current software test comprises the steps of initiating by a test department the means of system integration test, user acceptance test and the like, writing relevant test cases, and executing automatic test or manual test. Because the testers cannot know the structure and the condition of the internal running of the program, the testers and the developers cannot know whether the black cases are sufficient or not. Therefore, when writing test cases, the tester needs to communicate with the developer for a relatively long time to determine the test scope and boundary involved in the test.
The existing test scheme does not analyze the correlation between the source codes and the code execution records, and also does not analyze the calling relationship between classes and methods among the source codes, so that the source codes are not significant to testers, and therefore, the code execution records and coverage rate information thereof are also a data island for the testers, so that the testers have no correct standard rod when writing test cases, and can only determine test contents through continuous communication with developers.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide a test positioning method based on a byte code enhancement technology.
The aim of the invention can be achieved by the following technical scheme:
a test positioning method based on a bytecode enhancement technique, the method comprising:
configuring a byte code enhancement module;
loading, analyzing and modifying a byte code file corresponding to the source code based on a byte code enhancement technology, and obtaining byte code static data;
adding event buried points on the source code logic based on a byte code enhancement technology, and acquiring test information and code execution dynamic data when a test case is adopted for testing;
and performing test positioning based on the static data of the byte code, the test information and the code execution dynamic data.
Preferably, the specific way of configuring the byte code enhancement module is as follows: initializing a byte code enhancement module, connecting a JVM virtual machine through an Agent module, using an Attach Api provided by the JVM, attaching a proxy tool program to the JVM of each test system after the start of each test system is completed, loading enhancement expansion and reading enhancement configuration.
Preferably, the static data of the byte code comprises members, methods and annotation information related to each source code class, and method calls, member initialization and calls, abnormal intervals and code line records corresponding to the corresponding class.
Preferably, the manner of acquiring the static data of the byte code includes:
loading corresponding jar package information in the existing program, analyzing class files through a byte code enhancement technology, scanning the content of the class files all the time, and calling AgentClassVisistor to acquire member, method and annotation information related to the class corresponding to the class files when the corresponding content of the class files is scanned each time, and calling AgentMethodVisistor to acquire method call, member initialization and call, abnormal interval and code line record related to the corresponding class.
Preferably, the event burying point setting positions include a start position and an end position of the source code and a position after each line of codes.
Preferably, when the test case tests, when executing a certain code, the corresponding event embedded point after the code is triggered to generate corresponding code execution dynamic data.
Preferably, the test information includes a system name, an application name, a service name, service information in a request distributed architecture component, a test identifier, a case identifier, a user identifier, and a request identifier.
Preferably, the code execution dynamic data is log data, and the log data records the execution condition or coverage corresponding to the current code.
Preferably, the static data of the byte code, the test information and the dynamic data of the code execution are collected by the Kafka log module and sent to the test platform for unified processing to carry out test positioning.
Preferably, the test positioning specifically includes positioning code execution records related to source codes and coverage rate of test cases.
Compared with the prior art, the invention has the following advantages:
(1) Simpler: the tester can directly acquire the testing range of the current test through the developed code change;
(2) More efficient: the testers participate in the development work of the code level to a certain extent, and a plurality of problems which are difficult to communicate can be reflected from the code change;
(3) More intelligent: the test platform can recommend test cases according to code changes to obtain the maximum coverage of codes, and the test platform is more accurate than blind full-scale test.
Drawings
FIG. 1 is a flow chart of an implementation of a test positioning method based on a byte code enhancement technique of the present invention.
Detailed Description
The invention will now be described in detail with reference to the drawings and specific examples. Note that the following description of the embodiments is merely an example, and the present invention is not intended to be limited to the applications and uses thereof, and is not intended to be limited to the following embodiments.
Examples
A test positioning method based on a bytecode enhancement technique, the method comprising:
1. the byte code enhancement module is configured in the following specific modes: initializing a byte code enhancement module, connecting a JVM virtual machine through an Agent module, using an Attach Api provided by the JVM, attaching a proxy tool program to the JVM of each test system after the start of each test system is completed, loading enhancement expansion and reading enhancement configuration.
2. And loading, analyzing and modifying a byte code file corresponding to the source code based on the byte code enhancement technology, and obtaining byte code static data, wherein the byte code static data comprises members, methods and annotation information related to each type of the source code, and method calls, member initialization and call, abnormal intervals and code line records corresponding to the corresponding types.
The method for acquiring the static data of the byte code comprises the following steps:
loading corresponding jar package information in the existing program, analyzing class files through a byte code enhancement technology, scanning the content of the class files all the time, and calling AgentClassVisistor to acquire member, method and annotation information related to the class corresponding to the class files when the corresponding content of the class files is scanned each time, and calling AgentMethodVisistor to acquire method call, member initialization and call, abnormal interval and code line record related to the corresponding class.
3. Based on the byte code enhancement technology, event burial points are added on the source code logic, and test information and code execution dynamic data are obtained when test cases are adopted for testing.
The event buried point setting positions include the start and end positions of the source code and after each line of code. When the test case tests, when executing a certain code, the corresponding event embedded point behind the code is triggered to generate corresponding code execution dynamic data.
The test information includes a system name, an application name, a service name, service information in a request distributed architecture component, a test identifier, a case identifier, a user identifier, and a request identifier.
The code execution dynamic data is log data, and the log data records the execution condition or coverage corresponding to the current code.
4. And performing test positioning based on the static data of the byte code, the test information and the code execution dynamic data. The static data, the test information and the code execution dynamic data of the byte codes are collected by the Kafka log module and sent to the test platform for unified processing to carry out test positioning. The test positioning specifically comprises code execution records related to positioning source codes and coverage rate of test cases, and specifically comprises the following steps:
after the test platform acquires the content, the test platform can be combined with a source code program to analyze to obtain the following content:
(1) Checking global code coverage;
(2) Displaying the global coverage condition of the current class code corresponding to the source code;
(3) Statically analyzing class dependency relations from class files;
(4) The corresponding source code displays which classes the current class depends on;
(5) Recommending that the current class be referenced by those classes;
(6) Checking code coverage conditions related to execution of a certain use case based on the use case;
(7) Displaying a calling path of a use case method at a certain time;
(8) Displaying the code coverage condition related to the current branch corresponding to the source code;
(9) Displaying the current change related to the code coverage condition corresponding to the source code;
(10) The execution case checks the code coverage condition corresponding to the current change in a certain case;
(11) Executing records corresponding to the source code display cases;
(12) The corresponding source code recommends using some use case execution to obtain maximum coverage.
After the starting of each test system is completed, the JVM virtual machine is connected through an Agent module, a byte code file corresponding to the existing service is loaded, analyzed and modified, the existing byte code static data is obtained, event embedded point information is added on the original service logic, and therefore test information and code execution conditions in the current context are obtained in the service execution process. Therefore, the key point related to the invention mainly comprises two data acquisition methods of static data of the byte code and dynamic data of the code execution. After the static data of the byte code and the dynamic data of the code execution are obtained, the correlation between the code execution record related to the positioning source code and the coverage rate and the like can be solved by combining the test information and the source code. Furthermore, the tester can directly acquire the testing range of the current test through the developed code change, the tester participates in the development work of the code level to a certain extent, a plurality of problems which are difficult to communicate can be reflected on the code change, and the testing platform can recommend the testing case according to the code change so as to acquire the maximum coverage of the code, so that the testing platform is more accurate than blind full-scale testing.
The above embodiments are merely examples, and do not limit the scope of the present invention. These embodiments may be implemented in various other ways, and various omissions, substitutions, and changes may be made without departing from the scope of the technical idea of the present invention.

Claims (6)

1. A test positioning method based on a byte code enhancement technology is characterized by comprising the following steps:
configuring a byte code enhancement module;
loading, analyzing and modifying a byte code file corresponding to the source code based on a byte code enhancement technology, and obtaining byte code static data;
adding event buried points on the source code logic based on a byte code enhancement technology, and acquiring test information and code execution dynamic data when a test case is adopted for testing;
performing test positioning based on the static data of the byte code, the test information and the code execution dynamic data;
the byte code static data comprises members, methods, annotation information related to each class of source codes, method calls, member initialization and calls, abnormal intervals and code line records corresponding to the corresponding class;
the specific mode of the configuration byte code enhancement module is as follows: initializing a byte code enhancement module, connecting a JVM virtual machine through an Agent module, using an Attach Api provided by the JVM, attaching a proxy tool program to the JVM of each test system after the start of each test system is completed, loading enhancement expansion and reading enhancement configuration;
the event embedded point setting positions comprise a starting position and an ending position of source codes and a position behind each line of codes;
when the test case tests, when executing a certain code, the corresponding event embedded point behind the code is triggered to generate corresponding code execution dynamic data.
2. The method for positioning a test based on a bytecode enhancement technique according to claim 1, wherein the means for obtaining static data of the bytecode comprises:
loading corresponding jar package information in the existing program, analyzing class files through a byte code enhancement technology, scanning the content of the class files all the time, and calling AgentClassVisistor to acquire member, method and annotation information related to the class corresponding to the class files when the corresponding content of the class files is scanned each time, and calling AgentMethodVisistor to acquire method call, member initialization and call, abnormal interval and code line record related to the corresponding class.
3. The method of claim 1, wherein the test information includes a system name, an application name, a service name, service information in a request distributed architecture component, a test identifier, a case identifier, a user identifier, and a request identifier.
4. The method for positioning and testing based on the enhanced byte code technology according to claim 1, wherein the code execution dynamic data is log data, and the log data records the execution condition or coverage corresponding to the current code.
5. The method for testing and positioning based on the byte code enhancement technology according to claim 1, wherein the byte code static data, the test information and the code execution dynamic data are collected by the Kafka log module and sent to the test platform for unified processing for testing and positioning.
6. The method for positioning a test based on a bytecode enhancement technique according to claim 1, wherein the positioning of the test specifically includes positioning code execution records related to source codes and coverage of test cases.
CN202110801329.8A 2021-07-15 2021-07-15 Test positioning method based on byte code enhancement technology Active CN113688031B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110801329.8A CN113688031B (en) 2021-07-15 2021-07-15 Test positioning method based on byte code enhancement technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110801329.8A CN113688031B (en) 2021-07-15 2021-07-15 Test positioning method based on byte code enhancement technology

Publications (2)

Publication Number Publication Date
CN113688031A CN113688031A (en) 2021-11-23
CN113688031B true CN113688031B (en) 2024-03-26

Family

ID=78577113

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110801329.8A Active CN113688031B (en) 2021-07-15 2021-07-15 Test positioning method based on byte code enhancement technology

Country Status (1)

Country Link
CN (1) CN113688031B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116756092B (en) * 2023-08-23 2024-01-05 深圳红途科技有限公司 System download file marking method, device, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1276047A2 (en) * 2001-07-11 2003-01-15 Sun Microsystems, Inc. System controller for use in a distributed processing framework system and methods for implementing the same
KR20070052328A (en) * 2007-03-28 2007-05-21 텔레콤 이탈리아 소시에떼 퍼 아찌오니 Method and system for providing interactive services in digital television
CN106502896A (en) * 2016-10-21 2017-03-15 武汉斗鱼网络科技有限公司 A kind of generation method of function test code and device
CN107688530A (en) * 2017-04-06 2018-02-13 平安科技(深圳)有限公司 Method for testing software and device
CN112416794A (en) * 2020-12-03 2021-02-26 平安银行股份有限公司 Method, device and equipment for processing code coverage rate and storage medium
CN112612697A (en) * 2020-12-17 2021-04-06 航天信息股份有限公司 Software defect testing and positioning method and system based on byte code technology
CN113076253A (en) * 2021-04-16 2021-07-06 北京京东拓先科技有限公司 Test method and test device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1276047A2 (en) * 2001-07-11 2003-01-15 Sun Microsystems, Inc. System controller for use in a distributed processing framework system and methods for implementing the same
KR20070052328A (en) * 2007-03-28 2007-05-21 텔레콤 이탈리아 소시에떼 퍼 아찌오니 Method and system for providing interactive services in digital television
CN106502896A (en) * 2016-10-21 2017-03-15 武汉斗鱼网络科技有限公司 A kind of generation method of function test code and device
CN107688530A (en) * 2017-04-06 2018-02-13 平安科技(深圳)有限公司 Method for testing software and device
CN112416794A (en) * 2020-12-03 2021-02-26 平安银行股份有限公司 Method, device and equipment for processing code coverage rate and storage medium
CN112612697A (en) * 2020-12-17 2021-04-06 航天信息股份有限公司 Software defect testing and positioning method and system based on byte code technology
CN113076253A (en) * 2021-04-16 2021-07-06 北京京东拓先科技有限公司 Test method and test device

Also Published As

Publication number Publication date
CN113688031A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
US7647584B2 (en) Automation and isolation of software component testing
CN106325970A (en) Compiling method and compiling system
US8402446B2 (en) Associating probes with test cases
CN102541731B (en) Platform-agnostic diagnostic data collection and display
CN110716874B (en) Domestic operating system hardware compatibility testing method
CN112732576B (en) Automatic testing method, device and equipment based on user interface
CN103186463B (en) Determine the method and system of the test specification of software
CN113688031B (en) Test positioning method based on byte code enhancement technology
CN112612697A (en) Software defect testing and positioning method and system based on byte code technology
CN116450533B (en) Security detection method and device for application program, electronic equipment and medium
CN115456628A (en) Intelligent contract viewing method and device based on block chain, storage medium and equipment
CN113127367B (en) Defect detection method for Android dynamic permission application
CN115185570A (en) JIRA system-based task flow processing method, system, device, medium, and computer program product
CN114942887A (en) Program safety testing method, device, equipment and medium
CN114676436A (en) Android application multimedia analysis library vulnerability mining system and method based on structural variation
Esipchuk et al. PTF-based test automation for Java applications on mobile phones
CN112506782A (en) Application program testing method, device, equipment and storage medium
CN114780952B (en) Detection method, system and storage medium for sensitive application call scene
CN112131110A (en) Multisource heterogeneous data probe method and device of smart phone system
CN117056241B (en) Application program testing method and device for mobile terminal
CN112099838B (en) Method, device and storage medium for determining version difference
CN114003478A (en) Performance test method and device, electronic equipment and storage medium
CN112783759B (en) White box test task execution method and device, storage medium and computer equipment
CN113722233A (en) Code coverage rate determining method, system, storage medium and electronic equipment
CN117076288A (en) Dynamic debugging method and device for applications in ios

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
GR01 Patent grant
GR01 Patent grant