KR20160021585A - Method for measuring code coverage and computer readable recording medium having program the same - Google Patents
Method for measuring code coverage and computer readable recording medium having program the same Download PDFInfo
- Publication number
- KR20160021585A KR20160021585A KR1020140107037A KR20140107037A KR20160021585A KR 20160021585 A KR20160021585 A KR 20160021585A KR 1020140107037 A KR1020140107037 A KR 1020140107037A KR 20140107037 A KR20140107037 A KR 20140107037A KR 20160021585 A KR20160021585 A KR 20160021585A
- Authority
- KR
- South Korea
- Prior art keywords
- source code
- code
- log
- code coverage
- coverage
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
본 발명의 실시 형태는 코드 커버리지 측정 방법에 관한 것이다.
실시 형태에 따른 코드 커버리지 측정 방법은, 상기 소스 코드에 탐침을 삽입하는 단계; 상기 탐침이 삽입된 소스 코드를 컴파일하여 실행 파일을 생성하는 단계; 및 상기 생성된 실행 파일을 이용하여 상기 코드 커버리지를 측정하는 단계;를 포함하고, 상기 소스 코드에 탐침을 삽입하는 단계는, 상기 소스 코드로부터 추상 구문 트리를 생성하는 단계; 상기 추상 구문 트리를 해석하여 제어 흐름 그래프를 생성하는 단계; 및 상기 추상 구문 트리와 상기 제어 흐름 그래프를 이용하여 상기 소스 코드에 상기 탐침을 삽입하는 단계;를 포함한다.An embodiment of the present invention relates to a code coverage measurement method.
A method of measuring a code coverage according to an embodiment includes: inserting a probe into the source code; Generating an executable file by compiling the source code into which the probe is inserted; And measuring the code coverage using the generated executable file, wherein the step of inserting the probe into the source code comprises: generating an abstract syntax tree from the source code; Analyzing the abstract syntax tree to generate a control flow graph; And inserting the probe into the source code using the abstract syntax tree and the control flow graph.
Description
본 발명은 코드 커버리지 측정 방법 및 이를 실행하기 위한 프로그램을 기록한 컴퓨터로 판독가능한 기록매체에 관한 것이다.The present invention relates to a code coverage measurement method and a computer-readable recording medium recording a program for executing the method.
코드 커버리지(Code Coverage)는, 소프트웨어 테스트(software test)의 품질을 측정하기 위해 사용되는 하나의 척도(measure)이다. Code coverage is a measure used to measure the quality of a software test.
코드 커버리지는, 어느 하나의 프로그램(program)의 소스 코드(source code)가 테스트된 비율을 의미한다. 따라서, 코드 커버리지는 일반적으로 백분율로 표시된다. Code coverage refers to the rate at which the source code of any one program is tested. Thus, code coverage is generally expressed as a percentage.
코드 커버리지를 측정하기 위해서는, 소정의 코드 커버리지 측정 도구가 필요한데 대표적으로 LDRA과 VectorCAST가 있다.To measure code coverage, you need a certain code coverage measurement tool, typically LDRA and VectorCAST.
본 발명은, 코드 커버리지를 측정하고자 하는 소스 코드에 탐침을 효율적으로 삽입할 수 있는 코드 커버리지 측정 방법과 이를 실행하기 위한 프로그램을 기록한 컴퓨터로 판독가능한 기록매체를 제공한다.The present invention provides a code coverage measurement method capable of efficiently inserting a probe into a source code for measuring code coverage, and a computer readable recording medium recording a program for executing the method.
또한, 본 발명은, 커버리지 측정을 위해 소스 코드를 컴파일 한 후에, 전체 소스 코드들 중에서 변경이 없는 소스 코드에 대해서는 컴파일하여 실행 파일을 생성해야하는 반복적인 과정을 생략할 수 있는 코드 커버리지 측정 방법과 이를 실행하기 위한 프로그램을 기록한 컴퓨터로 판독가능한 기록매체를 제공한다.The present invention also provides a code coverage measurement method capable of omitting an iterative process of compiling source code that has not been changed among all the source codes and generating an executable file after compiling the source code for coverage measurement, There is provided a computer-readable recording medium storing a program for executing the program.
또한, 본 발명은, 소스 코드의 코드 커버리지 측정한 후에, 소스 코드에 변경이 이루어질 때마다 전체 소스 코드의 코드 커버리지를 다시 측정하지 않을 수 있는 효과적인 코드 커버리지 측정 방법과 이를 실행하기 위한 프로그램을 기록한 컴퓨터로 판독가능한 기록매체를 제공한다.The present invention also provides an effective code coverage measurement method capable of not measuring the code coverage of the entire source code every time a change is made to the source code after measuring the code coverage of the source code and a computer The present invention provides a recording medium readable by a computer.
또한, 본 발명은, 소정의 소스 코드가 하나의 장치가 아닌 복수의 장치들에서 코드 커버리지 테스트가 수행된 경우에, 복수의 장치들에서 수집된 코드 커버리지 테스트를 취합하여 소스 코드의 코드 커버리지를 신속하게 측정할 수 있는 코드 커버리지 측정 방법과 이를 실행하기 위한 프로그램을 기록한 컴퓨터로 판독가능한 기록매체를 제공한다.The present invention also relates to a method and apparatus for collecting code coverage tests collected from a plurality of devices and collecting code coverage of the source code quickly when a code coverage test is performed on a plurality of devices, And a computer readable recording medium recording a program for executing the method.
본 발명의 해결하고자 하는 과제는 이상에서 언급된 것들에 한정되지 않으며, 언급되지 아니한 다른 해결하고자 하는 과제들은 아래의 기재로부터 당업자에게 명확하게 이해되어질 수 있을 것이다.The problems to be solved by the present invention are not limited to those mentioned above, and other problems to be solved can be clearly understood by those skilled in the art from the following description.
실시 형태에 따른 소스 코드의 코드 커버리지 측정 방법은, 상기 소스 코드에 탐침을 삽입하는 단계; 상기 탐침이 삽입된 소스 코드를 컴파일하여 실행 파일을 생성하는 단계; 및 상기 생성된 실행 파일을 이용하여 상기 코드 커버리지를 측정하는 단계;를 포함하고, 상기 소스 코드에 탐침을 삽입하는 단계는, 상기 소스 코드로부터 추상 구문 트리를 생성하는 단계; 상기 추상 구문 트리를 해석하여 제어 흐름 그래프를 생성하는 단계; 및 상기 추상 구문 트리와 상기 제어 흐름 그래프를 이용하여 상기 소스 코드에 상기 탐침을 삽입하는 단계;를 포함한다.A method of measuring a code coverage of a source code according to an embodiment includes: inserting a probe into the source code; Generating an executable file by compiling the source code into which the probe is inserted; And measuring the code coverage using the generated executable file, wherein the step of inserting the probe into the source code comprises: generating an abstract syntax tree from the source code; Analyzing the abstract syntax tree to generate a control flow graph; And inserting the probe into the source code using the abstract syntax tree and the control flow graph.
실시 형태에 따른 소스 코드의 코드 커버리지 측정 방법은, 상기 소스 코드가 실질적으로 변경되었는지 여부를 판별하는 단계; 상기 소스 코드가 실질적으로 변경되었으면, 변경된 소스 코드의 코드 커버리지를 측정하는 단계; 및 상기 소스 코트가 실질적으로 변경되지 않았으면, 기존 코드 커버리지 값을 출력하는 단계;를 포함한다.A method of measuring a code coverage of a source code according to an embodiment includes: determining whether the source code has been substantially changed; Measuring the code coverage of the modified source code if the source code has substantially changed; And outputting an existing code coverage value if the source coat has not been substantially changed.
실시 형태에 따른 소스 코드의 코드 커버리지 측정 방법은, 서버가 복수의 장치들에서 수집된 코드 커버리지 로그들을 수신하여 코드 커버리지를 측정하는 방법으로서, 상기 복수의 장치들로부터 수신되는 코드 커버리지 로그들을 수신되는 시간 순서대로 대기열에 저장하는 단계; 및 상기 대기열에 저장된 코드 커버리지 로그들을 이용하여 상기 코드 커버리지를 측정하는 단계;를 포함한다.A method for measuring a code coverage of a source code according to an embodiment is a method for a server to measure code coverage by receiving collected code coverage logs from a plurality of devices, Storing them in a queue in chronological order; And measuring the code coverage using code coverage logs stored in the queue.
본 발명에 따른 코드 커버리지 측정 방법과 이를 실행하기 위한 프로그램을 기록한 컴퓨터로 판독가능한 기록매체를 사용하면, 코드 커버리지를 측정하고자 하는 소스 코드에 탐침을 효율적으로 삽입할 수 있다. 따라서, 탐침이 삽입된 소스 코드의 바이너리(binary) 크기를 줄일 수 있어 소스 코드의 코드 커버리지 값을 측정할 때 따르는 성능 부작용을 최소화할 수 있는 이점이 있다.Using the method of measuring code coverage according to the present invention and the computer readable recording medium recording the program for executing the method, the probe can be efficiently inserted into the source code for measuring the code coverage. Therefore, it is possible to reduce the size of the binary of the source code into which the probe is inserted, which has the advantage of minimizing the performance adverse effect in measuring the code coverage value of the source code.
또한, 소스 코드를 컴파일 한 후에, 소스 코드에 변경이 이루어질 때마다 전체 소스 코드에 대해서 커버리지 측정용 실행 파일을 생성해야하는 반복적인 과정을 생략할 수 있다. 따라서, 변경되지 안흔ㄴ 소스 코드에 대해서는 커버리지 측정 준비 과정이 생략될 수 있으므로, 소스 코드의 코드 커버리지 측정 준비 시간을 줄일 수 있는 이점이 있다.Also, after compiling the source code, it is possible to omit the iterative process of generating an executable file for coverage measurement for the entire source code whenever a change is made to the source code. Therefore, there is an advantage to reduce preparation time for code coverage measurement of source code, since the coverage measurement preparation process can be omitted for unchanged source code.
또한, 소스 코드의 코드 커버리지 측정한 후에, 소스 코드에 변경이 이루어지더라도 변경되지 않은 소스 코드 부분의 커버리지 값은 그대로 유지하여 전체 소스 코드의 코드 커버리지를 다시 측정하지 않을 수 있다. 따라서, 코드 커버리지 테스트가 된 부분을 다시 테스트하지 않아도 되기 때문에, 특정 커버리지 기준값을 달성하는데 들어가는 시간을 줄일 수 있는 이점이 있다.In addition, after measuring the code coverage of the source code, even if the source code changes, the coverage value of the unchanged source code portion may remain the same and the code coverage of the entire source code may not be measured again. Therefore, there is an advantage in that it is possible to reduce the time taken to achieve a specific coverage reference value, since there is no need to retest the portion subjected to the code coverage test.
또한, 소정의 소스 코드가 하나의 장치가 아닌 복수의 장치들에서 코드 커버리지 테스트가 수행된 경우에, 복수의 장치들에서 수집된 코드 커버리지 테스트를 자동으로 취합하여 소스 코드의 코드 커버리지를 신속하게 측정할 수 있다. In addition, when a code coverage test is performed on a plurality of devices in which a predetermined source code is not a single device, the code coverage test collected on a plurality of devices is automatically collected to quickly measure the code coverage of the source code can do.
도 1은 본 발명의 제1 실시 형태에 따른 코드 커버리지 측정 방법을 나타내는 순서도.
도 2는 도 1에 도시된 소스 코드에 탐침을 삽입하는 단계를 구체화한 순서도.
도 3은 탐침의 삽입 위치를 결정하는 방법을 설명하기 위한 제어 흐름 그래프의 일 예.
도 4는 도 2에 도시된 소스 코드에 탐침을 삽입하는 방법을 구현할 수 있는 탐침 삽입 장치의 블록도.
도 5는 본 발명의 제2 실시 형태에 따른 코드 커버리지 측정 방법을 나타내는 순서도.
도 6은 도 5에 도시된 해당 소스 코드가 기존에 컴파일 수행했던 소스 코드이지 여부를 판별하는 단계(10)를 구체화한 순서도.
도 7은 본 발명의 제3 실시 형태에 따른 코드 커버리지 측정 방법을 나타내는 순서도.
도 8은 도 7에 도시된 변경된 소스 코드가 실질적으로 변경되었는지 여부를 판별하는 단계(20)를 구체화한 순서도.
도 9는 제4 실시 형태에 따른 코드 커버리지 측정 방법을 설명하기 위한 시스템도.
도 10은 제4 실시 형태에 따른 코드 커버리지를 측정하는 방법을 설명하기 위한 순서도.
도 11은 도 10에 도시된 코드 커버리지 측정 방법의 첫 번째 예를 설명하기 위한 도면.
도 12은 도 10에 도시된 코드 커버리지 측정 방법의 두 번째 예를 설명하기 위한 도면.1 is a flowchart showing a code coverage measurement method according to a first embodiment of the present invention;
Figure 2 is a flow chart embodying the step of inserting a probe into the source code shown in Figure 1;
3 is an example of a control flow graph for explaining a method of determining the insertion position of a probe.
4 is a block diagram of a probe insertion device capable of implementing a method of inserting a probe into the source code shown in Fig.
5 is a flowchart showing a code coverage measurement method according to a second embodiment of the present invention;
FIG. 6 is a flow chart embodying the step (10) of determining whether the corresponding source code shown in FIG. 5 is a source code that has been compiled in the past.
7 is a flowchart showing a code coverage measurement method according to a third embodiment of the present invention;
FIG. 8 is a flow chart embodying the
9 is a system diagram for explaining a code coverage measurement method according to a fourth embodiment.
10 is a flowchart for explaining a method of measuring code coverage according to the fourth embodiment;
11 is a diagram for explaining a first example of the code coverage measurement method shown in FIG. 10;
12 is a diagram for explaining a second example of the code coverage measurement method shown in FIG. 10;
이하, 본 발명의 바람직한 실시예의 상세한 설명이 첨부된 도면들을 참조하여 설명된다. 도면들 중 인용부호들 및 동일한 구성요소들에 대해서는 비록 다른 도면상에 표시되더라도 가능한 한 동일한 인용부호들로 표시됨을 유의해야 한다. 참고로 본 발명을 설명함에 있어서 관련된 공지 기능 혹은 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우 그 상세한 설명을 생략한다. 이하 첨부된 도면을 참조하여 본 발명의 실시 형태에 따른 코드 커버리지 측정 방법을 설명한다.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, a detailed description of preferred embodiments of the present invention will be given with reference to the accompanying drawings. It should be noted that in the drawings, the same reference numerals and the same elements are denoted by the same reference numerals even though they are shown on different drawings. In the following description, well-known functions or constructions are not described in detail to avoid unnecessarily obscuring the subject matter of the present invention. Hereinafter, a code coverage measurement method according to an embodiment of the present invention will be described with reference to the accompanying drawings.
도 1은 본 발명의 제1 실시 형태에 따른 코드 커버리지 측정 방법을 나타내는 순서도이다.1 is a flowchart showing a code coverage measurement method according to a first embodiment of the present invention.
도 1을 참조하면, 제1 실시 형태에 따른 코드 커버리지 측정 방법은, 소스 코드에 탐침(probe)을 삽입하는 단계(100), 실행 파일을 생성하는 단계(300) 및 코드 커버리지를 측정하는 단계(500)를 포함할 수 있다.Referring to Figure 1, a method of measuring code coverage according to a first embodiment includes the steps of inserting a probe into a source code, generating an executable file (300), and measuring code coverage 500).
소스 코드에 탐침을 삽입하는 단계(100)는 코드 커버리지를 측정하기 위한 탐침을 소스 코드에 삽입하는 단계이다. 이 단계는, 도 2를 참조하여 구체적으로 후술하도록 한다.A
실행 파일을 생성하는 단계(300)는, 탐침이 삽입된 소스 코드를 컴파일하여 실행 파일을 생성하는 단계이다. The
코드 커버리지를 측정하는 단계(500)는 생성된 실행 파일을 이용하여 코드 커버리지를 측정하는 단계이다.The step of measuring
도 2는 도 1에 도시된 소스 코드에 탐침을 삽입하는 단계를 구체화한 순서도이다.2 is a flow chart embodying the step of inserting a probe into the source code shown in Fig.
소스 코드에 탐침을 삽입하는 단계는, 추상 구문 트리(abstract syntax tree, AST)를 생성하는 단계(110), 제어 흐름 그래프(Control Flow Graph, CFG)를 생성하는 단계(120) 및 탐침을 삽입하는 단계(130)를 포함할 수 있다.The step of inserting a probe into the source code includes generating an abstract syntax tree (AST) 110, creating a Control Flow Graph (CFG) 120,
추상 구문 트리를 생성하는 단계(110)는, 소스 코드로부터 추상 구문 트리를 생성할 수 있다. 추상 구문 트리는, 파서(parser)를 이용하여 생성할 수 있다. 여기서, 파서는 예를 들어 C/C++ 파서일 수 있다. 소스 코드를 C/C++ 파서로 입력시키면 C/C++ 파서는 추상 구문 트리를 생성할 수 있다.The
제어 흐름 그래프를 생성하는 단계(120)는 앞서 생성된 추상 구문 트리를 해석하여 제어 흐름 그래프를 생성한다.The step 120 of generating a control flow graph generates a control flow graph by interpreting the abstract syntax tree generated previously.
탐침을 삽입하는 단계(130)는, 앞서 생성된 추상 구문 트리와 제어 흐름 그래프를 이용하여 탐침을 삽입하는 단계이다. 구체적인 탐침 삽입 방법을 이하에서 구체적으로 설명하도록 한다.The
탐침은 추상 구문 트리와 제어 흐름 그래프를 이용하여 삽입한다. 구체적으로, 제어 흐름 그래프를 참조하여 탐침을 삽입하고, 추상 구문 트리 내의 분기문의 조건의 개수를 판별하여 탐침을 삽입할 수 있다. Probe is inserted using abstract syntax tree and control flow graph. Specifically, the probe can be inserted with reference to the control flow graph, and the probe can be inserted by determining the number of conditions of the branch statement in the abstract syntax tree.
제어 흐름 그래프를 참조하여 탐침을 삽입하는 방법과 추상 구문 트리 내의 분기문의 조건의 개수를 판별하여 탐침을 삽입하는 방법은 각자 병렬적으로 수행될 수 있다. 이하에서 각각 나눠서 설명하도록 한다.The method of inserting the probe by referring to the control flow graph and the method of inserting the probe by discriminating the number of the condition of the branch statement in the abstract syntax tree can be performed in parallel. The following will be separately described below.
제어 흐름 그래프를 참조하여 탐침을 삽입하는 방법은, 제어 흐름 그래프에서 탐침의 삽입 위치를 결정한 후, 탐침을 삽입할 수 있다. The method of inserting the probe with reference to the control flow graph can insert the probe after determining the insertion position of the probe in the control flow graph.
제어 흐름 그래프에서 탐침의 삽입 위치를 결정하는 방법은, 제어 흐름 그래프에서 기저 경로(basis path)들을 검색한 후, 각 기저 경로당 하나의 탐침을 삽입하는 것으로 결정될 수 있다. The method of determining the insertion position of the probe in the control flow graph can be determined by inserting one probe per each basis path after searching the basis paths in the control flow graph.
여기서, 기저 경로란, 분기문의 한 가지(brench)에서 다음 분기문을 만나기 전까지의 경로를 의미하는데, 기저 경로는 더 이상 나눌 수 없는 최소의 수행 흐름이다. 도 3을 참조하여 제어 흐름 그래프에서 탐침의 삽입 위치를 결정하는 방법의 일 예를 설명하도록 한다.Here, the base path means a path from one brench of the branching query to the next branching, and the base path is the minimum execution flow that can not be further divided. An example of a method of determining the insertion position of the probe in the control flow graph will be described with reference to FIG.
도 3은 탐침의 삽입 위치를 결정하는 방법을 설명하기 위한 제어 흐름 그래프의 일 예이다.3 is an example of a control flow graph for explaining a method of determining the insertion position of the probe.
도 3에 도시된 제어 흐름 그래프에서 기저 경로를 검색한다. 기저 경로는 앞에서 설명한 바와 같이 분기문(if)의 한 가지에서 다음 분기문(if)을 만나기 전까지의 경로이므로, 도 3에 도시된 제어 흐름 그래프에서의 기저 경로는 5개(path 1, path 2, path 3, path 4, path 5)이다. The base path is retrieved in the control flow graph shown in FIG. Since the basis path is a path from one of the branch statements (if) to the next until the next branch statement (if) is encountered, the base path in the control flow graph shown in FIG. 3 is five (
5개의 기저 경로들(path 1, path 2, path 3, path 4, path 5) 각각에 하나의 탐침(P1, P2, P3, P4, P5)을 삽입한다.One probe (P1, P2, P3, P4, P5) is inserted into each of the five base paths (
다시, 도 2를 참조하여, 추상 구문 트리 내의 분기문의 조건의 개수를 판별하여 탐침을 삽입하는 방법을 설명한다.Referring again to FIG. 2, a method of inserting probes by determining the number of branch condition conditions in the abstract syntax tree will be described.
추상 구문 트리 내의 분기문의 조건의 개수를 판별하여 탐침을 삽입하는 방법은, 추상 구문 트리에서 조건의 개수가 2개 이상인 분기문을 검색하고, 검색된 분기문의 형태를 변경한 후, 탐침을 삽입하는 것일 수 있다. The method of inserting a probe by determining the number of conditions of a branch statement in an abstract syntax tree is as follows. A branch statement having two or more conditions in an abstract syntax tree is searched, and a probe is inserted .
여기서, 분기문은 실행 흐름을 결정하는 문으로서, for문, if문 및 while문을 포함할 수 있다. 그리고, 분기문의 형태를 변경한다는 의미는 검색된 분기문의 실질적인 의미는 변경하지 않고, 탐침을 삽입할 수 있도록 형식을 변경하는 것을 의미한다.Here, the branch statement is a statement for determining execution flow, and may include a for statement, an if statement, and a while statement. The meaning of changing the form of the branch query means that the form is changed so that the probe can be inserted without changing the actual meaning of the found branch query.
이하에서는, 조건이 2개인 분기문(if문)의 형태를 변경하는 하나의 방법을 예를 들어 설명하도록 한다.Hereinafter, a method of changing the form of a branch statement (if statement) having two conditions will be described as an example.
[분기문 예][Branching example]
If (A && B)If (A && B)
상기 [분기문 예]는 if문이고, 조건이 2개(A, B)이며, 2개의 조건(A, B)은 1개의 논리 연산자(&&)로 결합되어 있다. 상기 [분기문의 예]의 진리표는 아래의 <표 1>과 같다.The [branch statement example] is an if statement, and the condition is two (A, B), and the two conditions (A, B) are combined by one logical operator (&&). The truth table of the above [example of branch inquiry] is shown in <Table 1> below.
상기 [분기문 예]는 형식적으로 탐침을 삽입할 수 없는 형태를 갖고 있다. 따라서, 상기 [분기문 예]는 탐침을 삽입할 수 있는 형태로 변경해야 한다. 상기 [분기문 예]의 실질적인 의미는 변경하지 않으면서 탐침을 삽입할 수 있는 형태로 변경한 후 탐침을 삽입하면, 아래의 [분기문 변형 예1]과 같을 수 있다.The [branching example] has a form in which a probe can not be inserted formally. Therefore, the [branching example] should be changed to a form in which the probe can be inserted. When the probe is inserted after changing the form of the probe to be inserted without changing the actual meaning of the above [branch statement example], it may be the same as the following [branch statement modification example 1].
[분기문 변형 예1] [Branch Example Variation Example 1]
If ( ( A ? probe (m), 1 : probe (n), 0 ) && ( B ? probe(o), 1 : probe (p), 0 ) )If ((A? Probe (m), 1: probe (n), 0) && (B? Probe
상기 [분기문 변형 예1]은 논리 연산자(&&)는 그대로 존재하고, 탐침을 삽입하기 위해 각 조건을 삼항 연산자로 변경하였다. 이렇게 변경하여도 상기 [분기문 예]와의 실질적인 의미는 동일하다. 이러한 상기 [분기문 변형 예1]는 내부에 분기점이 3개(?, &&, ?)가 존재하고, 총 4개의 탐침(m, n, o, p)이 존재한다.In [Branching Modification 1], the logical operator (&&) is present, and each condition is changed to a ternary operator in order to insert a probe. Even if such a change is made, the practical meaning is the same as that of the above [branch example]. In this branching variant example 1, there are three branch points (?, &&,?) Inside, and there are four probes (m, n, o, p) in total.
상기 [분기문 예]의 다른 변형 예는 아래의 [분기문 변형 예2]와 같을 수 있다.Another modified example of the above [Example of branch statement] may be the same as the following [modified example of branch statement 2].
[분기문 변형 예2] [Branch Example Variation Example 2]
If ( A ? ( B ? probe (a), 1 : probe (b), 0 ) : probe (c), 0 )If (A? (B? Probe (a), 1: probe (b), 0)
상기 [분기문 변형 예2]는 논리 연산자(&&)를 삼항 연산자로 변경하였다. 이렇게 변경하여도 상기 [분기문 예]와의 실질적인 의미는 동일하다. 이러한 상기 [분기문 변형 예2]는 내부에 분기점이 2개(?, ?)이 존재하고, 총 3개의 탐침(a, b, c)이 존재한다. In [Branch Statement Variation Example 2], the logical operator (&&) was changed to a ternary operator. Even if such a change is made, the practical meaning is the same as that of the above [branch example]. In this branching variant example 2, there are two branch points (?,?) Inside and there are three probes (a, b, c) in total.
상기 [분기문 변형 예2]는, 상기 [분기문 변형 예1]과 대비하였을 때, 조건을 삼항 연산자로 변경하는 것이 아니라, 논리 연산자를 삼항 연산자로 변경함으로써 분기점의 개수와 탐침의 개수를 각각 1개씩 더 줄일 수 있다. 분기점의 개수와 탐침의 개수는 코드 커버리지 측정을 위한 성능 부하를 결정하는 결정적인 요소이므로, 상기 [분기문 예]를 [분기문 변형 예1]이 아닌, [분기문 변형 예2]로 변경함으로써, 코드 커버리지 측정 성능을 향상시킬 수 있다.
The [Branch Statement Variation Example 2], when compared with the above [Branch Statement Variation Example 1], does not change the condition to the ternary operator but changes the logical operator to the ternary operator so that the number of branch points and the number of probes are You can reduce one by one. Since the number of the branch points and the number of probes are decisive factors for determining the performance load for the code coverage measurement, by changing the above [branch statement example] to [branch instruction variant example 2] instead of [branch instruction variant example 1] The code coverage measurement performance can be improved.
도 4는 도 2에 도시된 소스 코드에 탐침을 삽입하는 방법을 구현할 수 있는 탐침 삽입 장치의 블록도이다. 4 is a block diagram of a probe insertion device capable of implementing a method of inserting a probe into the source code shown in FIG.
도 4를 참조하면, 탐침 삽입 장치(400)는, 파서(410), 제어 흐름 그래프 생성기(430) 및 소스 코드 재기록기(450)를 포함할 수 있다.4, the
파서(410)는 입력되는 소스 코드를 파싱하여 추상 구문 트리를 생성한다. 여기서, 파서(410)는 C/C++ 파서일 수 있다.The
제어 흐름 그래프 생성기(430)는 파서(410)에서 출력된 추상 구문 트리를 입력으로 하여 이를 해석하여 제어 흐름 그래프(430)를 생성한다.The control
소스 코드 재기록기(450)는 제어 흐름 그래프 생성기(430)에서 출력된 제어 흐름 그래프와 파서(410)에서 출력된 추상 구문 트리를 이용하여 탐침이 삽입된 소스 코드를 출력한다. 제어 흐름 그래프와 추상 구문 트리를 이용하여 탐침을 삽입하는 방법은 도 2 내지 도 3에서 상세히 설명하였으므로, 이에 대한 설명은 생략하기로 한다.
The
도 5는 본 발명의 제2 실시 형태에 따른 코드 커버리지 측정 방법을 나타내는 순서도이다.5 is a flowchart showing a code coverage measurement method according to a second embodiment of the present invention.
도 5에 도시된 제2 실시 형태에 따른 코드 커버리지 측정 방법은, 적어도 1회 이상 컴파일이 수행되었던 소스 코드(이하, ‘이전 소스 코드’)의 내용이 개발자나 기타 프로그램에 의해 변경된 경우에 있어서, 변경된 소스 코드의 코드 커버리지를 측정하는 방법에 관한 것이다.The method of measuring code coverage according to the second embodiment shown in FIG. 5 is a method of measuring a code coverage of a source code (hereinafter referred to as " previous source code ") that has been compiled at least once, And how to measure the code coverage of the changed source code.
도 5를 참조하면, 제2 실시 형태에 따른 코드 커버리지 측정 방법은, 기존에 컴파일을 수행하였던 소스 코드인지 여부를 판별하는 단계(10), 소스 코드에 탐침을 삽입하는 단계(100), 실행 파일을 생성하는 단계(300) 및 코드 커버리지를 측정하는 단계(500)를 포함할 수 있다.5, a code coverage measurement method according to a second embodiment includes a
여기서, 기존에 컴파일을 수행하였던 소스 코드인지 여부를 판별하는 단계(10)를 제외하고, 소스 코드에 탐침을 삽입하는 단계(100), 실행 파일을 생성하는 단계(300) 및 코드 커버리지를 측정하는 단계(500)는 도 1에 도시된 소스 코드에 탐침을 삽입하는 단계(100), 실행 파일을 생성하는 단계(300) 및 코드 커버리지를 측정하는 단계(500)와 동일하므로, 이하에서는 기존에 컴파일을 수행하였던 소스 코드인지 여부를 판별하는 단계(10)를 구체적으로 설명하도록 한다.Here, except for the
기존에 컴파일을 수행했던 소스 코드인지 여부를 판별하는 단계(10)는, 소스 코드에 탐침을 삽입(100)하기 전에, 해당 소스 코드가 기존에 컴파일 수행하여 실행 파일을 생성했던 것인지 여부를 판별하는 단계이다.
판별 결과, 해당 소스 코드가 기존에 컴파일을 수행하지 않았던 것이라면 기존 것과 다른 소스 코드로 인식하고 소스 코드에 탐침을 삽입(100)하고, 탐침이 삽입된 소스 코드를 컴파일하여 새로운 실행 파일을 생성(300)한다. 그리고, 새로운 실행 파일을 저장(400)한 후, 새로운 실행 파일의 코드 커버리지를 측정(500)한다. As a result of the determination, if the corresponding source code is not previously compiled, it is recognized as a source code different from the existing one, the probe is inserted into the source code (100), and the new source code is generated by compiling the probe- )do. After storing a new executable file (400), the code coverage of the new executable file is measured (500).
한편, 판별 결과, 해당 소스 코드가 기존에 컴파일을 수행했던 것이라면, 기존에 컴파일을 수행하여 미리 저장된 실행 파일을 불러와 코드 커버리지를 측정하는 단계(500)로 이동한다. 그러면, 이하에서는, 변경된 소스 코드가 기존에 컴파일 수행했던 것인지를 어떻게 판별하는지를 도 6을 참조하여 설명하도록 한다.On the other hand, if it is determined that the source code has been previously compiled, the compile operation is performed and the pre-stored executable file is loaded and the code coverage is measured (step 500). Hereinafter, how to determine whether the changed source code has been previously compiled or not will be described with reference to FIG.
도 6은 도 5에 도시된 해당 소스 코드가 기존에 컴파일 수행했던 소스 코드이지 여부를 판별하는 단계(10)를 구체화한 순서도이다.FIG. 6 is a flowchart illustrating a step (10) of determining whether the corresponding source code shown in FIG. 5 is a source code that has been compiled previously.
도 6을 참조하면, 변경된 소스 코드가 기존에 컴파일 수행했던 소스 코드이지 여부를 판별하는 단계(10)는, 전처리된 소스 코드를 생성하는 단계(11), 노이즈를 제거하는 단계(12), 고유값을 생성하는 단계(13), 생성된 고유값이 이전 고유값과 동일한지 여부를 판별하는 단계(14) 및 미리 저장된 실행 파일을 출력하는 단계(15)를 포함할 수 있다. 여기서, 노이즈를 제거하는 단계(12)는 생략될 수도 있다.Referring to FIG. 6, step (10) of determining whether the changed source code is the source code that has been previously compiled includes step (11) of generating preprocessed source code, step (12) (Step 14) of determining whether the generated eigenvalue is equal to the previous eigenvalue, and outputting the previously stored executable file (step 15). Here, step 12 of removing noise may be omitted.
전처리된 소스 코드를 생성하는 단계(11)는, 변경된 소스 코드를 전처리(preprocessing)하여 전처리된 소스 코드를 생성하는 단계이다. The
여기서, 전처리된 소스 코드는 탐침을 삽입할 수 있는 또는 컴파일을 수행할 수 있는 형상이 고정된 소스 코드이다. Here, the preprocessed source code is source code in which a probe can be inserted or a shape that can be compiled is fixed.
여기서, 전처리는, 변경된 소스 코드를 해석하여 포함 관계 및 매크로 정의를 반영한 컴파일용 소스 코드를 생성하는 과정을 의미한다. 포함 관계를 반영한다는 것은, 전처리의 대상인 변경된 소스 코드 내에 시스템 헤더(system header)나 사용자 헤더(user header)가 포함(include)된 경우, 변경된 소스 코드에 상기 시스템 헤더나 사용자 헤더를 삽입하는 것을 의미한다. 그리고, 매크로 정의를 반영한다는 것은, 변경된 소스 코드 내에 정의된 매크로를 매크로 정의를 따르는 확장 문자열로 치환하는 것을 의미한다.Here, the preprocessing means a process of analyzing the changed source code and generating a source code for compilation reflecting the inclusion relation and the macro definition. Reflecting the inclusion relation means that when the system header or the user header is included in the changed source code which is a subject of the preprocessing, the system header or the user header is inserted into the changed source code do. Reflecting the definition of a macro means replacing the macro defined in the changed source code with an extension string following the macro definition.
노이즈를 제거하는 단계(12)는, 전처리된 소스 코드의 노이즈를 제거하는 단계이다. 여기서, 노이즈란, 전처리 시점에 의존하는 요소들을 의미한다. 전처리 시점에 의존하는 요소는, 예를 들면, 전처리가 수행된 시간에 관한 정보 및 날짜에 관한 정보일 수 있다. 이러한 노이즈는, 정규 표현식(regular expression)을 사용하여 제거할 수 있다. 여기서, 정규 표현식은 특정한 규칙을 가진 문자열의 집합을 표현하는데 사용하는 형식 언어를 의미한다.The
고유값을 생성하는 단계(13)는, 노이즈가 제거된 전처리된 소스 코드에 대해 정규화를 수행하여 형상 식별이 가능한 고유값을 생성하는 단계이다. 정규화를 수행한다는 것은 해쉬 알고리즘(hash algorithm)을 사용하여 전처리된 소스 코드 전체의 고유값을 생성하는 것을 의미한다. 여기서, 해쉬 알고리즘은 MD5(Message-Digest algorithm 5) 함수를 이용할 수 있다. 소스 코드에 주석을 삽입한다거나 띄어쓰기를 하는 등의 실질적인 의미를 변경하는 것이 아닌 것에 의해서는 소스 코드 전체의 고유값은 변경되지 않는다.The
생성된 고유값이 이전 고유값과 동일한지 여부를 판별하는 단계(14)는, 생성된 고유값이 소정의 저장소에 미리 저장된 이전 고유값과 동일한지 여부를 판별하는 단계이다. 여기서, 상기 소정의 저장소에는 소정의 고유값들과 그 고유값들 각각에 대응하는 실행 파일들이 저장되어 있다. The step (14) of determining whether the generated eigenvalue is the same as the previous eigenvalue is a step of determining whether or not the generated eigenvalue is the same as the previous eigenvalue previously stored in the predetermined repository. Herein, the predetermined repository stores executable files corresponding to predetermined eigenvalues and their eigenvalues.
만약, 생성된 고유값이 이전 고유값과 동일하면, 상기 소정의 저장소에 저장된 실행 파일을 불러온다(15). 그리고, 불려온 실행 파일의 코드 커버리지를 측정(500)한다. If the generated eigenvalue is equal to the previous eigenvalue, the executable file stored in the predetermined repository is loaded (15). Then, the code coverage of the called executable file is measured (500).
한편, 생성된 고유값이 이전 고유값과 다르면, 전처리된 소스 코드에 탐침을 삽입(100)한다. 그리고, 도 5에 도시된 바와 같이, 실행 파일을 생성(300)하고, 추후에 다시 이용할 수 있도록 생성된 실행 파일을 생성된 고유값과 함께 상기 소정의 저장소에 저장한다(400). 마지막으로, 생성된 실행 파일의 코드 커버리지를 측정(500)한다. On the other hand, if the generated eigenvalue differs from the previous eigenvalue, the probe is inserted (100) into the preprocessed source code. Then, as shown in FIG. 5, an executable file is generated (300), and the generated executable file is stored in the predetermined repository together with the generated eigenvalue (400). Finally, the code coverage of the generated executable file is measured (500).
이와 같이, 도 5에 도시된 코드 커버리지 측정 방법은, 적어도 1회 이상 컴파일이 수행되었던 소스 코드가 개발자나 프로그램 등에 의해 변경된 경우에, 그 변경된 내용이 소스 코드의 실질적인 변경인지 아니면 실질적이지 않은 변경인지를 판별한 후, 그 변경된 내용이 실질적이지 않은 변경인 경우에는 기존에 컴파일이 수행되었던 실행 파일을 불러오고, 불려온 실행 파일의 코드 커버리지를 측정한다. 따라서, 적어도 1회 이상 컴파일 수행되었던 소스 코드에 주석이나 띄어쓰기 등과 같은 실질적인 변경이 이뤄진 경우에는, 변경된 소스 코드에 다시 탐침을 삽입한다거나 다시 실행 파일을 생성하는 과정을 다시 반복할 필요가 없다. 따라서, 적어도 1회 이상 컴파일 수행했던 소스 코드에 대해서는 코드 커버리지를 측정하기 위한 준비 시간을 단축할 수 있는 이점이 있다.
5, if the source code for which compilation has been performed at least once has been changed by a developer, a program, or the like, whether the changed content is a substantial change in the source code or a non-substantial change And if the changed contents are not substantial changes, the executable file in which the compilation has been performed is called up, and the code coverage of the executable file called is measured. Therefore, when the source code that has been compiled at least once has been changed, such as annotation or spacing, there is no need to repeat the process of inserting the probe back into the changed source code or generating the executable again. Therefore, there is an advantage that the preparation time for measuring the code coverage can be shortened for the source code that has been compiled at least once.
도 7은 본 발명의 제3 실시 형태에 따른 코드 커버리지 측정 방법을 나타내는 순서도이다.7 is a flowchart showing a code coverage measurement method according to a third embodiment of the present invention.
도 7에 도시된 제3 실시 형태에 따른 코드 커버리지 측정 방법은, 적어도 1회 이상 코드 커버리지가 측정되었던 소스 코드(이하, ‘이전 소스 코드’)의 내용이 개발자나 기타 프로그램에 의해 변경된 경우에 있어서, 변경된 소스 코드의 코드 커버리지를 측정하는 방법에 관한 것이다.The method of measuring a code coverage according to the third embodiment shown in Fig. 7 is a method of measuring a code coverage of a program in a case where a content of a source code (hereinafter referred to as a 'previous source code') whose code coverage has been measured at least once is changed by a developer or another program , And how to measure the code coverage of the changed source code.
도 7을 참조하면, 제3 실시 형태에 따른 코드 커버리지 측정 방법은, 변경된 소스 코드가 실질적으로 변경되었는지 여부를 판별하는 단계(20), 기존 코드 커버리지 값을 출력하는 단계(30), 코드 커버리지를 측정하는 단계(40) 및 변경된 함수의 고유값과 함수 커버리지 값을 저장하는 단계(50)를 포함할 수 있다.Referring to FIG. 7, a code coverage measurement method according to a third embodiment includes a
변경된 소스 코드가 실질적으로 변경되었는지 여부를 판별하는 단계(20)는, 적어도 1회 이상 코드 커버리지를 측정했던 이전 소스 코드가 형식적인 변경이 아닌, 실질적으로 변경되었는지를 판별하는 단계이다.
판별 결과, 만약 변경된 소스 코드가 실질적으로 변경된 것이 아닌 경우에는, 변경된 소스 코드의 코드 커버리지 측정하지 않고, 기존에 측정했던 코드 커버리지 값을 불러와 출력한다(30).As a result of the determination, if the changed source code is not substantially changed, the code coverage value of the changed source code is not measured, and the previously measured code coverage value is retrieved and output (30).
한편, 변경된 소스 코드가 실질적으로 변경된 것이라면, 변경된 소스 코드의 코드 커버리지를 측정하고(40), 소스 코드 내에서 변경된 함수의 고유값과 함수 커버리지 값을 저장한다(50). 여기서, 변경된 함수의 고유값과 함수 커버리지 값은 추후에 다시 이용될 수 있도록 소정의 저장소에 저장될 수 있다.On the other hand, if the changed source code is substantially changed, the code coverage of the changed source code is measured 40, and the unique value of the changed function and the function coverage value are stored in the
이하에서는 도 8을 참조하여 변경된 소스 코드가 실질적으로 변경되었는지 여부를 어떻게 판별하는지를 구체적으로 설명하도록 한다.Hereinafter, how to determine whether the changed source code has been substantially changed will be described in detail with reference to FIG.
도 8은 도 7에 도시된 변경된 소스 코드가 실질적으로 변경되었는지 여부를 판별하는 단계(20)를 구체화한 순서도이다.8 is a flow chart embodying the
도 8을 참조하면, 변경된 소스 코드가 기존에 코드 커버리지를 측정했던 것인지 여부를 판별하는 단계(20)는, 전처리된 소스 코드를 생성하는 단계(21), 노이즈를 제거하는 단계(22), 함수별 고유값을 생성하는 단계(23), 적어도 하나 이상의 변경된 함수가 존재하는지를 판별하는 단계(24) 및 변경된 함수와 변경되지 않은 함수를 분류하는 단계(25)를 포함할 수 있다. 여기서, 노이즈를 제거하는 단계(22)는 생략될 수도 있다.Referring to FIG. 8, step 20 of determining whether the modified source code has previously measured code coverage includes generating 21 a source code that has been pre-processed, removing 22 a noise, (23) generating a star eigenvalue, (24) determining if there is at least one changed function, and (25) classifying the modified function and the unmodified function. Here, the
전처리된 소스 코드를 생성하는 단계(21)와 노이즈를 제거하는 단계(22)는, 도 6에 도시된 전처리된 소스 코드를 생성하는 단계(11)와 노이즈를 제거하는 단계(12)와 동일하므로, 그 설명은 전술한 것으로 대체한다.The step of generating the preprocessed
함수별 고유값을 생성하는 단계(23)는, 전처리된 소스 코드 내에 존재하는 복수의 함수들 별로 정규화를 수행하여 형상 식별이 가능한 함수별 고유값을 생성하는 단계이다. 따라서, 생성되는 함수별 고유값의 개수는 함수의 개수에 따라 결정된다. 여기서, 정규화를 수행한다는 것은 해쉬 알고리즘(hash algorithm)을 사용하여 전처리된 소스 코드 내의 복수의 함수들 별로 각각의 고유값을 생성하는 것을 의미한다. 특정 함수에 주석을 삽입한다거나 띄어쓰기를 하는 등의 실질적인 의미를 변경하는 것이 아닌 형식적인 변경에 의해서는 해당 함수의 고유값은 변경되지 않는다.The
전처리된 소스 코드 내의 복수의 함수들 별로 고유값을 생성한 후, 복수의 함수들 중에서 적어도 하나 이상의 변경된 함수가 존재하는지 여부를 판별한다(24). 여기서, 변경된 함수가 존재하는지 여부는, 소정의 저장소에 미리 저장된 이전 소스 코드의 함수별 고유값들과 생성된 변경된 소스 코드의 함수별 고유값들을 일대일로 비교하여 판별할 수 있다.After generating eigenvalues for each of the plurality of functions in the preprocessed source code, it is determined whether or not at least one changed function among the plurality of functions exists (24). Here, whether or not the changed function exists can be determined by comparing one-by-one comparison of the eigenvalues of the generated source code with the function-specific eigenvalues of the previous source code previously stored in the predetermined repository.
판별 결과, 만약 변경된 소스 코드의 함수별 고유값들이 이전 소스 코드의 함수별 고유값들과 모두 동일하면, 기존 코드 커버리지 값을 출력한다(30). As a result of the determination, if the function-specific eigenvalues of the changed source code are all the same as the function-specific eigenvalues of the previous source code, the existing code coverage value is output (30).
한편, 변경된 소스 코드의 함수별 고유값들 중 적어도 하나 이상이 이전 소스 코드의 함수별 고유값들과 일치하지 않으면, 복수의 함수들을 변경된 함수와 변경되지 않은 함수를 분류하고(25), 코드 커버리지를 측정한다(40). 여기서, 코드 커버리지를 측정하는 단계(40)는, 변경되지 않은 함수의 함수 커버리지 값을 상기 소정의 저장소에서 불러와 변경된 소스 코드의 코드 커버리지를 계산한다. On the other hand, if at least one of the function-specific eigenvalues of the changed source code does not match the function-specific eigenvalues of the previous source code, the plurality of functions are classified into the changed function and the unmodified function (25) (40). Here, the step of measuring
제3 실시 형태에 따른 코드 커버리지 측정 방법을 종래의 코드 커버리지 측정 방법과 비교하면, 예를 들어, 이전 소스 코드는 100개의 함수를 포함하고, 상기 이전 소스 코드의 코드 커버리지 값은 100(%)이였는데, 상기 이전 소스 코드의 100개의 함수들 중 1개의 함수가 실질적으로 변경된 경우, 종래의 코드 커버리지 측정 방법에 의하면 코드 커버리지 값은 0(%) (왜냐하면, 종래의 코드 커버리지 측정 방법은 소스 코드가 실질적 또는 형식적으로 변경되면 새로운 소스 코드로 인식하기 때문에)이 되지만, 제3 실시 형태에 따른 코드 커버리지 측정 방법에 의하면 코드 커버리지 값은 0이 아닌 99가 출력된다. 따라서, 변경되지 않은 함수의 함수 커버리지는 그대로 유지되기 때문에, 추후에 변경되지 않은 함수를 다시 테스트하지 않아도 되는 이점이 있다.
Comparing the code coverage measurement method according to the third embodiment with the conventional code coverage measurement method, for example, the previous source code includes 100 functions, and the code coverage value of the previous source code is 100 (%) , And if one of the 100 functions of the previous source code is substantially changed, then the code coverage value is 0 (%) according to the conventional code coverage measurement method Or if it is changed formally, it is recognized as new source code). However, according to the code coverage measurement method according to the third embodiment, the code coverage value is outputted as 99 instead of 0. Therefore, since the function coverage of the unchanged function is maintained, there is an advantage that it is not necessary to retest the unchanged function in the future.
도 9는 제4 실시 형태에 따른 코드 커버리지 측정 방법을 설명하기 위한 시스템도이다.9 is a system diagram for explaining a code coverage measurement method according to the fourth embodiment.
도 9를 참조하면, 제4 실시 형태에 따른 코드 커버리지 측정 방법이 수행되는 시스템은 복수의 장치들(910, 930)과 서버(950)를 포함할 수 있다.Referring to FIG. 9, a system in which a code coverage measurement method according to the fourth embodiment is performed may include a plurality of
복수의 장치들(910, 930)은 서버(950)로부터 전송되거나 사용자에 의해 직접 업로드된 소스 코드의 코드 커버리지를 측정할 수 있다. The plurality of
복수의 장치들(910, 930) 각각은 로그 수집 에이전트를 포함할 수 있다. Each of the plurality of
로그 수집 에이전트는, 복수의 장치들(910, 930) 각각의 코드 커버리지 측정을 제어할 수 있다. 구체적으로, 로그 수집 에이전트는, 복수의 장치들(910, 930) 각각의 코드 커버리지 측정의 시작과 종료를 제어할 수 있으며, 복수의 장치들(910, 930) 각각의 코드 커버리지 측정 수행 현황 정보를 파악할 수 있다. The log collection agent may control the code coverage measurements of each of the plurality of
로그 수집 에이전트는 수집된 코드 커버리지 로그를 서버(950)로 전송할 수 있다. 여기서, 로그 수집 에이전트는 수집된 코드 커버리지 로그를 서버(950)의 갱신 요청에 따라 전송할 수도 있고, 서버(950)의 요청없이 미리 설정된 임의의 시점에 수집된 코드 커버리지 로그를 서버(950)로 자동 전송할 수도 있다. 여기서, 임의의 시점은 코드 커버리지 측정이 종료되었을 때일 수도 있고, 서버(950)가 요청한 임의의 시점일 수도 있다. The log collection agent may send the collected code coverage log to the
로그 수집 에이전트는 수집된 코드 커버리지 로그를 서버(950)로 전송하기 전에, 수집된 코드 커버리지 로그에 대해서 정규화를 수행하여 수집된 코드 커버리지 로그의 고유값을 생성할 수 있다. 그리고, 수집된 코드 커버리지 로그를 서버(950)로 전송할 때, 생성된 고유값도 함께 전송할 수 있다. 여기서, 고유값은 수집된 코드 커버리지 로그를 해쉬 알고리즘을 사용하여 생성된 형상 식별이 가능한 문자열일 수 있다.The log collection agent may normalize the collected code coverage log to generate a unique value of the collected code coverage log before transmitting the collected code coverage log to the
복수의 장치들(910, 930)은 스마트폰, 태블릿 PC, 랩탑, 데스트탑 등일 수 있으며, 유선 또는 무선으로 서버(950)와 데이터 통신을 수행할 수 있다.The plurality of
서버(950)는 복수의 장치들(910, 930)과 데이터 통신을 수행할 수 있다.The
서버(950)는 복수의 장치들(910, 930)로부터 코드 커버리지 로그를 수신하고, 수신된 코드 커버리지 로그들을 저장하며, 저장된 코드 커버리지 로그들을 소정의 방법으로 취합하여 코드 커버리지를 측정할 수 있다. The
서버(950)는 복수의 장치들(910, 930)로 코드 커버리지 로그를 요청하는 갱신 요청을 할 수 있다.The
도 10을 참조하여, 서버(950)가 복수의 장치들(910, 930)에서 수집된 코드 커버리지 로그를 취합하여 코드 커버리지를 측정하는 방법을 구체적으로 설명하도록 한다.Referring to FIG. 10, a method for collecting code coverage logs collected by a plurality of
도 10은 제4 실시 형태에 따른 코드 커버리지를 측정하는 방법을 설명하기 위한 순서도이다.10 is a flowchart for explaining a method of measuring code coverage according to the fourth embodiment.
도 10을 참조하면, 제4 실시 형태에 따른 코드 커버리지 측정 방법은, 서버(950)가 복수의 장치들(910, 930)로부터 코드 커버리지 로그를 수신하는 단계, 서버(950)가 수신된 코드 커버리지 로그들을 저장하는 단계(951) 및 서버(950)가 저장된 코드 커버리지 로그들을 이용하여 코드 커버리지를 측정하는 단계(952)를 포함할 수 있다.10, a method for measuring a code coverage according to the fourth embodiment includes the steps of a
여기서, 서버(950)가 복수의 장치들(910, 930)로부터 코드 커버리지 로그를 수신하기 전에, 서버(950)가 복수의 장치들(910, 930)에게 코드 커버리지 로그를 달라는 갱신 요청을 할 수도 있다. 갱신 요청은 이 요청을 받은 현재의 코드 커버리지 로그를 달라는 요청일 수도 있고, 미래의 임의의 시점(특정 시간 또는 특정 시간대)에 코드 커버리지 로그를 달라는 요청일 수도 있다.Here, before the
서버(950)가 수신된 코드 커버리지 로그들을 저장하는 단계(951)는, 서버(950)가 복수의 장치들(910, 930)로부터 수신되는 코드 커버리지 로그들을 대기열(queue)에 저장하는 단계일 수 있다.The
서버(950)가 코드 커버리지를 측정하는 단계(952)는, 대기열에 저장된 코드 커버리지 로그들을 소정의 방법으로 취합하여 측정 대상 소스 코드의 코드 커버리지를 측정하는 단계일 수 있다.The
서버(950)가 수신된 코드 커버리지 로그들을 저장하고(951), 코드 커버리지를 측정하는(952) 구체적인 방법을 두 가지 예를 들어 설명하도록 한다.The
첫 번째 예는, 측정 대상인 소스 코드 전체가 복수의 장치들(910, 930)에서 각각 개별적으로 코드 커버리지 테스트가 수행된 후, 서버(950)가 복수의 장치들(910, 930)로부터 코드 커버리지 로그들을 수신한 경우이다. In the first example, after the entire source code to be measured is individually subjected to a code coverage test on a plurality of
두 번째 예는, 측정 대상인 소스 코드가 복수개로 나눠져 복수의 장치들(910, 930)로 분배되어 복수의 장치들(910, 930)에서 코드 커버리지 테스트가 수행된 후, 서버(950)가 복수의 장치들(910, 930)로부터 코드 커버리지 로그들을 수신한 경우이다.In the second example, after the source code to be measured is divided into a plurality of devices and distributed to a plurality of
첫 번째 예와 두 번째 예의 근본적인 차이점은, 복수의 장치들(910, 930)에서 테스트된 소스 코드들이 서로 동일한지 아니면 서로 다른 것인지 여부이다. 첫 번째 예는 복수의 장치들(910, 930)에서 테스트된 소스 코드들이 서로 동일한 경우이고, 두 번째 예는 복수의 장치들(910, 930)에서 테스트된 소스 코드들이 서로 다른 경우이다. 먼저, 첫 번째 예에 따른 코드 커버리지 측정 방법을 도 11을 참조하여 이하에서 설명하도록 한다.The fundamental difference between the first example and the second example is whether the source codes tested in the plurality of
도 11은 도 10에 도시된 코드 커버리지 측정 방법의 첫 번째 예를 설명하기 위한 도면이다.11 is a diagram for explaining a first example of the code coverage measurement method shown in FIG.
도 11에 도시된 첫 번째 예는, 도 11의 (a)에 도시된 표와 같이, 특정 시점들(9:00, 9:10, 9:20)에서 제1 장치(910)로부터 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)를 수신하고, 제2 장치(930)로부터 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)를 수신한 경우를 예정한 것이다. 도 11의 (a)의 코드 커버리지 로그들 각각은 복수의 부분들을 포함하는데, 도면에서는 복수의 부분들을 박스들로 표현하였고, 체크된 박스는 코드 커버리지 테스트가 수행된 부분이고, 체크되지 않은 박스는 코드 커버리지 테스트가 수행되지 않은 부분이다. 제1 코드 커버리지 로그와 제2 코드 커버리지 로그는 동일한 소스 코드를 대상으로 한 것이기 때문에, 각 로그의 데이터의 길이는 동일한 것으로 가정하였다.The first example shown in FIG. 11 shows a case where the
도 10에 도시된 서버(950)가 도 11의 (a)에 도시된 표와 같은 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)를 수신하면, 서버(950)는 대기열에 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)을 도 11의 (b)에 도시된 바와 같이 저장한다. 구체적으로, 대기열에는 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)이 서버(950)에 수신된 순서대로 저장된다. 편의상 도면에서는 제1 코드 커버리지 로그가 제2 코드 커버리지 로그보다 먼저 서버(950)에 수신되는 것으로 가정한다.The
서버(950)의 대기열에 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)이 저장되면, 서버(950)는 저장된 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 취합하여 측정 대상 소스 코드의 코드 커버리지를 측정한다. When the first code coverage logs (log_1-1, log_1-2, log_1-3) and the second code coverage logs (log_2-1, log_2-2, log_2-3) are stored in the queue of the
여기서, 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 취합하여 측정 대상 소스 코드의 코드 커버리지를 측정하는 하나의 방법은, 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)이 대기열에 저장되는 순서대로 차례대로 누적하여 상기 코드 커버리지를 측정하는 방법이다. 구체적으로, 제일 먼저 수신된 제1 코드 커버리지 로그 1(log_1-1)의 코드 커버리지 값(40%)을 계산하고, 다음으로 제1 코드 커버리지 로그 1(log_1-1)과 제2 코드 커버리지 로그 1(log_2-1)을 누적하여 코드 커버리지 값(60%)을 계산한다. 이러한 방법으로 마지막으로 저장된 제2 코드 커버리지 로그 3(log_2-3)까지 누적하여 코드 커버리지 값(100%)을 계산한다. One method of collecting the code coverage logs (log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3) to measure the code coverage of the measurement target source code is as follows: The code coverage is measured by accumulating the coverage logs (log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3) in the order that they are stored in the queue. Specifically, the code coverage value (40%) of the first code coverage log 1 (log_1-1) received first is calculated, and then the first code coverage log 1 (log_1-1) and the second code coverage log 1 (log_2-1) to calculate a code coverage value (60%). In this way, the code coverage value (100%) is cumulatively accumulated up to the last stored second code coverage log 3 (log_2-3).
그러나, 상기 방법은 코드 커버리지 로그의 데이터 크고 긴 경우에 효율적이지 못하며 계산 시간이 너무 오래 걸린다는 문제가 있다. 따라서, 다음과 같은 방법으로 코드 커버리지 값을 계산하면, 더 효율적이고 신속하게 코드 커버리지 값을 계산할 수 있다.However, the above method is not effective when the data of the code coverage log is large and long, and the calculation time is too long. Therefore, by calculating the code coverage value in the following manner, the code coverage value can be calculated more efficiently and quickly.
코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 취합하여 측정 대상 소스 코드의 코드 커버리지를 측정하는 다른 방법은, 대기열에 저장된 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)과 동일한 데이터 크기를 갖는 가상의 코드 커버리지 로그를 만들고, 생성된 가상의 코드 커버리지 로그를 구성하는 복수의 부분들 각각에 대해서 코드 커버리지 테스트 여부를 판별한다. Another way to gather code coverage logs (log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3) to measure the code coverage of the measurement source code is to use the code stored in the queue A virtual code coverage log having the same data size as the coverage logs (log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3) is created, and the generated virtual code coverage log And determines whether the code coverage test is performed for each of the plurality of constituent parts.
구체적으로, 생성된 가상의 코드 커버리지 로그를 구성하는 복수의 부분들 각각에 대해서 코드 커버리지 테스트 여부를 판별하는 방법은, 모든 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)에서, 가상의 코드 커버리지 로그의 제1 부분과 대응되는 제1 부분들(1100)을 검색하고, 제1 부분들(1100) 중에서 하나라도 코드 커버리지 테스트된 것(체크된 것)이 존재하면, 가상의 코드 커버리지의 제1 부분은 테스트된 것으로 판별한다. 같은 방법으로 가상의 코드 커버리지의 모든 부분들에 대해서 테스트 여부를 판별하여 코드 커버리지 값을 계산한다. 이러한 방법에 의하면, 도 11의 (b)의 경우, 생성된 가상의 코드 커버리지 로그의 모든 부분들은 체크된 것으로 될 것이므로, 코드 커버리지 값은 100(%)이 될 것이다.Specifically, a method for determining whether or not a code coverage test is performed for each of a plurality of parts constituting the generated virtual code coverage log includes the steps of: extracting all code coverage logs (log_1-1, log_1-2, log_1-3, log_2- 1, log_2-2, log_2-3), the
도 12은 도 10에 도시된 코드 커버리지 측정 방법의 두 번째 예를 설명하기 위한 도면이다.12 is a diagram for explaining a second example of the code coverage measurement method shown in FIG.
도 12에 도시된 첫 번째 예는, 도 12의 (a)에 도시된 표와 같이, 특정 시점들(9:00, 9:10, 9:20)에서 제1 장치(910)로부터 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)를 수신하고, 제2 장치(930)로부터 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)를 수신한 경우를 예정한 것이다. 도 12의 (a)의 코드 커버리지 로그들 각각은 복수의 부분들을 포함하는데, 도면에서는 복수의 부분들을 박스들로 표현하였고, 체크된 박스는 코드 커버리지 테스트가 수행된 부분이고, 체크되지 않은 박스는 코드 커버리지 테스트가 수행되지 않은 부분이다. 제1 코드 커버리지 로그와 제2 코드 커버리지 로그는 서로 다른 소스 코드를 대상으로 한 것이기 때문에, 각 로그의 데이터의 길이는 서로 다른 것으로 가정하였다.The first example shown in FIG. 12 shows a case where the
도 10에 도시된 서버(950)가 도 12의 (a)에 도시된 표와 같은 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)를 수신하면, 서버(950)는 대기열에 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)을 도 12의 (b)에 도시된 바와 같이 저장한다. 구체적으로, 대기열에는 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)이 서버(950)에 수신된 순서대로 저장된다. 편의상 제1 코드 커버리지 로그가 제2 코드 커버리지 로그보다 먼저 서버(950)에 수신되는 것으로 가정한다.The
서버(950)의 대기열에 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)과 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)이 저장되면, 서버(950)는 저장된 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 취합하여 측정 대상 소스 코드의 코드 커버리지를 측정한다.When the first code coverage logs (log_1-1, log_1-2, log_1-3) and the second code coverage logs (log_2-1, log_2-2, log_2-3) are stored in the queue of the
여기서, 도 12에 도시된 두 번째 예는 도 11에 도시된 첫 번째 예와는 달리 제1 코드 커버리지 로그와 제2 코드 커버리지 로그가 서로 다른 소스 코드를 대상으로 한 것이기 때문에 서로 다른 로그이다. 따라서, 도 12에 도시된 두 번째 예는, 대기열에 저장된 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 서로 같은 소스 코드를 대상으로 한 것들끼리 분류하는 단계가 코드 커버리지를 측정하기 앞서 수행되어야 한다.The second example shown in FIG. 12 is different from the first example shown in FIG. 11 because the first code coverage log and the second code coverage log are different source codes. 12, the code coverage logs (log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3) stored in the queues are stored in the same source code The step of classifying the objects should be performed before measuring the code coverage.
여기서, 대기열에 저장된 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 서로 같은 소스 코드를 대상으로 한 것들끼리 분류하는 방법은, 고유값을 기준으로 분류할 수 있다. 도 10에 도시된 복수의 장치들(910, 930)은 서버(950)로 코드 커버리지 로그를 전송할 때, 코드 커버리지 로그와 함께 해당 코드 커버리지 로그의 고유값을 함께 전송할 수 있다. 상기 해당 코드 커버리지 로그의 고유값은 해쉬 알고리즘을 이용하여 생성될 수 있다. 상기 해당 코드 커버리지 로그의 고유값은 해당 코드 커버리지 로그 내의 복수의 부분들 각각이 테스트되었는지 여부와 상관없는 변하지 않는 고유의 값이다. 따라서, 서버(950)는 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)과 그들 각각의 고유값을 이용하여 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 서로 같은 소스 코드를 대상으로 한 것들끼리 분류할 수 있다. 이러한 방법으로 대기열에 저장된 모든 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)을 분류하면, 제1 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3)은 서로 같은 고유값을 갖고, 제2 코드 커버리지 로그들(log_2-1, log_2-2, log_2-3)도 서로 같은 고유값을 갖기 때문에, 서로 분류될 수 있다.Here, the method of classifying the code coverage logs (log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3) stored in the queues for the same source codes as each other, You can classify by eigenvalue. When transmitting the code coverage log to the
이렇게 대기열에 저장된 모든 코드 커버리지 로그들(log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3)은 고유값에 따라 분류된 후, 앞서 도 11에서 설명한 두 가지 방법으로 측정 대상 소스 코드의 코드 커버리지 값이 계산될 수 있다.
All the code coverage logs (log_1-1, log_1-2, log_1-3, log_2-1, log_2-2, log_2-3) stored in the queue are classified according to their eigenvalues, The code coverage value of the measurement target source code can be calculated.
이상 설명된 실시 형태는 다양한 컴퓨터 구성요소를 통하여 실행될 수 있는 프로그램 명령어의 형태로 구현되어 컴퓨터로 판독가능한 기록매체에 기록될 수 있다. 상기 컴퓨터로 판독가능한 기록매체는 프로그램 명령어, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. The embodiments described above can be implemented in the form of program instructions that can be executed through various computer components and recorded in a computer-readable recording medium. The computer-readable recording medium may include program commands, data files, data structures, and the like, alone or in combination.
상기 컴퓨터로 판독가능한 기록매체에 기록되는 프로그램 명령어는 본 발명을 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 분야의 당업자에게 공지되어 사용 가능한 것일 수도 있다.The program instructions recorded on the computer-readable recording medium may be those specially designed and constructed for the present invention or may be those known to those skilled in the art of computer software.
컴퓨터로 판독가능한 기록매체의 예에는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 ROM, RAM, 플래시 메모리 등과 같은 프로그램 명령어를 저장하고 실행하도록 특별히 구성된 하드웨어 장치가 포함된다. 프로그램 명령어의 예에는, 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드도 포함된다. 상기 하드웨어 장치는 본 발명에 따른 처리를 실행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.Examples of the computer-readable recording medium include magnetic media such as a hard disk, a floppy disk and a magnetic tape, optical recording media such as CD-ROM and DVD, magneto-optical media such as a floptical disk, optical media), and hardware devices specifically configured to store and execute program instructions such as ROM, RAM, flash memory, and the like. Examples of program instructions include machine language code such as those generated by a compiler, as well as high-level language code that can be executed by a computer using an interpreter or the like. The hardware device may be configured to operate as one or more software modules for performing the process according to the present invention, and vice versa.
이상 첨부된 도면을 참조하여 본 발명의 실시 형태를 설명하였으나 이는 단지 예시일 뿐 본 발명을 한정하는 것이 아니며, 본 발명이 속하는 분야의 통상의 지식을 가진 자라면 본 실시 형태의 본질적인 특성을 벗어나지 않는 범위에서 이상에 예시되지 않은 여러 가지의 변형과 응용이 가능함을 알 수 있을 것이다. 예를 들어, 실시 형태에 구체적으로 나타난 각 구성 요소는 변형하여 실시할 수 있는 것이다. 그리고 이러한 변형과 응용에 관계된 차이점들은 첨부된 청구범위에서 규정하는 본 발명의 범위에 포함되는 것으로 해석되어야 할 것이다.While the present invention has been particularly shown and described with reference to exemplary embodiments thereof, it is clearly understood that the same is by way of illustration and example only and is not to be taken by way of limitation, It will be understood that various changes and modifications may be made without departing from the spirit and scope of the invention. For example, each component specifically shown in the embodiments can be modified and implemented. It is to be understood that all changes and modifications that come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein.
Claims (10)
상기 소스 코드에 탐침을 삽입하는 단계;
상기 탐침이 삽입된 소스 코드를 컴파일하여 실행 파일을 생성하는 단계; 및
상기 생성된 실행 파일을 이용하여 상기 코드 커버리지를 측정하는 단계;를 포함하고,
상기 소스 코드에 탐침을 삽입하는 단계는,
상기 소스 코드로부터 추상 구문 트리를 생성하는 단계;
상기 추상 구문 트리를 해석하여 제어 흐름 그래프를 생성하는 단계; 및
상기 추상 구문 트리와 상기 제어 흐름 그래프를 이용하여 상기 소스 코드에 상기 탐침을 삽입하는 단계;를 포함하는, 코드 커버리지 측정 방법.A method for measuring code coverage of a source code,
Inserting a probe into the source code;
Generating an executable file by compiling the source code into which the probe is inserted; And
And measuring the code coverage using the generated executable file,
Wherein inserting the probe into the source code comprises:
Generating an abstract syntax tree from the source code;
Analyzing the abstract syntax tree to generate a control flow graph; And
And inserting the probe into the source code using the abstract syntax tree and the control flow graph.
상기 추상 구문 트리와 상기 제어 흐름 그래프를 이용하여 상기 소스 코드에 상기 탐침을 삽입하는 단계는,
상기 제어 흐름 그래프에서 기저 경로들을 검색한 후, 각 기저 경로당 하나의 제1 탐침을 삽입하는 단계; 및
상기 추상 구문 트리 내의 분기문의 조건의 개수를 판별하여 제2 탐침을 삽입하는 단계;
를 포함하는, 코드 커버리지 측정 방법.The method according to claim 1,
Wherein inserting the probe into the source code using the abstract syntax tree and the control flow graph comprises:
Inserting a first probe for each base path after searching the base paths in the control flow graph; And
Determining a number of branch condition conditions in the abstract syntax tree and inserting a second probe;
/ RTI >
상기 추상 구문 트리 내의 분기문의 조건의 개수를 판별하여 제2 탐침을 삽입하는 단계는,
상기 조건의 개수가 2개 이상인 분기문에 존재하는 논리 연산자를 삼항 연산자로 대체하고, 상기 제2 탐침을 삽입하는, 코드 커버리지 측정 방법.3. The method of claim 2,
Wherein the step of determining the number of branch condition conditions in the abstract syntax tree and inserting the second probe comprises:
Replacing a logical operator existing in a branch statement where the number of conditions is two or more with a ternary operator and inserting the second probe.
상기 소스 코드에 탐침을 삽입하는 단계 이전에,
상기 소스 코드가 기존에 컴파일을 수행하였던 것인지 여부를 판별하는 단계를 더 포함하고,
상기 소스 코드가 기존에 컴파일을 수행하였던 것이면, 기존 실행 파일을 재사용하여 코드 커버리지를 측정하기 위한 준비 과정을 생략하는
, 코드 커버리지 측정 방법.The method according to claim 1,
Prior to inserting the probe into the source code,
Further comprising the step of determining whether the source code has previously performed compilation,
If the source code has already been compiled, the preparation process for measuring the code coverage by reusing the existing executable file is omitted
, Code coverage measurement method.
상기 소스 코드가 기존에 컴파일을 수행하였던 것인지 여부를 판별하는 단계는,
상기 소스 코드를 전처리하여 전처리된 소스 코드를 생성하는 단계;
상기 전처리된 소스 코드의 노이즈를 제거하는 단계;
상기 노이즈가 제거된 전처리된 소스 코드의 고유값을 생성하는 단계;
상기 생성된 고유값이 미리 저장된 이전 고유값과 동일한지 여부를 판별하는 단계;
상기 생성된 고유값이 상기 이전 고유값과 동일하면, 상기 기존 실행 파일을 이용하여 상기 코드 커버리지를 측정하고,
상기 생성된 고유값이 상기 이전 고유값과 다르면, 상기 소스 코드에 상기 탐침을 삽입하는, 코드 커버리지 측정 방법.5. The method of claim 4,
Wherein the step of determining whether the source code has previously performed compilation comprises:
Preprocessing the source code to generate a preprocessed source code;
Removing noise of the preprocessed source code;
Generating an eigenvalue of the noise-removed preprocessed source code;
Determining whether the generated eigenvalue is equal to a previously stored previous eigenvalue;
If the generated eigenvalue is equal to the previous eigenvalue, the code coverage is measured using the existing executable file,
And inserting the probe into the source code if the generated eigenvalue differs from the previous eigenvalue.
상기 소스 코드가 실질적으로 변경되었는지 여부를 판별하는 단계;
상기 소스 코드가 실질적으로 변경되었으면, 변경된 소스 코드의 코드 커버리지를 측정하는 단계; 및
상기 소스 코트가 실질적으로 변경되지 않았으면, 기존 코드 커버리지 값을 출력하는 단계;
를 포함하는, 코드 커버리지 측정 방법.A method for measuring code coverage of a source code,
Determining whether the source code has substantially changed;
Measuring the code coverage of the modified source code if the source code has substantially changed; And
If the source coat has not substantially changed, outputting an existing code coverage value;
/ RTI >
상기 소스 코드가 실질적으로 변경되었는지 여부를 판별하는 단계는,
상기 소스 코드를 전처리하여 전처리된 소스 코드를 생성하는 단계;
상기 전처리된 소스 코드 내의 함수별 고유값들을 생성하는 단계;
상기 생성된 함수별 고유값들을 미리 저장된 기존 함수별 고유값들과 비교하여 적어도 하나 이상의 변경된 함수가 존재하는지 여부를 판별하는 단계; 및
상기 생성된 함수별 고유값들 중 적어도 하나 이상이 변경되었으면, 변경된 함수와 변경되지 않은 함수를 분류하는 단계;를 포함하고,
상기 소스 코드가 실질적으로 변경되었으면, 변경된 소스 코드의 코드 커버리지를 측정하는 단계는, 상기 변경되지 않은 함수의 함수 커버리지 값을 불러와 상기 변경된 소스 코드의 코드 커버리지를 계산하는, 코드 커버리지 측정 방법.The method according to claim 6,
Wherein the step of determining whether the source code has substantially changed comprises:
Preprocessing the source code to generate a preprocessed source code;
Generating function-specific eigenvalues in the preprocessed source code;
Comparing the generated function-specific eigenvalues with previously stored eigenvalues of each function to determine whether there is at least one changed function; And
And classifying the changed function and the unmodified function if at least one of the generated eigenvalues of each function is changed,
Wherein measuring the code coverage of the altered source code, when the source code has substantially changed, calls the function coverage value of the unaltered function to calculate the code coverage of the altered source code.
상기 복수의 장치들로부터 수신되는 코드 커버리지 로그들을 수신되는 시간 순서대로 대기열에 저장하는 단계; 및
상기 대기열에 저장된 코드 커버리지 로그들을 이용하여 상기 코드 커버리지를 측정하는 단계;
를 포함하는, 코드 커버리지 측정 방법.A method for measuring code coverage by a server receiving code coverage logs collected from a plurality of devices,
Storing code coverage logs received from the plurality of devices in a queue in time sequence; And
Measuring the code coverage using the code coverage logs stored in the queue;
/ RTI >
상기 코드 커버리지를 계산하는 단계 이전에,
상기 대기열에 저장된 코드 커버리지 로그들을 서로 같은 소스 코드를 대상으로 한 것들끼리 분류하는 단계를 더 포함하는, 코드 커버리지 측정 방법.9. The method of claim 8,
Prior to calculating the code coverage,
Further comprising the step of classifying code coverage logs stored in said queue for those of the same source code.
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020140107037A KR101667262B1 (en) | 2014-08-18 | 2014-08-18 | Method for measuring code coverage and computer readable recording medium having program the same |
| PCT/KR2015/007395 WO2016027992A1 (en) | 2014-08-18 | 2015-07-16 | Method for measuring code coverage and computer-readable recording medium having program for executing same recorded thereon |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020140107037A KR101667262B1 (en) | 2014-08-18 | 2014-08-18 | Method for measuring code coverage and computer readable recording medium having program the same |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| KR20160021585A true KR20160021585A (en) | 2016-02-26 |
| KR101667262B1 KR101667262B1 (en) | 2016-10-19 |
Family
ID=55350904
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| KR1020140107037A Active KR101667262B1 (en) | 2014-08-18 | 2014-08-18 | Method for measuring code coverage and computer readable recording medium having program the same |
Country Status (2)
| Country | Link |
|---|---|
| KR (1) | KR101667262B1 (en) |
| WO (1) | WO2016027992A1 (en) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20180099192A (en) * | 2017-02-28 | 2018-09-05 | 슈어소프트테크주식회사 | Method and apparatus for measuring code coverage and computer readable recording medium having program the same |
| KR20180126852A (en) * | 2017-05-18 | 2018-11-28 | 뱅크웨어글로벌 주식회사 | Management method for java methods based on bytecode, development system and method for java software using the same |
| KR20190128867A (en) * | 2018-05-09 | 2019-11-19 | 한국과학기술원 | Testing method and apparatus of target program using mutated program |
| CN114327491A (en) * | 2022-03-07 | 2022-04-12 | 深圳开源互联网安全技术有限公司 | Source code instrumentation method, apparatus, computer device and storage medium |
| CN117785884A (en) * | 2023-12-28 | 2024-03-29 | 支付宝(杭州)信息技术有限公司 | Method for generating graph logic execution plan of graph query statement, data processing method and device |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106293865B (en) * | 2016-08-09 | 2019-05-31 | 中国银行股份有限公司 | The Compilation Method and device of computer source code, authentication method, apparatus and system |
| KR102165037B1 (en) * | 2018-12-03 | 2020-10-13 | 슈어소프트테크주식회사 | Code coverage measuring apparatus, code coverage measuring method of the code coverage mearusing apparatus, and code coverage measuring system |
| CN111240772B (en) * | 2020-01-22 | 2024-06-18 | 腾讯科技(深圳)有限公司 | Block chain-based data processing method, device and storage medium |
| CN113641345B (en) * | 2021-08-13 | 2025-05-27 | 网易(杭州)网络有限公司 | Method, device, electronic device and storage medium based on mapping configuration |
| CN113946516B (en) * | 2021-10-20 | 2025-07-18 | 腾讯科技(深圳)有限公司 | Code coverage rate determining method, device and storage medium |
| CN114253862B (en) * | 2021-12-29 | 2024-10-01 | 湖南泛联新安信息科技有限公司 | HDL code simulation coverage rate asynchronous event driven automatic analysis method |
| CN114416546B (en) * | 2022-01-06 | 2025-08-05 | 中国光大银行股份有限公司 | Code coverage rate determining method and device |
| KR102935141B1 (en) | 2022-12-27 | 2026-03-09 | 경상국립대학교산학협력단 | Software test system for test case reuse and method thereof |
| CN120234241B (en) * | 2025-03-12 | 2025-11-18 | 中国电子科技集团公司第十五研究所 | Visual detection method for C++ code coverage rate |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20060045568A (en) * | 2004-04-07 | 2006-05-17 | 마이크로소프트 코포레이션 | Probe optimization method and system during program calibration |
| KR20070087400A (en) * | 2006-02-23 | 2007-08-28 | 삼성전자주식회사 | Test Coverage Analysis Method and System of Operating System Software |
| US20090287729A1 (en) * | 2008-05-16 | 2009-11-19 | Microsoft Corporation | Source code coverage testing |
| US20120284697A1 (en) * | 2011-05-05 | 2012-11-08 | International Business Machines Corporation | Code evaluation based on failure prediction |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20040051364A (en) * | 2002-12-12 | 2004-06-18 | 한국전자통신연구원 | Method for measuring path code coverage |
| KR101290847B1 (en) * | 2011-11-11 | 2013-07-29 | 포항공과대학교 산학협력단 | Method for creating a feature model from legacy system source code |
-
2014
- 2014-08-18 KR KR1020140107037A patent/KR101667262B1/en active Active
-
2015
- 2015-07-16 WO PCT/KR2015/007395 patent/WO2016027992A1/en not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20060045568A (en) * | 2004-04-07 | 2006-05-17 | 마이크로소프트 코포레이션 | Probe optimization method and system during program calibration |
| KR20070087400A (en) * | 2006-02-23 | 2007-08-28 | 삼성전자주식회사 | Test Coverage Analysis Method and System of Operating System Software |
| US20090287729A1 (en) * | 2008-05-16 | 2009-11-19 | Microsoft Corporation | Source code coverage testing |
| US20120284697A1 (en) * | 2011-05-05 | 2012-11-08 | International Business Machines Corporation | Code evaluation based on failure prediction |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20180099192A (en) * | 2017-02-28 | 2018-09-05 | 슈어소프트테크주식회사 | Method and apparatus for measuring code coverage and computer readable recording medium having program the same |
| KR20180126852A (en) * | 2017-05-18 | 2018-11-28 | 뱅크웨어글로벌 주식회사 | Management method for java methods based on bytecode, development system and method for java software using the same |
| KR20190128867A (en) * | 2018-05-09 | 2019-11-19 | 한국과학기술원 | Testing method and apparatus of target program using mutated program |
| CN114327491A (en) * | 2022-03-07 | 2022-04-12 | 深圳开源互联网安全技术有限公司 | Source code instrumentation method, apparatus, computer device and storage medium |
| CN117785884A (en) * | 2023-12-28 | 2024-03-29 | 支付宝(杭州)信息技术有限公司 | Method for generating graph logic execution plan of graph query statement, data processing method and device |
Also Published As
| Publication number | Publication date |
|---|---|
| KR101667262B1 (en) | 2016-10-19 |
| WO2016027992A1 (en) | 2016-02-25 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR101667262B1 (en) | Method for measuring code coverage and computer readable recording medium having program the same | |
| US8819642B2 (en) | Method and system for generating and processing black box test cases | |
| JP5961275B2 (en) | Use of traceability link strength for software development integrity monitoring | |
| US20180300226A1 (en) | System and method for equivalence class analysis-based automated requirements-based test case generation | |
| US8607198B2 (en) | Cross-concern code coverage assessment | |
| US20130291113A1 (en) | Process flow optimized directed graph traversal | |
| KR101583932B1 (en) | Signature generation apparatus for generating signature of program and the method, malicious code detection apparatus for detecting malicious code of signature and the method | |
| US10902130B2 (en) | Guiding automated testing of binary programs | |
| JP6142705B2 (en) | Iterative generation of symbolic test drivers for object-oriented languages | |
| KR102088431B1 (en) | Message based communicating method of test server and test server communicating based on message | |
| JP6559600B2 (en) | Information processing apparatus, information processing program, and inspection system | |
| WO2018092237A1 (en) | Program code generation apparatus, program code generation method, and program code generation program | |
| JP6245006B2 (en) | Test case generation apparatus, method, and program | |
| CN119621575A (en) | A test case generation method, device and medium | |
| US10102099B2 (en) | Performance information generating method, information processing apparatus and computer-readable storage medium storing performance information generation program | |
| CN116775040B (en) | Pile inserting method for realizing code vaccine and application testing method based on code vaccine | |
| US8756580B2 (en) | Instance-based field affinity optimization | |
| CN108563561A (en) | A kind of program recessiveness constraint extracting method and system | |
| JP2012181666A (en) | Information processing device, information processing method and information processing program | |
| JP7331681B2 (en) | Test execution program, test execution method, and test execution device | |
| US8819645B2 (en) | Application analysis device | |
| KR102117905B1 (en) | Credibility test result management data auto generation method and credibility test result management data auto generation apparatus | |
| US20190065355A1 (en) | Information processing device and output method | |
| JP7509312B2 (en) | Program analysis device, program analysis method, and program | |
| CN115658551B (en) | Code testing method, storage medium, electronic device and apparatus |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A201 | Request for examination | ||
| PA0109 | Patent application |
St.27 status event code: A-0-1-A10-A12-nap-PA0109 |
|
| PA0201 | Request for examination |
St.27 status event code: A-1-2-D10-D11-exm-PA0201 |
|
| R18-X000 | Changes to party contact information recorded |
St.27 status event code: A-3-3-R10-R18-oth-X000 |
|
| PN2301 | Change of applicant |
St.27 status event code: A-3-3-R10-R13-asn-PN2301 St.27 status event code: A-3-3-R10-R11-asn-PN2301 |
|
| E902 | Notification of reason for refusal | ||
| PE0902 | Notice of grounds for rejection |
St.27 status event code: A-1-2-D10-D21-exm-PE0902 |
|
| T11-X000 | Administrative time limit extension requested |
St.27 status event code: U-3-3-T10-T11-oth-X000 |
|
| E13-X000 | Pre-grant limitation requested |
St.27 status event code: A-2-3-E10-E13-lim-X000 |
|
| P11-X000 | Amendment of application requested |
St.27 status event code: A-2-2-P10-P11-nap-X000 |
|
| P13-X000 | Application amended |
St.27 status event code: A-2-2-P10-P13-nap-X000 |
|
| PG1501 | Laying open of application |
St.27 status event code: A-1-1-Q10-Q12-nap-PG1501 |
|
| E902 | Notification of reason for refusal | ||
| PE0902 | Notice of grounds for rejection |
St.27 status event code: A-1-2-D10-D21-exm-PE0902 |
|
| E13-X000 | Pre-grant limitation requested |
St.27 status event code: A-2-3-E10-E13-lim-X000 |
|
| P11-X000 | Amendment of application requested |
St.27 status event code: A-2-2-P10-P11-nap-X000 |
|
| P13-X000 | Application amended |
St.27 status event code: A-2-2-P10-P13-nap-X000 |
|
| E701 | Decision to grant or registration of patent right | ||
| PE0701 | Decision of registration |
St.27 status event code: A-1-2-D10-D22-exm-PE0701 |
|
| GRNT | Written decision to grant | ||
| PR0701 | Registration of establishment |
St.27 status event code: A-2-4-F10-F11-exm-PR0701 |
|
| PR1002 | Payment of registration fee |
St.27 status event code: A-2-2-U10-U11-oth-PR1002 Fee payment year number: 1 |
|
| PG1601 | Publication of registration |
St.27 status event code: A-4-4-Q10-Q13-nap-PG1601 |
|
| R18-X000 | Changes to party contact information recorded |
St.27 status event code: A-5-5-R10-R18-oth-X000 |
|
| FPAY | Annual fee payment |
Payment date: 20191007 Year of fee payment: 4 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 4 |
|
| FPAY | Annual fee payment |
Payment date: 20200916 Year of fee payment: 5 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 5 |
|
| FPAY | Annual fee payment |
Payment date: 20211013 Year of fee payment: 6 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 6 |
|
| FPAY | Annual fee payment |
Payment date: 20221012 Year of fee payment: 7 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 7 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 8 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 9 |
|
| R18-X000 | Changes to party contact information recorded |
St.27 status event code: A-5-5-R10-R18-oth-X000 |
|
| PR1001 | Payment of annual fee |
St.27 status event code: A-4-4-U10-U11-oth-PR1001 Fee payment year number: 10 |
|
| U11 | Full renewal or maintenance fee paid |
Free format text: ST27 STATUS EVENT CODE: A-4-4-U10-U11-OTH-PR1001 (AS PROVIDED BY THE NATIONAL OFFICE) Year of fee payment: 10 |