370 0

How to Automatically Create Test Oracle with Machine Learning in Software Test Automation

Title
How to Automatically Create Test Oracle with Machine Learning in Software Test Automation
Author
윤복주
Alternative Author(s)
윤복주
Advisor(s)
Inwhee Joe
Issue Date
2022. 8
Publisher
한양대학교
Degree
Master
Abstract
Software testing is an essential activity for software quality assurance and is the most expensive activity in the development process. To reduce such test costs, test automation is performed on some or all the tests. In this case, a software test mechanism is needed to generate an expected output corresponding to the test input and compare it with the test input, which is called a test oracle. In conventional test automation, test oracles are created in a way that humans understand and judge the programs under test. Alternatively, a method of analyzing the internal code of the target program and directly writing and confirming the test code is also used. In other words, the method of manually creating a test oracle must either understand the internal code of the program under test or know how the program works. In addition, as the number of test cases increases, the cost of Oracle creation increases proportionally. To solve this problem, this study presents a plan to automatically generate test oracles based on machine learning (ML). The process of generating a model through data learning and applying it to a test operates as follows. First, it learns a set of learning data to generate a suitable model. And it automatically generates test oracles by applying the model that generated test data to be used for verification. Second, the automation script loads the test data, and performs the test. The test result is determined by comparing the test performance result with the expected result generated by the model for the same test data. In this case, when the test results are the same, the test is continued, and test data in the case of different results are separately stored. The test target program used in the experiment is an exchange order function. When the user enters the data to be ordered on the exchange, it is registered in the order system if it is a valid order, and if it is not, it is determined to be an invalid order and is not registered in the system. The data to be used for learning is order data entered by the user, and the result value is classified as TRUE if it is a valid order and FALSE if it is an invalid order. Through data learning, three models with high performance were selected. The models were Radom Forest, Gradient Boosting, and Neural Network, achieving accuracy of 0.99 or higher. In particular, the highest accuracy was obtained when the code coverage of the configured learning data was high and the data result value composition ratio was 40 to 60%. In short, the method of automating test oracles based on machine learning proved the accuracy of test oracles through experiments. In addition, by applying this to test automation, the foundation has been laid for automating the entire test process by automating the test oracle, which is the area of human judgment. |소프트웨어 테스트은 소프트웨어 품질 보증을 위한 필수 활동이고, 개발프로세스에서 가장 비용이 많은 활동이다. 이러한 테스트 비용을 줄이기 위하여 테스트 일부 또는 전체를 대상으로 테스트 자동화를 수행한다. 이 때, 테스트 입력에 해당하는 예상출력을 생성하고 테스트 입력과 비교하는 소프트웨어 테스트 매커니즘이 필요하고 이를 테스트 오라클이라고 한다. 기존의 테스트 자동화에서, 테스트 오라클은 인간이 테스트 대상 프로그램을 이해하고, 판단하는 방식으로 만들어졌다. 또는 대상 프로그램의 내부 코드를 분석하여 테스트 코드를 직접 작성하여 확인하는 방식도 사용되고 있다. 즉, 테스트 오라클을 수동으로 생성하는 방식은 테스트 대상 프로그램의 내부 코드를 이해하고 있거나, 프로그램의 동작 방식을 알고 있어야 한다. 또한 테스트 케이스 수가 증가할 수록 오라클 생성비용은 비례하여 증가한다. 이러한 문제점을 해결하기 위해, 본 연구에서는 머신러닝(ML)기반의 테스트 오라클을 자동으로 생성하는 방안을 제시한다. 데이터 학습을 통하여 모델을 생성하고 테스트에 적용하는 과정은 아래와 같이 동작한다. 첫째로, 학습 데이터 셋을 학습하여 적합한 모델을 생성한다. 그리고 검증에 사용할 테스트 데이터를 생성된 모델을 적용하여 자동으로 테스트 오라클을 생성한다. 둘째로, 자동화 스크립트는 테스트 데이터를 로드하여, 테스트를 수행한다. 동일한 테스트 데이터에 대하여 테스트 수행결과와, 모델이 생성한 예상결과와 비교하여 테스트 결과가 결정된다. 이때 테스트 결과가 동일한 경우, 테스트를 계속 진행하고, 결과가 다른 경우의 테스트 데이터는 별도로 저장된다. 실험에 사용된 테스트 대상 프로그램은 거래소 주문 기능이다. 사용자가 거래소에서 주문할 데이터를 입력하면, 유효한 주문인 경우, 주문시스템에 등록되고, 아닌 경우, 유효하지 않은 주문으로 판단되어 시스템에 등록되지 않는다. 학습에 사용할 데이터는 사용자가 입력하는 주문 데이터이고, 결과값은 유효한 주문인 경우 TRUE, 유효하지 않은 주문인 경우 FALSE으로 분류되도록 구성하였다. 데이터 학습을 통하여, 높은 성능을 보인 세가지 모델을 선별하였다. 해당 모델은 Radom Forest, Gradient Boosting, Neural Network이고, 0.99 이상의 정확도를 달성하였다. 특히 구성된 학습데이터의 코드 커버리지가 높은 경우와 데이터 결과 값 구성비율이 40~60%인 경우 가장 높은 정확도를 얻을 수 있었다. 요컨대, 머신러닝 기반으로 테스트 오라클을 자동화하는 방식은 실험을 통하여 테스트 오라클의 정확성이 증명되었다. 또한 이를 테스트 자동화에 적용하여 기존에 인간의 판단영역인 테스트 오라클까지 자동화함으로써 테스트 전체과정을 자동화할 수 있는 기반이 마련되었다.
URI
http://hanyang.dcollection.net/common/orgView/200000626902https://repository.hanyang.ac.kr/handle/20.500.11754/174708
Appears in Collections:
GRADUATE SCHOOL OF ENGINEERING[S](공학대학원) > ELECTRICAL ENGINEERING AND COMPUTER SCIENCE(전기ㆍ전자ㆍ컴퓨터공학과) > Theses (Master)
Files in This Item:
There are no files associated with this item.
Export
RIS (EndNote)
XLS (Excel)
XML


qrcode

Items in DSpace are protected by copyright, with all rights reserved, unless otherwise indicated.

BROWSE