WO2019200800A1 - Test effect display method for test case, electronic device, and storage medium - Google Patents

Test effect display method for test case, electronic device, and storage medium Download PDF

Info

Publication number
WO2019200800A1
WO2019200800A1 PCT/CN2018/102100 CN2018102100W WO2019200800A1 WO 2019200800 A1 WO2019200800 A1 WO 2019200800A1 CN 2018102100 W CN2018102100 W CN 2018102100W WO 2019200800 A1 WO2019200800 A1 WO 2019200800A1
Authority
WO
WIPO (PCT)
Prior art keywords
test
static
tested
method chain
chain
Prior art date
Application number
PCT/CN2018/102100
Other languages
French (fr)
Chinese (zh)
Inventor
毛皓
邹文涛
王旭辉
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019200800A1 publication Critical patent/WO2019200800A1/en

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/323Visualisation of programs or trace data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information

Definitions

  • the present application relates to the field of computer technology, and in particular, to a test effect display method, an electronic device, and a readable storage medium for a test case.
  • the dynamic link refers to a method chain and the like that are passed through a dynamic process in which a system to be tested initiates an http request to a web server.
  • the user can only know the current method chain of the test case when performing the dynamic link test on the test system, and cannot let the user know the method chain hierarchy in the system to be tested, and the user cannot determine.
  • the other method chains in the system to be tested are not executed, that is, the user cannot completely measure the execution effect when using the test case to test the test system.
  • the purpose of the present application is to provide a test case display method, an electronic device, and a readable storage medium, which are intended to fully display to a user the execution effect when using a test case to test a test system.
  • a first aspect of the present application provides an electronic device, where the electronic device includes a memory and a processor, and the memory stores a test effect display system of a test case executable on the processor.
  • the test effect of the test case shows that the system is implemented by the processor to implement the following steps:
  • the code of the test system is analyzed, and a static call structure between each method in the system code to be tested is obtained, and each static method chain in the system code to be tested is established according to the static call structure;
  • the tested method chain and other untested static method chains in each static method chain displayed are differentiated to display the test execution effect of the test case to the user.
  • the second aspect of the present application further provides a test effect display method for a test case, and the test effect display method of the test case includes:
  • the code of the test system is analyzed, and a static call structure between each method in the system code to be tested is obtained, and each static method chain in the system code to be tested is established according to the static call structure;
  • the tested method chain and other untested static method chains in each static method chain displayed are differentiated to display the test execution effect of the test case to the user.
  • a third aspect of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a test effect display system of a test case, and the test effect display system of the test case can be Executed by at least one processor to cause the at least one processor to perform the steps of the test effect presentation method of the test case as described above.
  • test effect display method, system and readable storage medium of the test case proposed by the present application by analyzing the code of the test system, obtaining a static call structure between each method in the system code to be tested, and according to the static call structure Establishing each static method chain in the system code to be tested; displaying each static method chain according to the static call structure; recording the test case when performing a dynamic link test on the system to be tested in a preset test case
  • the method chain that flows through the dynamic link test execution process, and distinguishes between the method chain and other untested static method chains that are displayed in the dynamic link test execution process in each static method chain. To show the test results of the test case to the user.
  • each static method chain of the system to be tested can be displayed in a static call structure
  • the user can intuitively know the method chain hierarchy in the system to be tested, and by testing in each static method chain displayed by the static call structure.
  • the method chain and other method chains are differentiated and identified, and the user can intuitively know the method chain of the currently executed test in the system to be tested and the method chain that has not yet executed the test, thereby realizing A visual demonstration of the performance of the test case, allowing the user to fully measure the performance of the test case when testing the test system.
  • FIG. 1 is a schematic diagram of an operating environment of a preferred embodiment of a test effect display system 10 of a test case of the present application;
  • FIG. 2 is a schematic flowchart diagram of an embodiment of a test effect display method of a test case of the present application.
  • FIG. 1 is a schematic diagram of an operating environment of a preferred embodiment of the test effect display system 10 of the test case of the present application.
  • test effect display system 10 of the test case is installed and operated in the electronic device 1.
  • the electronic device 1 may include, but is not limited to, a memory 11, a processor 12, and a display 13.
  • Figure 1 shows only the electronic device 1 with components 11-13, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
  • the memory 11 is at least one type of readable computer storage medium, which in some embodiments may be an internal storage unit of the electronic device 1, such as a hard disk or memory of the electronic device 1.
  • the memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in hard disk equipped on the electronic device 1, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc.
  • the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
  • the memory 11 is configured to store application software and various types of data installed in the electronic device 1, such as program code of the test effect display system 10 of the test case.
  • the memory 11 can also be used to temporarily store data that has been output or is about to be output.
  • the processor 12 in some embodiments, may be a central processing unit (CPU), a microprocessor or other data processing chip for running program code or processing data stored in the memory 11, for example
  • the test effect display system 10 and the like of the test case are executed.
  • the display 13 in some embodiments may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch sensor, or the like.
  • the display 13 is configured to display information processed in the electronic device 1 and a user interface for displaying visualization, such as each static method chain in the system to be tested displayed in a static call structure, on the tested method chain, and not The static method chain of the test is used to distinguish the display interface after the identification.
  • the components 11-13 of the electronic device 1 communicate with one another via a system bus.
  • the test effect display system 10 of the test case includes at least one computer readable instruction stored in the memory 11, the at least one computer readable instruction being executable by the processor 12 to implement various embodiments of the present application.
  • test effect display system 10 of the above test case is implemented by the processor 12 to implement the following steps:
  • Step S1 analyzing the code of the system to be tested, obtaining a static call structure between each method in the system code to be tested, and establishing each static method chain in the system code to be tested according to the static call structure.
  • ASM package to analyze the class file of the test system code, analyze the static call structure between the various methods in the system code to be tested; and use the static call structure of the analysis to obtain the static of the system code to be tested.
  • Method chain ASM is a java bytecode manipulation framework, which can be used to dynamically generate classes or enhance the functionality of existing classes. Java classes are stored in .class files defined by strict formats. These class files have enough metadata to resolve all the elements in the class: class names, methods, properties, and Java bytecode (instructions). After reading the information from the class file, ASM can analyze the class information and parse the compiled class bytecode file.
  • the Asm package can be used to perform line-by-line analysis of the test system code, and obtain the calling relationship of each method between different classes in the system code to be tested.
  • each method in a class has a corresponding code block, and the calling relationship (ie, the calling structure) between the corresponding methods can be obtained according to the calling relationship between the code blocks.
  • the method chain is a combination of a plurality of methods having a calling relationship. According to the calling structure between each method in a class, a plurality of method chains in a class combined by a plurality of methods having a calling relationship may be obtained. As a static method chain.
  • Step S2 displaying each static method chain according to the static display structure according to a preset display rule.
  • the static call structure of the analysis and the obtained static method chains of the system code to be tested are visually displayed according to preset display rules.
  • a method call structure tree with a master node and a child node may be constructed according to a static call structure between each method in the system code to be tested, and the corresponding tree structure division rule is: different classes for the system code to be tested, such as different functions. Modules are set to corresponding master nodes; each master node, ie, several methods under each class, sequentially form child nodes of each level according to the static call structure between the methods; wherein, the method calls a method of calling relationships in the structure tree Synthesize static method chains.
  • Step S3 when performing a dynamic link test on the system to be tested in a preset test case, recording a method chain that the test case flows through during the execution of the dynamic link test, and displaying each static method chain The static method chain corresponding to the method chain flowing through is found as the tested method chain.
  • Step S4 distinguishing between the tested method chain and other untested static method chains in each static method chain that is displayed, so as to display the test execution effect of the test case to the user.
  • the dynamic link refers to a method chain that passes through a dynamic process in which a system to be tested initiates an http request to a web server. Record the method chain that the test case flows through during the execution of the dynamic link test, and find the static method chain corresponding to the method chain flowing through in the static call structure and the static method chain of the system code to be tested.
  • the static method chain corresponding to the method chain flowing through is distinguished from other static method chains in each static method chain of the system code to be tested (eg, different colors are respectively labeled, highlighted, marked, etc.).
  • the static method chain corresponding to the method chain through which the dynamic link of the system to be tested is tested is lit or green.
  • the annotation display is displayed, and the other static method chains displayed in the method call structure tree are not lit or marked in red.
  • the user can intuitively know the effect of the test case execution by calling the structure tree through the displayed method, by distinguishing the static method chain corresponding to the method chain flowing through the displayed system to be tested and the static call structure of the entire system to be tested.
  • the user can intuitively know the currently executed method chain and the method chain that has not been executed, so as to realize the visual display case execution effect, so that the user can statically call the structure and dynamic link test between the methods in the system code to be tested. These two aspects are a complete measure of the effectiveness of test case execution.
  • the static call structure between the methods in the system code to be tested is obtained by analyzing the code of the system to be tested, and each static method chain in the system code to be tested is established according to the static call structure; each static method is The chain is displayed according to the static call structure; when the dynamic test of the system to be tested is performed on the preset test case, the method chain that the test case flows during the execution of the dynamic link test is recorded, and The method chain and other untested static method chains flowing in the dynamic link test execution process in each static method chain are displayed to distinguish the test results of the test cases to the user.
  • each static method chain of the system to be tested can be displayed in a static call structure
  • the user can intuitively know the method chain hierarchy in the system to be tested, and by testing in each static method chain displayed by the static call structure.
  • the method chain and other method chains are differentiated and identified, and the user can intuitively know the method chain of the currently executed test in the system to be tested and the method chain that has not yet executed the test, thereby realizing A visual demonstration of the performance of the test case, allowing the user to fully measure the performance of the test case when testing the test system.
  • the test effect display system 10 of the test case when executed by the processor 12 to implement the step S2, the method specifically includes:
  • each static method chain is drawn according to the static call structure to generate a scalable vector graphic for visual display.
  • the Graphviz package when the static call structure and the static method chain corresponding to the method chain flowing through are displayed, the Graphviz package can be used to generate svg for visual display.
  • Graphviz is an open source graphics rendering tool developed by AT&T Labs Research. It uses a specific DSL (domain specific language): dot as the scripting language, then uses the layout engine to parse the script and complete the automatic layout. It can be easily used to draw a structured graphical network.
  • Graphviz provides a rich export format, such as commonly used image formats, SVG, PDF and so on. In this embodiment, graphviz is used to draw and display a static call structure, which can effectively ensure the quality and speed of the generated image.
  • the final display format in this embodiment adopts svg (scalable vector graphics) format, Internet Explorer 9, Firefox, Google Chrome, Opera and Safari all support SVG, so it is more convenient for users to open static display of viewing display through web browser.
  • svg scalable vector graphics
  • the structure and the static method chain corresponding to the method chain flowing through it flexibly display the effect of the case visualization for the user and are more practical.
  • the method when the test effect display system 10 of the test case is executed by the processor 12 to implement the step S3, the method includes:
  • Javassist is an open source java bytecode manipulation tool that mainly modifies and processes the compiled class files.
  • the javassist toolkit is first configured as a javaagent proxy.
  • the web (website) server is started, the javaagent agent is used to intercept the class file before loading or loading the software system to be tested, and the bytecode is modified.
  • test cases in this case include interface test cases, WEB (web) test cases, and so on.
  • the test case can be a personalized test case written in a targeted manner, or it can be a common test case.
  • test effect display system 10 of the test case when executed by the processor 12, the following steps are also implemented:
  • the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  • the prompt information may be sent to the user for the test result in the display interface.
  • the red identifier may be turned into a green logo or a highlight reminder, or sent to the user. SMS and other warnings. Otherwise, stay red. Users can more intuitively know the test results of the corresponding method chain when each test case is executed.
  • test effect display system 10 of the test case when executed by the processor 12, the following steps are also implemented:
  • the test system needs to be tested by the test case, if the test case flows through the dynamic link test execution process.
  • the static method chain corresponding to the method chain is displayed in the method call structure tree (such as the red mark), and further, the static method chain that has not been tested by the test case in the class may be identified ( For example, the standard yellow), for the user to select the corresponding test case for the static method chain of the standard yellow for targeted testing. In this way, the user can clarify the case execution process and the case omission process to improve the test results of the test system when the code changes.
  • FIG. 2 is a schematic flowchart of an embodiment of a test effect display method of a test case of the present application.
  • the test effect display method of the test case includes the following steps:
  • Step S10 analyzing the code of the system to be tested, obtaining a static call structure between each method in the system code to be tested, and establishing each static method chain in the system code to be tested according to the static call structure.
  • ASM package to analyze the class file of the test system code, analyze the static call structure between the various methods in the system code to be tested; and use the static call structure of the analysis to obtain the static of the system code to be tested.
  • Method chain ASM is a java bytecode manipulation framework, which can be used to dynamically generate classes or enhance the functionality of existing classes. Java classes are stored in .class files defined by strict formats. These class files have enough metadata to resolve all the elements in the class: class names, methods, properties, and Java bytecode (instructions). After reading the information from the class file, ASM can analyze the class information and parse the compiled class bytecode file.
  • the Asm package can be used to perform line-by-line analysis of the test system code, and obtain the calling relationship of each method between different classes in the system code to be tested.
  • each method in a class has a corresponding code block, and the calling relationship (ie, the calling structure) between the corresponding methods can be obtained according to the calling relationship between the code blocks.
  • the method chain is a combination of a plurality of methods having a calling relationship. According to the calling structure between each method in a class, a plurality of method chains in a class combined by a plurality of methods having a calling relationship may be obtained. As a static method chain.
  • Step S20 displaying each static method chain according to the static display structure according to a preset display rule.
  • the static call structure of the analysis and the obtained static method chains of the system code to be tested are visually displayed according to preset display rules.
  • a method call structure tree with a master node and a child node may be constructed according to a static call structure between each method in the system code to be tested, and the corresponding tree structure division rule is: different classes for the system code to be tested, such as different functions. Modules are set to corresponding master nodes; each master node, ie, several methods under each class, sequentially form child nodes of each level according to the static call structure between the methods; wherein, the method calls a method of calling relationships in the structure tree Synthesize static method chains.
  • Step S30 when performing a dynamic link test on the system to be tested in a preset test case, recording a method chain that the test case flows during the execution of the dynamic link test, and displaying each static method chain The static method chain corresponding to the method chain flowing through is found as the tested method chain.
  • Step S40 Perform a differentiated identification on the tested method chain and other untested static method chains in each static method chain that is displayed, so as to display the test execution effect of the test case to the user.
  • the dynamic link refers to a method chain that passes through a dynamic process in which a system to be tested initiates an http request to a web server. Record the method chain that the test case flows through during the execution of the dynamic link test, and find the static method chain corresponding to the method chain flowing through in the static call structure and the static method chain of the system code to be tested.
  • the static method chain corresponding to the method chain flowing through is distinguished from other static method chains in each static method chain of the system code to be tested (eg, different colors are respectively labeled, highlighted, marked, etc.).
  • the static method chain corresponding to the method chain through which the dynamic link of the system to be tested is tested is lit or green.
  • the annotation display is displayed, and the other static method chains displayed in the method call structure tree are not lit or marked in red.
  • the user can intuitively know the effect of the test case execution by calling the structure tree through the displayed method, by distinguishing the static method chain corresponding to the method chain flowing through the displayed system to be tested and the static call structure of the entire system to be tested.
  • the user can intuitively know the currently executed method chain and the method chain that has not been executed, so as to realize the visual display case execution effect, so that the user can statically call the structure and dynamic link test between the methods in the system code to be tested. These two aspects are a complete measure of the effectiveness of test case execution.
  • the static call structure between the methods in the system code to be tested is obtained by analyzing the code of the system to be tested, and each static method chain in the system code to be tested is established according to the static call structure; each static method is The chain is displayed according to the static call structure; when the dynamic test of the system to be tested is performed on the preset test case, the method chain that the test case flows during the execution of the dynamic link test is recorded, and The method chain and other untested static method chains flowing in the dynamic link test execution process in each static method chain are displayed to distinguish the test results of the test cases to the user.
  • each static method chain of the system to be tested can be displayed in a static call structure
  • the user can intuitively know the method chain hierarchy in the system to be tested, and by testing in each static method chain displayed by the static call structure.
  • the method chain and other method chains are differentiated and identified, and the user can intuitively know the method chain of the currently executed test in the system to be tested and the method chain that has not yet executed the test, thereby realizing A visual demonstration of the performance of the test case, allowing the user to fully measure the performance of the test case when testing the test system.
  • the step S20 includes:
  • each static method chain is drawn according to the static call structure to generate a scalable vector graphic for visual display.
  • the Graphviz package when the static call structure and the static method chain corresponding to the method chain flowing through are displayed, the Graphviz package can be used to generate svg for visual display.
  • Graphviz is an open source graphics rendering tool developed by AT&T Labs Research. It uses a specific DSL (domain specific language): dot as the scripting language, then uses the layout engine to parse the script and complete the automatic layout. It can be easily used to draw a structured graphical network.
  • Graphviz provides a rich export format, such as commonly used image formats, SVG, PDF and so on. In this embodiment, graphviz is used to draw and display a static call structure, which can effectively ensure the quality and speed of the generated image.
  • the final display format in this embodiment adopts svg (scalable vector graphics) format, Internet Explorer 9, Firefox, Google Chrome, Opera and Safari all support SVG, so it is more convenient for users to open static display of viewing display through web browser.
  • svg scalable vector graphics
  • the structure and the static method chain corresponding to the method chain flowing through it flexibly display the effect of the case visualization for the user and are more practical.
  • step S30 includes:
  • Javassist is an open source java bytecode manipulation tool that mainly modifies and processes the compiled class files.
  • the javassist toolkit is first configured as a javaagent proxy.
  • the web (website) server is started, the javaagent agent is used to intercept the class file before loading or loading the software system to be tested, and the bytecode is modified.
  • test cases in this case include interface test cases, WEB (web) test cases, and so on.
  • the test case can be a personalized test case written in a targeted manner, or it can be a common test case.
  • the method further includes:
  • the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  • the prompt information may be sent to the user for the test result in the display interface.
  • the red identifier may be turned into a green logo or a highlight reminder, or sent to the user. SMS and other warnings. Otherwise, stay red. Users can more intuitively know the test results of the corresponding method chain when each test case is executed.
  • the method further includes:
  • the test system needs to be tested by the test case, if the test case flows through the dynamic link test execution process.
  • the static method chain corresponding to the method chain is displayed in the method call structure tree (such as the red mark), and further, the static method chain that has not been tested by the test case in the class may be identified ( For example, the standard yellow), for the user to select the corresponding test case for the static method chain of the standard yellow for targeted testing. In this way, the user can clarify the case execution process and the case omission process to improve the test results of the test system when the code changes.
  • the present application further provides a computer readable storage medium storing a test effect display system of a test case, the test effect display system of the test case being executable by at least one processor, so that The at least one processor performs the steps of the test effect display method of the test case in the above embodiment, and the specific implementation processes of the steps S10, S20, and S30 of the test effect display method of the test case are as described above, and Let me repeat.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.

Landscapes

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

Abstract

The present application relates to a test effect display method for a test case, an electronic device, and a readable storage medium. The method comprises: analyzing a code of a system to be tested to obtain a static invoking structure among different methods in the code, and establishing different static method chaining according to the static invoking structure; displaying the static method chaining by the static invoking structure on the basis of a preset display rule; recording the method chaining flowing in the dynamic link test execution process when executing a dynamic link test for the system to be tested in a preset test case, and locating the static method chaining corresponding to the flown method chaining in the displayed different static method chaining and using same as a tested method chaining; and distinguishing and identifying the tested method chaining in the displayed different static method chaining and other untested static method chaining to display the test execution effect of the test case to a user. The present application achieves virtual display of the test case execution effect.

Description

测试案例的测试效果展示方法、电子装置及存储介质Test effect display method, electronic device and storage medium of test case
优先权申明Priority claim
本申请基于巴黎公约申明享有2018年04月17日递交的申请号为CN 2018103450304、名称为“测试案例的测试效果展示方法、电子装置及存储介质”中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。The present application is based on the priority of the Chinese Patent Application entitled "Test Case Display Method, Electronic Device and Storage Medium", filed on April 17, 2018, with the application number CN 2018103450304, which is filed on April 17, 2018. The entire content is incorporated herein by reference.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种测试案例的测试效果展示方法、电子装置及可读存储介质。The present application relates to the field of computer technology, and in particular, to a test effect display method, an electronic device, and a readable storage medium for a test case.
背景技术Background technique
在利用测试案例对待测试系统进行测试时,有时需针对待测试系统的动态链路进行测试。该动态链路指的是在待测试系统向web服务器发起http请求的动态过程中所经过的方法链等。现有的测试方案中,用户只能获知测试案例在对待测试系统执行动态链路测试时当前经过的方法链的情况,而无法让用户获知待测试系统中的方法链层次结构,用户也无法确定待测试系统中还有哪些方法链没被执行,即无法让用户完整衡量利用测试案例对待测试系统进行测试时的执行效果。When testing a test system with a test case, it is sometimes necessary to test the dynamic link of the system to be tested. The dynamic link refers to a method chain and the like that are passed through a dynamic process in which a system to be tested initiates an http request to a web server. In the existing test solution, the user can only know the current method chain of the test case when performing the dynamic link test on the test system, and cannot let the user know the method chain hierarchy in the system to be tested, and the user cannot determine. The other method chains in the system to be tested are not executed, that is, the user cannot completely measure the execution effect when using the test case to test the test system.
发明内容Summary of the invention
本申请的目的在于提供一种测试案例的测试效果展示方法、电子装置及可读存储介质,旨在向用户完整展示利用测试案例对待测试系统进行测试时的执行效果。The purpose of the present application is to provide a test case display method, an electronic device, and a readable storage medium, which are intended to fully display to a user the execution effect when using a test case to test a test system.
为实现上述目的,本申请第一方面提供一种电子装置,所述电子装置包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的测试案例的测试效果展示系统,所述测试案例的测试效果展示系统被所述处理器执行时实现如下步骤:In order to achieve the above object, a first aspect of the present application provides an electronic device, where the electronic device includes a memory and a processor, and the memory stores a test effect display system of a test case executable on the processor. The test effect of the test case shows that the system is implemented by the processor to implement the following steps:
对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;The code of the test system is analyzed, and a static call structure between each method in the system code to be tested is obtained, and each static method chain in the system code to be tested is established according to the static call structure;
基于预设展示规则将各个静态方法链按所述静态调用结构进行展示;Displaying each static method chain according to the static call structure according to a preset display rule;
在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并在展示的各个静态方法链中找到与流经的方法链对应的静态方法链作为已 测试方法链;Recording a method chain that the test case flows during dynamic link test execution during a dynamic test of the system to be tested in a preset test case, and finding and analyzing each static method chain displayed The static method chain corresponding to the method chain flowing through as the tested method chain;
对展示的各个静态方法链中的已测试方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试执行效果展示给用户。The tested method chain and other untested static method chains in each static method chain displayed are differentiated to display the test execution effect of the test case to the user.
此外,为实现上述目的,本申请第二方面还提供一种测试案例的测试效果展示方法,所述测试案例的测试效果展示方法包括:In addition, in order to achieve the above object, the second aspect of the present application further provides a test effect display method for a test case, and the test effect display method of the test case includes:
对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;The code of the test system is analyzed, and a static call structure between each method in the system code to be tested is obtained, and each static method chain in the system code to be tested is established according to the static call structure;
基于预设展示规则将各个静态方法链按所述静态调用结构进行展示;Displaying each static method chain according to the static call structure according to a preset display rule;
在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并在展示的各个静态方法链中找到与流经的方法链对应的静态方法链作为已测试方法链;Recording a method chain that the test case flows during dynamic link test execution during a dynamic test of the system to be tested in a preset test case, and finding and analyzing each static method chain displayed The static method chain corresponding to the method chain flowing through as the tested method chain;
对展示的各个静态方法链中的已测试方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试执行效果展示给用户。The tested method chain and other untested static method chains in each static method chain displayed are differentiated to display the test execution effect of the test case to the user.
进一步地,为实现上述目的,本申请第三方面还提供一种计算机可读存储介质,所述计算机可读存储介质存储有测试案例的测试效果展示系统,所述测试案例的测试效果展示系统可被至少一个处理器执行,以使所述至少一个处理器执行如上述的测试案例的测试效果展示方法的步骤。Further, in order to achieve the above object, a third aspect of the present application further provides a computer readable storage medium, where the computer readable storage medium stores a test effect display system of a test case, and the test effect display system of the test case can be Executed by at least one processor to cause the at least one processor to perform the steps of the test effect presentation method of the test case as described above.
本申请提出的测试案例的测试效果展示方法、系统及可读存储介质,通过对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;将各个静态方法链按所述静态调用结构进行展示;在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并对展示的各个静态方法链中在动态链路测试执行过程中所流经的方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试效果展示给用户。由于能将待测试系统的各个静态方法链按静态调用结构进行展示,用户可直观地获知待测试系统中的方法链层次结构,而且,通过在按静态调用结构展示的各个静态方法链中对测试案例在动态链路测试执行过程中所流经的方法链和其他方法链进行区分标识,用户可直观地获知待测试系统中当前已执行测试的方法链和还未执行测试的方法链,从而实现测试案例执行效果的可视化展示, 让用户能完整衡量利用测试案例对待测试系统进行测试时的执行效果。The test effect display method, system and readable storage medium of the test case proposed by the present application, by analyzing the code of the test system, obtaining a static call structure between each method in the system code to be tested, and according to the static call structure Establishing each static method chain in the system code to be tested; displaying each static method chain according to the static call structure; recording the test case when performing a dynamic link test on the system to be tested in a preset test case The method chain that flows through the dynamic link test execution process, and distinguishes between the method chain and other untested static method chains that are displayed in the dynamic link test execution process in each static method chain. To show the test results of the test case to the user. Since each static method chain of the system to be tested can be displayed in a static call structure, the user can intuitively know the method chain hierarchy in the system to be tested, and by testing in each static method chain displayed by the static call structure. In the case of the dynamic link test execution process, the method chain and other method chains are differentiated and identified, and the user can intuitively know the method chain of the currently executed test in the system to be tested and the method chain that has not yet executed the test, thereby realizing A visual demonstration of the performance of the test case, allowing the user to fully measure the performance of the test case when testing the test system.
附图说明DRAWINGS
图1为本申请测试案例的测试效果展示系统10较佳实施例的运行环境示意图;1 is a schematic diagram of an operating environment of a preferred embodiment of a test effect display system 10 of a test case of the present application;
图2为本申请测试案例的测试效果展示方法一实施例的流程示意图。FIG. 2 is a schematic flowchart diagram of an embodiment of a test effect display method of a test case of the present application.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that the descriptions of "first", "second" and the like in the present application are for the purpose of description only, and are not to be construed as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. . Thus, features defining "first" or "second" may include at least one of the features, either explicitly or implicitly. In addition, the technical solutions between the various embodiments may be combined with each other, but must be based on the realization of those skilled in the art, and when the combination of the technical solutions is contradictory or impossible to implement, it should be considered that the combination of the technical solutions does not exist. Nor is it within the scope of protection required by this application.
本申请提供一种测试案例的测试效果展示系统。请参阅图1,是本申请测试案例的测试效果展示系统10较佳实施例的运行环境示意图。The application provides a test effect display system for a test case. Please refer to FIG. 1 , which is a schematic diagram of an operating environment of a preferred embodiment of the test effect display system 10 of the test case of the present application.
在本实施例中,所述的测试案例的测试效果展示系统10安装并运行于电子装置1中。该电子装置1可包括,但不仅限于,存储器11、处理器12及显示器13。图1仅示出了具有组件11-13的电子装置1,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。In the embodiment, the test effect display system 10 of the test case is installed and operated in the electronic device 1. The electronic device 1 may include, but is not limited to, a memory 11, a processor 12, and a display 13. Figure 1 shows only the electronic device 1 with components 11-13, but it should be understood that not all illustrated components may be implemented, and more or fewer components may be implemented instead.
所述存储器11为至少一种类型的可读计算机存储介质,所述存储器11在一些实施例中可以是所述电子装置1的内部存储单元,例如该电子装置1的硬盘或内存。所述存储器11在另一些实施例中也可以是所述电子装置1的外部存储设备,例如所述电子装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括所述电子装置1的内部存储单元也包括外部存储设备。所述存储器11用于存储安装于所述电子装置1的应用软 件及各类数据,例如所述测试案例的测试效果展示系统10的程序代码等。所述存储器11还可以用于暂时地存储已经输出或者将要输出的数据。The memory 11 is at least one type of readable computer storage medium, which in some embodiments may be an internal storage unit of the electronic device 1, such as a hard disk or memory of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in hard disk equipped on the electronic device 1, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 is configured to store application software and various types of data installed in the electronic device 1, such as program code of the test effect display system 10 of the test case. The memory 11 can also be used to temporarily store data that has been output or is about to be output.
所述处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行所述存储器11中存储的程序代码或处理数据,例如执行所述测试案例的测试效果展示系统10等。The processor 12, in some embodiments, may be a central processing unit (CPU), a microprocessor or other data processing chip for running program code or processing data stored in the memory 11, for example The test effect display system 10 and the like of the test case are executed.
所述显示器13在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。所述显示器13用于显示在所述电子装置1中处理的信息以及用于显示可视化的用户界面,例如按静态调用结构展示的待测试系统中的各个静态方法链、对已测试方法链和未测试的静态方法链进行区分标识后的展示界面等。所述电子装置1的部件11-13通过系统总线相互通信。The display 13 in some embodiments may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch sensor, or the like. The display 13 is configured to display information processed in the electronic device 1 and a user interface for displaying visualization, such as each static method chain in the system to be tested displayed in a static call structure, on the tested method chain, and not The static method chain of the test is used to distinguish the display interface after the identification. The components 11-13 of the electronic device 1 communicate with one another via a system bus.
测试案例的测试效果展示系统10包括至少一个存储在所述存储器11中的计算机可读指令,该至少一个计算机可读指令可被所述处理器12执行,以实现本申请各实施例。The test effect display system 10 of the test case includes at least one computer readable instruction stored in the memory 11, the at least one computer readable instruction being executable by the processor 12 to implement various embodiments of the present application.
其中,上述测试案例的测试效果展示系统10被所述处理器12执行时实现如下步骤:Wherein, the test effect display system 10 of the above test case is implemented by the processor 12 to implement the following steps:
步骤S1,对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链。Step S1: analyzing the code of the system to be tested, obtaining a static call structure between each method in the system code to be tested, and establishing each static method chain in the system code to be tested according to the static call structure.
利用Java字节码框架ASM包对待测试系统代码的class文件进行分析,分析得到待测试系统代码中各个方法之间的静态调用结构;并可利用分析的静态调用结构得到待测试系统代码的各个静态方法链。其中,ASM是一个java字节码操纵框架,它能被用来动态生成类或者增强既有类的功能。Java class被存储在严格格式定义的.class文件里,这些类文件拥有足够的元数据来解析类中的所有元素:类名称、方法、属性以及Java字节码(指令)。ASM从类文件中读入信息后,能够分析类信息,解析编译过的class字节码文件。例如,可利用Asm包对待测试系统代码进行逐行分析,获取待测试系统代码中不同类之间各个方法的调用关系。如一个类中各个方法有对应的代码块,根据代码块之间的调用关系可以得到对应的各个方法之间的调用关系(即调用结构)。进一步地,方法链为若干具有调用关系的方法组合而成,根据一个类中各个方法之间的调用结构,即可获得一个类中由若干具有调用关系的方法组合而成的多条方法链,作为静态方法链。Using the Java bytecode framework ASM package to analyze the class file of the test system code, analyze the static call structure between the various methods in the system code to be tested; and use the static call structure of the analysis to obtain the static of the system code to be tested. Method chain. Among them, ASM is a java bytecode manipulation framework, which can be used to dynamically generate classes or enhance the functionality of existing classes. Java classes are stored in .class files defined by strict formats. These class files have enough metadata to resolve all the elements in the class: class names, methods, properties, and Java bytecode (instructions). After reading the information from the class file, ASM can analyze the class information and parse the compiled class bytecode file. For example, the Asm package can be used to perform line-by-line analysis of the test system code, and obtain the calling relationship of each method between different classes in the system code to be tested. For example, each method in a class has a corresponding code block, and the calling relationship (ie, the calling structure) between the corresponding methods can be obtained according to the calling relationship between the code blocks. Further, the method chain is a combination of a plurality of methods having a calling relationship. According to the calling structure between each method in a class, a plurality of method chains in a class combined by a plurality of methods having a calling relationship may be obtained. As a static method chain.
步骤S2,基于预设展示规则将各个静态方法链按所述静态调用 结构进行展示。Step S2, displaying each static method chain according to the static display structure according to a preset display rule.
本实施例中,对分析的静态调用结构以及得到的待测试系统代码的各个静态方法链按预设展示规则进行可视化展示。例如,可根据待测试系统代码中各个方法之间的静态调用结构构建一个带主节点和子节点的方法调用结构树,对应的树形结构划分规则为:针对待测试系统代码的不同类如不同功能模块,设置为对应的各个主节点;每一主节点即每一类下的若干方法按照方法之间的静态调用结构依次形成各级子节点;其中,方法调用结构树中若干有调用关系的方法组合成静态方法链。In this embodiment, the static call structure of the analysis and the obtained static method chains of the system code to be tested are visually displayed according to preset display rules. For example, a method call structure tree with a master node and a child node may be constructed according to a static call structure between each method in the system code to be tested, and the corresponding tree structure division rule is: different classes for the system code to be tested, such as different functions. Modules are set to corresponding master nodes; each master node, ie, several methods under each class, sequentially form child nodes of each level according to the static call structure between the methods; wherein, the method calls a method of calling relationships in the structure tree Synthesize static method chains.
步骤S3,在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并在展示的各个静态方法链中找到与流经的方法链对应的静态方法链作为已测试方法链。Step S3, when performing a dynamic link test on the system to be tested in a preset test case, recording a method chain that the test case flows through during the execution of the dynamic link test, and displaying each static method chain The static method chain corresponding to the method chain flowing through is found as the tested method chain.
步骤S4,对展示的各个静态方法链中的已测试方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试执行效果展示给用户。Step S4, distinguishing between the tested method chain and other untested static method chains in each static method chain that is displayed, so as to display the test execution effect of the test case to the user.
本实施例中,在利用测试案例对待测试系统进行测试时,有时需针对待测试系统的动态链路进行测试。该动态链路指的是在待测试系统向web服务器发起http请求的动态过程中所经过的方法链。记录该测试案例在动态链路测试执行过程中所流经的方法链,并在展示的静态调用结构以及待测试系统代码的各个静态方法链中找到流经的方法链所对应的静态方法链。将流经的方法链所对应的静态方法链与待测试系统代码的各个静态方法链中其他静态方法链进行区分标识(如采用不同的颜色分别标注、高亮、标记等)。例如,可在方法调用结构树展示的待测试系统代码的各个静态方法链中,将针对待测试系统的动态链路进行测试时流经的方法链所对应的静态方法链进行点亮或采用绿色进行标注显示,将方法调用结构树中展示的其他静态方法链不进行点亮或采用红色进行标注显示。这样,用户通过展示的方法调用结构树,即可直观地获知测试案例执行的效果,通过区分显示的待测试系统中流经的方法链所对应的静态方法链以及整个待测试系统的静态调用结构,用户可直观地获知当前已执行的方法链和还未执行的方法链,从而实现可视化展示案例执行效果,以使得用户能从待测试系统代码中各个方法之间的静态调用结构以及动态链路测试这两方面来完整衡量测试案例执行的效果。In this embodiment, when testing a test system using a test case, it is sometimes necessary to test the dynamic link of the system to be tested. The dynamic link refers to a method chain that passes through a dynamic process in which a system to be tested initiates an http request to a web server. Record the method chain that the test case flows through during the execution of the dynamic link test, and find the static method chain corresponding to the method chain flowing through in the static call structure and the static method chain of the system code to be tested. The static method chain corresponding to the method chain flowing through is distinguished from other static method chains in each static method chain of the system code to be tested (eg, different colors are respectively labeled, highlighted, marked, etc.). For example, in each static method chain of the system code to be tested displayed in the method call structure tree, the static method chain corresponding to the method chain through which the dynamic link of the system to be tested is tested is lit or green. The annotation display is displayed, and the other static method chains displayed in the method call structure tree are not lit or marked in red. In this way, the user can intuitively know the effect of the test case execution by calling the structure tree through the displayed method, by distinguishing the static method chain corresponding to the method chain flowing through the displayed system to be tested and the static call structure of the entire system to be tested. The user can intuitively know the currently executed method chain and the method chain that has not been executed, so as to realize the visual display case execution effect, so that the user can statically call the structure and dynamic link test between the methods in the system code to be tested. These two aspects are a complete measure of the effectiveness of test case execution.
本实施例通过对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;将各个静态方法链按所述静态调 用结构进行展示;在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并对展示的各个静态方法链中在动态链路测试执行过程中所流经的方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试效果展示给用户。由于能将待测试系统的各个静态方法链按静态调用结构进行展示,用户可直观地获知待测试系统中的方法链层次结构,而且,通过在按静态调用结构展示的各个静态方法链中对测试案例在动态链路测试执行过程中所流经的方法链和其他方法链进行区分标识,用户可直观地获知待测试系统中当前已执行测试的方法链和还未执行测试的方法链,从而实现测试案例执行效果的可视化展示,让用户能完整衡量利用测试案例对待测试系统进行测试时的执行效果。In this embodiment, the static call structure between the methods in the system code to be tested is obtained by analyzing the code of the system to be tested, and each static method chain in the system code to be tested is established according to the static call structure; each static method is The chain is displayed according to the static call structure; when the dynamic test of the system to be tested is performed on the preset test case, the method chain that the test case flows during the execution of the dynamic link test is recorded, and The method chain and other untested static method chains flowing in the dynamic link test execution process in each static method chain are displayed to distinguish the test results of the test cases to the user. Since each static method chain of the system to be tested can be displayed in a static call structure, the user can intuitively know the method chain hierarchy in the system to be tested, and by testing in each static method chain displayed by the static call structure. In the case of the dynamic link test execution process, the method chain and other method chains are differentiated and identified, and the user can intuitively know the method chain of the currently executed test in the system to be tested and the method chain that has not yet executed the test, thereby realizing A visual demonstration of the performance of the test case, allowing the user to fully measure the performance of the test case when testing the test system.
在一可选的实施例中,在上述图1的实施例的基础上,所述测试案例的测试效果展示系统10被所述处理器12执行实现所述步骤S2时,具体包括:In an optional embodiment, on the basis of the foregoing embodiment of FIG. 1, when the test effect display system 10 of the test case is executed by the processor 12 to implement the step S2, the method specifically includes:
采用Graphviz包将各个静态方法链按所述静态调用结构绘制生成可缩放矢量图形来进行可视化展示。Using the Graphviz package, each static method chain is drawn according to the static call structure to generate a scalable vector graphic for visual display.
本实施例中在展示静态调用结构以及流经的方法链所对应的静态方法链时,可采用Graphviz包生成svg进行可视化的展示。其中,Graphviz是AT&T Labs Research开发的开源的图形绘制工具,它使用一个特定的DSL(领域特定语言):dot作为脚本语言,然后使用布局引擎来解析此脚本,并完成自动布局。它可以很方便的用来绘制结构化的图形网络,Graphviz提供丰富的导出格式,如常用的图片格式,SVG,PDF格式等。本实施例中采用graphviz来绘制展示静态调用结构,能有效保证生成图片的质量和速度。且本实施例中最终的展示格式采用svg(可缩放矢量图形)格式,Internet Explorer9,火狐,谷歌Chrome,Opera和Safari都支持SVG,因此,更加方便用户通过Web浏览器来打开查看展示的静态调用结构以及流经的方法链所对应的静态方法链,灵活地为用户可视化展示案例执行效果,更加实用。In this embodiment, when the static call structure and the static method chain corresponding to the method chain flowing through are displayed, the Graphviz package can be used to generate svg for visual display. Among them, Graphviz is an open source graphics rendering tool developed by AT&T Labs Research. It uses a specific DSL (domain specific language): dot as the scripting language, then uses the layout engine to parse the script and complete the automatic layout. It can be easily used to draw a structured graphical network. Graphviz provides a rich export format, such as commonly used image formats, SVG, PDF and so on. In this embodiment, graphviz is used to draw and display a static call structure, which can effectively ensure the quality and speed of the generated image. And the final display format in this embodiment adopts svg (scalable vector graphics) format, Internet Explorer 9, Firefox, Google Chrome, Opera and Safari all support SVG, so it is more convenient for users to open static display of viewing display through web browser. The structure and the static method chain corresponding to the method chain flowing through it flexibly display the effect of the case visualization for the user and are more practical.
在一可选的实施例中,所述测试案例的测试效果展示系统10被所述处理器12执行实现所述步骤S3时,包括:In an optional embodiment, when the test effect display system 10 of the test case is executed by the processor 12 to implement the step S3, the method includes:
配置Java字节码工具包作为javassist即Java代理,Javassist是一个开源的java字节码操作工具,主要是对已经编译好的class文件进行修改和处理。在本实施例中,先配置javassist工具包作为javaagent代理,当web(网站)服务器启动时,利用javaagent代理在加载待测软件系统的class文件之前或运行期间来进行拦截,对字节码做修 改,以对待测软件系统代码中的方法(链)进行增强,以便记录方法(链)的相关信息(如名称、编号等);并对待测软件系统的过滤器进行增强,以便捕获http请求相关信息。例如,在测试案例的执行过程中,可记录进入待测软件系统的http请求,并将进入待测软件系统的http请求所经过的方法(链)保存起来。本案中的测试案例包括接口测试案例、WEB(网页)测试案例等。该测试案例可以是有针对性编写的个性化测试用例,也可以是已有的常用测试案例。Configure the Java bytecode toolkit as a javassist or Java proxy. Javassist is an open source java bytecode manipulation tool that mainly modifies and processes the compiled class files. In this embodiment, the javassist toolkit is first configured as a javaagent proxy. When the web (website) server is started, the javaagent agent is used to intercept the class file before loading or loading the software system to be tested, and the bytecode is modified. Enhance the method (chain) in the software system code to be recorded in order to record information about the method (chain) (such as name, number, etc.); and enhance the filter of the software system to be tested to capture information related to the http request. . For example, during the execution of the test case, the http request entering the software system under test can be recorded, and the method (chain) through which the http request to the test software system passes is saved. The test cases in this case include interface test cases, WEB (web) test cases, and so on. The test case can be a personalized test case written in a targeted manner, or it can be a common test case.
在一可选的实施例中,所述测试案例的测试效果展示系统10被所述处理器12执行时,还实现如下步骤:In an optional embodiment, when the test effect display system 10 of the test case is executed by the processor 12, the following steps are also implemented:
当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
本实施例中还可在展示界面中针对测试结果向用户发出提示信息,例如,若所流经的方法链测试中无bug,则可由红色标识转为绿色标识或高亮提醒,或向用户发出短信等提示预警。否则,保持红色。用户即可更加直观地获知每一测试案例执行时对应方法链的测试结果。In this embodiment, the prompt information may be sent to the user for the test result in the display interface. For example, if there is no bug in the method chain test flowing through, the red identifier may be turned into a green logo or a highlight reminder, or sent to the user. SMS and other warnings. Otherwise, stay red. Users can more intuitively know the test results of the corresponding method chain when each test case is executed.
在一可选的实施例中,所述测试案例的测试效果展示系统10被所述处理器12执行时,还实现如下步骤:In an optional embodiment, when the test effect display system 10 of the test case is executed by the processor 12, the following steps are also implemented:
当有代码变更,例如待测试系统代码中某一类(如某一功能模块)发生变更时,需要利用测试案例对待测试系统进行测试,若该测试案例在动态链路测试执行过程中所流经的方法链所对应的静态方法链在方法调用结构树中进行了标识展示(如标红),则进一步地,还可对该类中其他还未被测试案例覆盖测试的静态方法链进行标识(如标黄),以供用户针对标黄的静态方法链选取对应的测试案例进行有针对性的测试。这样,用户可明确案例执行流程以及案例遗漏流程,以提高代码变更时对待测试系统的测试效果。When there is a code change, for example, when a certain type (such as a function module) in the system code to be tested changes, the test system needs to be tested by the test case, if the test case flows through the dynamic link test execution process. The static method chain corresponding to the method chain is displayed in the method call structure tree (such as the red mark), and further, the static method chain that has not been tested by the test case in the class may be identified ( For example, the standard yellow), for the user to select the corresponding test case for the static method chain of the standard yellow for targeted testing. In this way, the user can clarify the case execution process and the case omission process to improve the test results of the test system when the code changes.
如图2所示,图2为本申请测试案例的测试效果展示方法一实施例的流程示意图,该测试案例的测试效果展示方法包括以下步骤:As shown in FIG. 2, FIG. 2 is a schematic flowchart of an embodiment of a test effect display method of a test case of the present application. The test effect display method of the test case includes the following steps:
步骤S10,对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链。Step S10, analyzing the code of the system to be tested, obtaining a static call structure between each method in the system code to be tested, and establishing each static method chain in the system code to be tested according to the static call structure.
利用Java字节码框架ASM包对待测试系统代码的class文件进行分析,分析得到待测试系统代码中各个方法之间的静态调用结构;并可利用分析的静态调用结构得到待测试系统代码的各个静态方法 链。其中,ASM是一个java字节码操纵框架,它能被用来动态生成类或者增强既有类的功能。Java class被存储在严格格式定义的.class文件里,这些类文件拥有足够的元数据来解析类中的所有元素:类名称、方法、属性以及Java字节码(指令)。ASM从类文件中读入信息后,能够分析类信息,解析编译过的class字节码文件。例如,可利用Asm包对待测试系统代码进行逐行分析,获取待测试系统代码中不同类之间各个方法的调用关系。如一个类中各个方法有对应的代码块,根据代码块之间的调用关系可以得到对应的各个方法之间的调用关系(即调用结构)。进一步地,方法链为若干具有调用关系的方法组合而成,根据一个类中各个方法之间的调用结构,即可获得一个类中由若干具有调用关系的方法组合而成的多条方法链,作为静态方法链。Using the Java bytecode framework ASM package to analyze the class file of the test system code, analyze the static call structure between the various methods in the system code to be tested; and use the static call structure of the analysis to obtain the static of the system code to be tested. Method chain. Among them, ASM is a java bytecode manipulation framework, which can be used to dynamically generate classes or enhance the functionality of existing classes. Java classes are stored in .class files defined by strict formats. These class files have enough metadata to resolve all the elements in the class: class names, methods, properties, and Java bytecode (instructions). After reading the information from the class file, ASM can analyze the class information and parse the compiled class bytecode file. For example, the Asm package can be used to perform line-by-line analysis of the test system code, and obtain the calling relationship of each method between different classes in the system code to be tested. For example, each method in a class has a corresponding code block, and the calling relationship (ie, the calling structure) between the corresponding methods can be obtained according to the calling relationship between the code blocks. Further, the method chain is a combination of a plurality of methods having a calling relationship. According to the calling structure between each method in a class, a plurality of method chains in a class combined by a plurality of methods having a calling relationship may be obtained. As a static method chain.
步骤S20,基于预设展示规则将各个静态方法链按所述静态调用结构进行展示。Step S20, displaying each static method chain according to the static display structure according to a preset display rule.
本实施例中,对分析的静态调用结构以及得到的待测试系统代码的各个静态方法链按预设展示规则进行可视化展示。例如,可根据待测试系统代码中各个方法之间的静态调用结构构建一个带主节点和子节点的方法调用结构树,对应的树形结构划分规则为:针对待测试系统代码的不同类如不同功能模块,设置为对应的各个主节点;每一主节点即每一类下的若干方法按照方法之间的静态调用结构依次形成各级子节点;其中,方法调用结构树中若干有调用关系的方法组合成静态方法链。In this embodiment, the static call structure of the analysis and the obtained static method chains of the system code to be tested are visually displayed according to preset display rules. For example, a method call structure tree with a master node and a child node may be constructed according to a static call structure between each method in the system code to be tested, and the corresponding tree structure division rule is: different classes for the system code to be tested, such as different functions. Modules are set to corresponding master nodes; each master node, ie, several methods under each class, sequentially form child nodes of each level according to the static call structure between the methods; wherein, the method calls a method of calling relationships in the structure tree Synthesize static method chains.
步骤S30,在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并在展示的各个静态方法链中找到与流经的方法链对应的静态方法链作为已测试方法链。Step S30, when performing a dynamic link test on the system to be tested in a preset test case, recording a method chain that the test case flows during the execution of the dynamic link test, and displaying each static method chain The static method chain corresponding to the method chain flowing through is found as the tested method chain.
步骤S40,对展示的各个静态方法链中的已测试方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试执行效果展示给用户。Step S40: Perform a differentiated identification on the tested method chain and other untested static method chains in each static method chain that is displayed, so as to display the test execution effect of the test case to the user.
本实施例中,在利用测试案例对待测试系统进行测试时,有时需针对待测试系统的动态链路进行测试。该动态链路指的是在待测试系统向web服务器发起http请求的动态过程中所经过的方法链。记录该测试案例在动态链路测试执行过程中所流经的方法链,并在展示的静态调用结构以及待测试系统代码的各个静态方法链中找到流经的方法链所对应的静态方法链。将流经的方法链所对应的静态方法链与待测试系统代码的各个静态方法链中其他静态方法链进行区分标识(如采用不同的颜色分别标注、高亮、标记等)。例如,可在方法调用结构树展示的待测试系统代码的各个静态方法链中,将针对待测试 系统的动态链路进行测试时流经的方法链所对应的静态方法链进行点亮或采用绿色进行标注显示,将方法调用结构树中展示的其他静态方法链不进行点亮或采用红色进行标注显示。这样,用户通过展示的方法调用结构树,即可直观地获知测试案例执行的效果,通过区分显示的待测试系统中流经的方法链所对应的静态方法链以及整个待测试系统的静态调用结构,用户可直观地获知当前已执行的方法链和还未执行的方法链,从而实现可视化展示案例执行效果,以使得用户能从待测试系统代码中各个方法之间的静态调用结构以及动态链路测试这两方面来完整衡量测试案例执行的效果。In this embodiment, when testing a test system using a test case, it is sometimes necessary to test the dynamic link of the system to be tested. The dynamic link refers to a method chain that passes through a dynamic process in which a system to be tested initiates an http request to a web server. Record the method chain that the test case flows through during the execution of the dynamic link test, and find the static method chain corresponding to the method chain flowing through in the static call structure and the static method chain of the system code to be tested. The static method chain corresponding to the method chain flowing through is distinguished from other static method chains in each static method chain of the system code to be tested (eg, different colors are respectively labeled, highlighted, marked, etc.). For example, in each static method chain of the system code to be tested displayed in the method call structure tree, the static method chain corresponding to the method chain through which the dynamic link of the system to be tested is tested is lit or green. The annotation display is displayed, and the other static method chains displayed in the method call structure tree are not lit or marked in red. In this way, the user can intuitively know the effect of the test case execution by calling the structure tree through the displayed method, by distinguishing the static method chain corresponding to the method chain flowing through the displayed system to be tested and the static call structure of the entire system to be tested. The user can intuitively know the currently executed method chain and the method chain that has not been executed, so as to realize the visual display case execution effect, so that the user can statically call the structure and dynamic link test between the methods in the system code to be tested. These two aspects are a complete measure of the effectiveness of test case execution.
本实施例通过对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;将各个静态方法链按所述静态调用结构进行展示;在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并对展示的各个静态方法链中在动态链路测试执行过程中所流经的方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试效果展示给用户。由于能将待测试系统的各个静态方法链按静态调用结构进行展示,用户可直观地获知待测试系统中的方法链层次结构,而且,通过在按静态调用结构展示的各个静态方法链中对测试案例在动态链路测试执行过程中所流经的方法链和其他方法链进行区分标识,用户可直观地获知待测试系统中当前已执行测试的方法链和还未执行测试的方法链,从而实现测试案例执行效果的可视化展示,让用户能完整衡量利用测试案例对待测试系统进行测试时的执行效果。In this embodiment, the static call structure between the methods in the system code to be tested is obtained by analyzing the code of the system to be tested, and each static method chain in the system code to be tested is established according to the static call structure; each static method is The chain is displayed according to the static call structure; when the dynamic test of the system to be tested is performed on the preset test case, the method chain that the test case flows during the execution of the dynamic link test is recorded, and The method chain and other untested static method chains flowing in the dynamic link test execution process in each static method chain are displayed to distinguish the test results of the test cases to the user. Since each static method chain of the system to be tested can be displayed in a static call structure, the user can intuitively know the method chain hierarchy in the system to be tested, and by testing in each static method chain displayed by the static call structure. In the case of the dynamic link test execution process, the method chain and other method chains are differentiated and identified, and the user can intuitively know the method chain of the currently executed test in the system to be tested and the method chain that has not yet executed the test, thereby realizing A visual demonstration of the performance of the test case, allowing the user to fully measure the performance of the test case when testing the test system.
在一可选的实施例中,在上述实施例的基础上,所述步骤S20包括:In an optional embodiment, based on the foregoing embodiment, the step S20 includes:
采用Graphviz包将各个静态方法链按所述静态调用结构绘制生成可缩放矢量图形来进行可视化展示。Using the Graphviz package, each static method chain is drawn according to the static call structure to generate a scalable vector graphic for visual display.
本实施例中在展示静态调用结构以及流经的方法链所对应的静态方法链时,可采用Graphviz包生成svg进行可视化的展示。其中,Graphviz是AT&T Labs Research开发的开源的图形绘制工具,它使用一个特定的DSL(领域特定语言):dot作为脚本语言,然后使用布局引擎来解析此脚本,并完成自动布局。它可以很方便的用来绘制结构化的图形网络,Graphviz提供丰富的导出格式,如常用的图片格式,SVG,PDF格式等。本实施例中采用graphviz来绘制展示静态调用结构,能有效保证生成图片的质量和速度。且本实施例中最终的展示格 式采用svg(可缩放矢量图形)格式,Internet Explorer9,火狐,谷歌Chrome,Opera和Safari都支持SVG,因此,更加方便用户通过Web浏览器来打开查看展示的静态调用结构以及流经的方法链所对应的静态方法链,灵活地为用户可视化展示案例执行效果,更加实用。In this embodiment, when the static call structure and the static method chain corresponding to the method chain flowing through are displayed, the Graphviz package can be used to generate svg for visual display. Among them, Graphviz is an open source graphics rendering tool developed by AT&T Labs Research. It uses a specific DSL (domain specific language): dot as the scripting language, then uses the layout engine to parse the script and complete the automatic layout. It can be easily used to draw a structured graphical network. Graphviz provides a rich export format, such as commonly used image formats, SVG, PDF and so on. In this embodiment, graphviz is used to draw and display a static call structure, which can effectively ensure the quality and speed of the generated image. And the final display format in this embodiment adopts svg (scalable vector graphics) format, Internet Explorer 9, Firefox, Google Chrome, Opera and Safari all support SVG, so it is more convenient for users to open static display of viewing display through web browser. The structure and the static method chain corresponding to the method chain flowing through it flexibly display the effect of the case visualization for the user and are more practical.
在一可选的实施例中,所述步骤S30包括:In an optional embodiment, the step S30 includes:
配置Java字节码工具包作为javassist即Java代理,Javassist是一个开源的java字节码操作工具,主要是对已经编译好的class文件进行修改和处理。在本实施例中,先配置javassist工具包作为javaagent代理,当web(网站)服务器启动时,利用javaagent代理在加载待测软件系统的class文件之前或运行期间来进行拦截,对字节码做修改,以对待测软件系统代码中的方法(链)进行增强,以便记录方法(链)的相关信息(如名称、编号等);并对待测软件系统的过滤器进行增强,以便捕获http请求相关信息。例如,在测试案例的执行过程中,可记录进入待测软件系统的http请求,并将进入待测软件系统的http请求所经过的方法(链)保存起来。本案中的测试案例包括接口测试案例、WEB(网页)测试案例等。该测试案例可以是有针对性编写的个性化测试用例,也可以是已有的常用测试案例。Configure the Java bytecode toolkit as a javassist or Java proxy. Javassist is an open source java bytecode manipulation tool that mainly modifies and processes the compiled class files. In this embodiment, the javassist toolkit is first configured as a javaagent proxy. When the web (website) server is started, the javaagent agent is used to intercept the class file before loading or loading the software system to be tested, and the bytecode is modified. Enhance the method (chain) in the software system code to be recorded in order to record information about the method (chain) (such as name, number, etc.); and enhance the filter of the software system to be tested to capture information related to the http request. . For example, during the execution of the test case, the http request entering the software system under test can be recorded, and the method (chain) through which the http request to the test software system passes is saved. The test cases in this case include interface test cases, WEB (web) test cases, and so on. The test case can be a personalized test case written in a targeted manner, or it can be a common test case.
在一可选的实施例中,该方法还包括:In an optional embodiment, the method further includes:
当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
本实施例中还可在展示界面中针对测试结果向用户发出提示信息,例如,若所流经的方法链测试中无bug,则可由红色标识转为绿色标识或高亮提醒,或向用户发出短信等提示预警。否则,保持红色。用户即可更加直观地获知每一测试案例执行时对应方法链的测试结果。In this embodiment, the prompt information may be sent to the user for the test result in the display interface. For example, if there is no bug in the method chain test flowing through, the red identifier may be turned into a green logo or a highlight reminder, or sent to the user. SMS and other warnings. Otherwise, stay red. Users can more intuitively know the test results of the corresponding method chain when each test case is executed.
在一可选的实施例中,该方法还包括:In an optional embodiment, the method further includes:
当有代码变更,例如待测试系统代码中某一类(如某一功能模块)发生变更时,需要利用测试案例对待测试系统进行测试,若该测试案例在动态链路测试执行过程中所流经的方法链所对应的静态方法链在方法调用结构树中进行了标识展示(如标红),则进一步地,还可对该类中其他还未被测试案例覆盖测试的静态方法链进行标识(如标黄),以供用户针对标黄的静态方法链选取对应的测试案例进行有针对性的测试。这样,用户可明确案例执行流程以及案例遗漏流程,以提高代码变更时对待测试系统的测试效果。When there is a code change, for example, when a certain type (such as a function module) in the system code to be tested changes, the test system needs to be tested by the test case, if the test case flows through the dynamic link test execution process. The static method chain corresponding to the method chain is displayed in the method call structure tree (such as the red mark), and further, the static method chain that has not been tested by the test case in the class may be identified ( For example, the standard yellow), for the user to select the corresponding test case for the static method chain of the standard yellow for targeted testing. In this way, the user can clarify the case execution process and the case omission process to improve the test results of the test system when the code changes.
此外,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质存储有测试案例的测试效果展示系统,所述测试案例的测试效果展示系统可被至少一个处理器执行,以使所述至少一个处理器执行如上述实施例中的测试案例的测试效果展示方法的步骤,该测试案例的测试效果展示方法的步骤S10、S20、S30等具体实施过程如上文所述,在此不再赘述。In addition, the present application further provides a computer readable storage medium storing a test effect display system of a test case, the test effect display system of the test case being executable by at least one processor, so that The at least one processor performs the steps of the test effect display method of the test case in the above embodiment, and the specific implementation processes of the steps S10, S20, and S30 of the test effect display method of the test case are as described above, and Let me repeat.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It is to be understood that the term "comprises", "comprising", or any other variants thereof, is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes those elements. It also includes other elements that are not explicitly listed, or elements that are inherent to such a process, method, article, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.
以上参照附图说明了本申请的优选实施例,并非因此局限本申请的权利范围。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The preferred embodiments of the present application have been described above with reference to the drawings, and are not intended to limit the scope of the application. The serial numbers of the embodiments of the present application are merely for the description, and do not represent the advantages and disadvantages of the embodiments. Additionally, although logical sequences are shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than the ones described herein.
本领域技术人员不脱离本申请的范围和实质,可以有多种变型方案实现本申请,比如作为一个实施例的特征可用于另一实施例而得到又一实施例。凡在运用本申请的技术构思之内所作的任何修改、等同替换和改进,均应在本申请的权利范围之内。A person skilled in the art can implement the present application in various variants without departing from the scope and spirit of the present application. For example, the features as one embodiment can be used in another embodiment to obtain another embodiment. Any modifications, equivalent substitutions and improvements made within the technical concept of the application should be within the scope of the application.

Claims (20)

  1. 一种电子装置,其特征在于,所述电子装置包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的测试案例的测试效果展示系统,所述测试案例的测试效果展示系统被所述处理器执行时实现如下步骤:An electronic device, comprising: a memory, a processor, wherein the memory stores a test effect display system of a test case executable on the processor, and the test effect of the test case is displayed The system implements the following steps when executed by the processor:
    对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;The code of the test system is analyzed, and a static call structure between each method in the system code to be tested is obtained, and each static method chain in the system code to be tested is established according to the static call structure;
    基于预设展示规则将各个静态方法链按所述静态调用结构进行展示;Displaying each static method chain according to the static call structure according to a preset display rule;
    在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并在展示的各个静态方法链中找到与流经的方法链对应的静态方法链作为已测试方法链;Recording a method chain that the test case flows during dynamic link test execution during a dynamic test of the system to be tested in a preset test case, and finding and analyzing each static method chain displayed The static method chain corresponding to the method chain flowing through as the tested method chain;
    对展示的各个静态方法链中的已测试方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试执行效果展示给用户。The tested method chain and other untested static method chains in each static method chain displayed are differentiated to display the test execution effect of the test case to the user.
  2. 如权利要求1所述的电子装置,其特征在于,所述对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链的步骤包括:The electronic device according to claim 1, wherein the code of the system to be tested is analyzed, a static call structure between each method in the system code to be tested is obtained, and a system to be tested is established according to the static call structure. The steps of each static method chain in the code include:
    利用Java字节码框架ASM包对待测试系统代码的class文件进行逐行分析,获取待测试系统代码的每个类中各个方法的调用关系作为静态调用结构;Using the Java bytecode framework ASM package to analyze the class file of the test system code line by line, and obtain the calling relationship of each method in each class of the system code to be tested as a static call structure;
    将一个类中由若干具有调用关系的方法组合而成的方法链作为静态方法链。A method chain that combines several methods with calling relationships in a class is used as a static method chain.
  3. 如权利要求2所述的电子装置,其特征在于,所述基于预设展示规则将各个静态方法链按所述静态调用结构进行展示的步骤包括:The electronic device according to claim 2, wherein the step of displaying each static method chain according to the static display structure based on a preset presentation rule comprises:
    采用Graphviz包将各个静态方法链按所述静态调用结构绘制生成可缩放矢量图形来进行可视化展示。Using the Graphviz package, each static method chain is drawn according to the static call structure to generate a scalable vector graphic for visual display.
  4. 如权利要求1所述的电子装置,其特征在于,所述在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链的步骤包括:The electronic device according to claim 1, wherein when the dynamic test of the system to be tested is performed on a preset test case, the test case is recorded during the execution of the dynamic link test. The steps of the method chain include:
    配置Java字节码工具作为Java代理,在预设的Web服务器启动,预设的测试案例对所述待测试软件系统执行动态链路测试过程中,利用所述Java代理对所述待测试软件系统的过滤器进行增强,以捕获 进入所述待测试软件系统的HTTP请求,并利用所述Java代理记录进入所述待测试软件系统的HTTP请求所经过的方法链。Configuring a Java bytecode tool as a Java proxy, starting in a preset web server, and performing a dynamic link test on the software system to be tested by using a preset test case, using the Java proxy to the software system to be tested The filter is enhanced to capture an HTTP request entering the software system under test and utilize the Java proxy to record the method chain through which the HTTP request to the software system under test passes.
  5. 如权利要求2所述的电子装置,其特征在于,所述在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链的步骤包括:The electronic device according to claim 2, wherein when the dynamic test of the system to be tested is performed on a preset test case, the test case is recorded during the execution of the dynamic link test. The steps of the method chain include:
    配置Java字节码工具作为Java代理,在预设的Web服务器启动,预设的测试案例对所述待测试软件系统执行动态链路测试过程中,利用所述Java代理对所述待测试软件系统的过滤器进行增强,以捕获进入所述待测试软件系统的HTTP请求,并利用所述Java代理记录进入所述待测试软件系统的HTTP请求所经过的方法链。Configuring a Java bytecode tool as a Java proxy, starting in a preset web server, and performing a dynamic link test on the software system to be tested by using a preset test case, using the Java proxy to the software system to be tested The filter is enhanced to capture an HTTP request entering the software system under test and utilize the Java proxy to record the method chain through which the HTTP request to the software system under test passes.
  6. 如权利要求3所述的电子装置,其特征在于,所述在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链的步骤包括:The electronic device according to claim 3, wherein when the predetermined test case performs a dynamic link test on the system to be tested, the test case is recorded during the execution of the dynamic link test The steps of the method chain include:
    配置Java字节码工具作为Java代理,在预设的Web服务器启动,预设的测试案例对所述待测试软件系统执行动态链路测试过程中,利用所述Java代理对所述待测试软件系统的过滤器进行增强,以捕获进入所述待测试软件系统的HTTP请求,并利用所述Java代理记录进入所述待测试软件系统的HTTP请求所经过的方法链。Configuring a Java bytecode tool as a Java proxy, starting in a preset web server, and performing a dynamic link test on the software system to be tested by using a preset test case, using the Java proxy to the software system to be tested The filter is enhanced to capture an HTTP request entering the software system under test and utilize the Java proxy to record the method chain through which the HTTP request to the software system under test passes.
  7. 如权利要求1所述的电子装置,其特征在于,所述处理器还用于执行所述测试案例的测试效果展示系统,以实现以下步骤:The electronic device according to claim 1, wherein the processor is further configured to execute a test effect display system of the test case to implement the following steps:
    当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  8. 如权利要求2所述的电子装置,其特征在于,所述处理器还用于执行所述测试案例的测试效果展示系统,以实现以下步骤:The electronic device according to claim 2, wherein the processor is further configured to execute a test effect display system of the test case to implement the following steps:
    当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  9. 如权利要求3所述的电子装置,其特征在于,所述处理器还用于执行所述测试案例的测试效果展示系统,以实现以下步骤:The electronic device according to claim 3, wherein the processor is further configured to execute a test effect display system of the test case to implement the following steps:
    当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  10. 一种测试案例的测试效果展示方法,其特征在于,所述测试案例的测试效果展示方法包括:A test result display method for a test case, characterized in that the test effect display method of the test case includes:
    对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;The code of the test system is analyzed, and a static call structure between each method in the system code to be tested is obtained, and each static method chain in the system code to be tested is established according to the static call structure;
    基于预设展示规则将各个静态方法链按所述静态调用结构进行展示;Displaying each static method chain according to the static call structure according to a preset display rule;
    在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并在展示的各个静态方法链中找到与流经的方法链对应的静态方法链作为已测试方法链;Recording a method chain that the test case flows during dynamic link test execution during a dynamic test of the system to be tested in a preset test case, and finding and analyzing each static method chain displayed The static method chain corresponding to the method chain flowing through as the tested method chain;
    对展示的各个静态方法链中的已测试方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试执行效果展示给用户。The tested method chain and other untested static method chains in each static method chain displayed are differentiated to display the test execution effect of the test case to the user.
  11. 如权利要求10所述的测试案例的测试效果展示方法,其特征在于,所述对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链的步骤包括:The test effect display method of the test case according to claim 10, wherein the code of the system to be tested is analyzed, and a static call structure between each method in the system code to be tested is obtained, and according to the static call The steps of constructing each static method chain in the system code to be tested include:
    利用Java字节码框架ASM包对待测试系统代码的class文件进行逐行分析,获取待测试系统代码的每个类中各个方法的调用关系作为静态调用结构;Using the Java bytecode framework ASM package to analyze the class file of the test system code line by line, and obtain the calling relationship of each method in each class of the system code to be tested as a static call structure;
    将一个类中由若干具有调用关系的方法组合而成的方法链作为静态方法链。A method chain that combines several methods with calling relationships in a class is used as a static method chain.
  12. 如权利要求11所述的测试案例的测试效果展示方法,其特征在于,所述基于预设展示规则将各个静态方法链按所述静态调用结构进行展示的步骤包括:The test effect display method of the test case according to claim 11, wherein the step of displaying each static method chain according to the static display structure based on the preset display rule comprises:
    采用Graphviz包将各个静态方法链按所述静态调用结构绘制生成可缩放矢量图形来进行可视化展示。Using the Graphviz package, each static method chain is drawn according to the static call structure to generate a scalable vector graphic for visual display.
  13. 如权利要求10所述的测试案例的测试效果展示方法,其特征在于,所述在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链的步骤包括:The test effect display method of the test case according to claim 10, wherein the test case is recorded in a dynamic link test when a dynamic test of the system to be tested is performed on a preset test case. The steps of the method chain flowing through the execution process include:
    配置Java字节码工具作为Java代理,在预设的Web服务器启动,预设的测试案例对所述待测试软件系统执行动态链路测试过程中,利用所述Java代理对所述待测试软件系统的过滤器进行增强,以捕获进入所述待测试软件系统的HTTP请求,并利用所述Java代理记录进入所述待测试软件系统的HTTP请求所经过的方法链。Configuring a Java bytecode tool as a Java proxy, starting in a preset web server, and performing a dynamic link test on the software system to be tested by using a preset test case, using the Java proxy to the software system to be tested The filter is enhanced to capture an HTTP request entering the software system under test and utilize the Java proxy to record the method chain through which the HTTP request to the software system under test passes.
  14. 如权利要求11所述的测试案例的测试效果展示方法,其特征在于,所述在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链的步骤包括:The test effect display method of the test case according to claim 11, wherein the test case is recorded in a dynamic link test when a dynamic test of the system to be tested is performed on a preset test case. The steps of the method chain flowing through the execution process include:
    配置Java字节码工具作为Java代理,在预设的Web服务器启动,预设的测试案例对所述待测试软件系统执行动态链路测试过程中,利 用所述Java代理对所述待测试软件系统的过滤器进行增强,以捕获进入所述待测试软件系统的HTTP请求,并利用所述Java代理记录进入所述待测试软件系统的HTTP请求所经过的方法链。Configuring a Java bytecode tool as a Java proxy, starting in a preset web server, and performing a dynamic link test on the software system to be tested by using a preset test case, using the Java proxy to the software system to be tested The filter is enhanced to capture an HTTP request entering the software system under test and utilize the Java proxy to record the method chain through which the HTTP request to the software system under test passes.
  15. 如权利要求12所述的测试案例的测试效果展示方法,其特征在于,所述在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链的步骤包括:The test effect display method of the test case according to claim 12, wherein the test case is recorded in a dynamic link test when a dynamic test of the system to be tested is performed on a preset test case. The steps of the method chain flowing through the execution process include:
    配置Java字节码工具作为Java代理,在预设的Web服务器启动,预设的测试案例对所述待测试软件系统执行动态链路测试过程中,利用所述Java代理对所述待测试软件系统的过滤器进行增强,以捕获进入所述待测试软件系统的HTTP请求,并利用所述Java代理记录进入所述待测试软件系统的HTTP请求所经过的方法链。Configuring a Java bytecode tool as a Java proxy, starting in a preset web server, and performing a dynamic link test on the software system to be tested by using a preset test case, using the Java proxy to the software system to be tested The filter is enhanced to capture an HTTP request entering the software system under test and utilize the Java proxy to record the method chain through which the HTTP request to the software system under test passes.
  16. 如权利要求10所述的测试案例的测试效果展示方法,其特征在于,还包括:The test effect display method of the test case according to claim 10, further comprising:
    当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  17. 如权利要求11所述的测试案例的测试效果展示方法,其特征在于,还包括:The test effect display method of the test case according to claim 11, further comprising:
    当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  18. 如权利要求12所述的测试案例的测试效果展示方法,其特征在于,还包括:The test effect display method of the test case according to claim 12, further comprising:
    当所述测试案例在动态链路测试执行过程中所流经的方法链出现测试异常时,对展示的各个静态方法链中出现测试异常的方法链按预设异常标识方式进行标识,以向用户展示出现测试异常的方法链。When the test case has a test abnormality in the method chain flowing through the dynamic link test execution process, the method chain in which the test abnormality appears in each static method chain is marked according to a preset abnormal identifier manner, so as to be displayed to the user. Shows a method chain with test exceptions.
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有测试案例的测试效果展示系统,所述测试案例的测试效果展示系统被处理器执行时实现如下步骤:A computer readable storage medium, wherein the computer readable storage medium stores a test effect display system of a test case, and the test effect display system of the test case is executed by the processor to implement the following steps:
    对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链;The code of the test system is analyzed, and a static call structure between each method in the system code to be tested is obtained, and each static method chain in the system code to be tested is established according to the static call structure;
    基于预设展示规则将各个静态方法链按所述静态调用结构进行展示;Displaying each static method chain according to the static call structure according to a preset display rule;
    在预设的测试案例对所述待测试系统执行动态链路测试时,记录所述测试案例在动态链路测试执行过程中所流经的方法链,并在展示的各个静态方法链中找到与流经的方法链对应的静态方法链作为已 测试方法链;Recording a method chain that the test case flows during dynamic link test execution during a dynamic test of the system to be tested in a preset test case, and finding and analyzing each static method chain displayed The static method chain corresponding to the method chain flowing through as the tested method chain;
    对展示的各个静态方法链中的已测试方法链和其他未测试的静态方法链进行区分标识,以将所述测试案例的测试执行效果展示给用户。The tested method chain and other untested static method chains in each static method chain displayed are differentiated to display the test execution effect of the test case to the user.
  20. 如权利要求19所述的计算机可读存储介质,其特征在于,所述对待测试系统的代码进行分析,得到待测试系统代码中各个方法之间的静态调用结构,并根据所述静态调用结构建立待测试系统代码中的各个静态方法链的步骤包括:The computer readable storage medium according to claim 19, wherein the code of the system to be tested is analyzed to obtain a static call structure between each method in the system code to be tested, and is established according to the static call structure. The steps of each static method chain in the system code to be tested include:
    利用Java字节码框架ASM包对待测试系统代码的class文件进行逐行分析,获取待测试系统代码的每个类中各个方法的调用关系作为静态调用结构;Using the Java bytecode framework ASM package to analyze the class file of the test system code line by line, and obtain the calling relationship of each method in each class of the system code to be tested as a static call structure;
    将一个类中由若干具有调用关系的方法组合而成的方法链作为静态方法链。A method chain that combines several methods with calling relationships in a class is used as a static method chain.
PCT/CN2018/102100 2018-04-17 2018-08-24 Test effect display method for test case, electronic device, and storage medium WO2019200800A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810345030.4A CN108763054B (en) 2018-04-17 2018-04-17 Test effect display method of test case, electronic device and storage medium
CN201810345030.4 2018-04-17

Publications (1)

Publication Number Publication Date
WO2019200800A1 true WO2019200800A1 (en) 2019-10-24

Family

ID=64010751

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/102100 WO2019200800A1 (en) 2018-04-17 2018-08-24 Test effect display method for test case, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN108763054B (en)
WO (1) WO2019200800A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083391A (en) * 2019-03-16 2019-08-02 平安科技(深圳)有限公司 Call request monitoring method, device, equipment and storage medium
CN112015640B (en) * 2020-08-06 2024-04-05 京东科技控股股份有限公司 Software testing method and system
CN117421839A (en) * 2023-11-06 2024-01-19 上海同星智能科技有限公司 Method and system for realizing program step visualization in automobile simulation test process

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101645037A (en) * 2009-09-11 2010-02-10 兰雨晴 Coverage analysis method of foundational software platform application program interface integrated test
CN102043710A (en) * 2009-10-22 2011-05-04 上海杉达学院 Testing system for visualization software
CN103473171A (en) * 2013-08-28 2013-12-25 北京信息科技大学 Coverage rate dynamic tracking method and device based on function call paths
CN104536895A (en) * 2015-01-12 2015-04-22 牟永敏 Test process tracking method and system for Java function call path
CN107797923A (en) * 2017-10-10 2018-03-13 平安科技(深圳)有限公司 Code coverage rate analysis method and application server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8893087B2 (en) * 2011-08-08 2014-11-18 Ca, Inc. Automating functionality test cases
CN103617120A (en) * 2013-12-05 2014-03-05 北京奇虎科技有限公司 Unit testing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101645037A (en) * 2009-09-11 2010-02-10 兰雨晴 Coverage analysis method of foundational software platform application program interface integrated test
CN102043710A (en) * 2009-10-22 2011-05-04 上海杉达学院 Testing system for visualization software
CN103473171A (en) * 2013-08-28 2013-12-25 北京信息科技大学 Coverage rate dynamic tracking method and device based on function call paths
CN104536895A (en) * 2015-01-12 2015-04-22 牟永敏 Test process tracking method and system for Java function call path
CN107797923A (en) * 2017-10-10 2018-03-13 平安科技(深圳)有限公司 Code coverage rate analysis method and application server

Also Published As

Publication number Publication date
CN108763054A (en) 2018-11-06
CN108763054B (en) 2021-03-23

Similar Documents

Publication Publication Date Title
US10324828B2 (en) Generating annotated screenshots based on automated tests
WO2019200800A1 (en) Test effect display method for test case, electronic device, and storage medium
US9152731B2 (en) Detecting a broken point in a web application automatic test case
US9021442B2 (en) Dynamic scenario testing of web application
US8528095B2 (en) Injection context based static analysis of computer software applications
US20090319995A1 (en) Enhancing source code debugging and readability using visual symbols
CN108845839B (en) Application page loading method and device and computer readable storage medium
JP2011003182A (en) Keyword display method and system thereof
US20140359571A1 (en) Method and apparatus for dynamic document object model (dom) aware code editing
CN111177113B (en) Data migration method, device, computer equipment and storage medium
CA2815527A1 (en) Bidirectional text checker
US20150143342A1 (en) Functional validation of software
CN103927151B (en) The method and apparatus that local operation is realized on web page
WO2019200808A1 (en) Test case recommendation method, electronic device, and readable storage medium
US9715483B2 (en) User interface for testing and asserting UI elements with natural language instructions
JP2018005535A (en) Software development assist method and system
US9047408B2 (en) Monitoring software execution
WO2019140850A1 (en) Test case recommendation method, electronic apparatus and readable storage medium
JP2017535855A (en) Visual display method and apparatus
CN109669799B (en) Error reporting control method, device and storage medium
JP2016057715A (en) Graphic type program analyzer
CN115408667A (en) Method and system for detecting infringement of application program content
BR102019020589A2 (en) COMPUTER IMPLEMENTED METHOD FOR ANALYSIS OF A SOFTWARE EXTENSION FOR INSTALLATION AND EXECUTION IN A COMPUTER SYSTEM, SYSTEM FOR ANALYSIS OF A SOFTWARE EXTENSION AND COMPUTER PROGRAM
CN111104623A (en) Webpage data caching method, device, server and storage medium
TWI611292B (en) Function management method and memory device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18915218

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18915218

Country of ref document: EP

Kind code of ref document: A1