The objectives of this assignment are three-fold. First, you will get familiar with search-based testing techniques through a state-of-the-art testing tool Evosuite. You are required to use Evosuite to improve the test suite that you constructed in assignment 1. The newly constructed test cases should help improve test coverage for effective fault detection. Second, you will implement a fault localization tool on top of Soot. Your tool should be able to locate our injected faults and eventually fix them. Third, you will select the test cases to improve the ranking of fault localization.
Program under Test (Subject Program)
Please download the Java program for this assignment here. It is the same as that used in assignment 1.
The program contains injected faults.
Please complete the following tasks using Evosuite and Soot.
Task 1: Test Case Enhancement with Evosuite (25%).
In this task, please use Evosuite (quick start) to construct a test suuite (in JUnit 4 style) that achieves higher test coverage than that in assignment 1. Your constructed test suite should achieve high code coverage (e.g., over 75% line coverage and 100% public method coverage).
You may try different Evosuite parameters to improve coverage. Your mark on this part is related to the coverage of your test suite.
Submissions: Five test suites generated by you, i.e., the
folder testUtils5, testUtils6, testUtils7, testUtils8, and testUtils9. For each suite, please submit a screenshot showing the line coverage and a screenshot for branch coverage. In total, you need to submit a folder
containing 10 screenshots. Each screenshot should be properly named so that it identifies the corresponding statement coverage or branch coverage. The submission should also include a readme file that records the commands (including the parameters) used by you to generate each test suit.
Test suits and readme files (5%): Each test suite accounts for 1% if it can be successfully
Statement coverage (10%): Score = (statement coverage of your test suite
/ highest statement coverage achieved by your classmates) * 10%
Branch coverage (10%): Score = (branch coverage of your test suite / highest branch coverage achieved by your classmates) * 10%
Task 2: Fault Localization based on Soot (50%).
In this task, you need to design and implement an effective fault localization algorithm by yourself. You can leverage the Soot instrumenter that you implemented in assignment 1 to instrument our subject program and collect the executed statements during each test run. Based on the execution information, you can implement the classic fault localization algorithm Ochiai to calculate the fault likelihood of each statement and generate a report for fault
localization. This research paper describes the Ochiai algorithm and can point you to the original papers of the algorithm.
Your program should output a spectrum report of potential faulty statements. Each spectrum report should in csv format and each line is in the format of “method signature,statement,suspicious score,ranking”. The report should be sorted according the descending order of suspicious scores. If multiple statements have the same scores, please sort them according to the alphabetical order of method signature and statement. The method signature could be obtained using Soot API getSignature(). The ranking of suspicious score should be computed as (N+M+1)/2 where N is the number of statements whose suspicious scores are higher than a and M is the number of statements whose suspicious scores are higher than or equal to a. For example, if a sequence of suspicious scores is (0.9, 0.8, 0.8, 0.7) their rankings are (1, 2, 2, 4), respectively.
Based on the report, you can check the source code and locate the faults. There are multiple bugs injected in the subject program and each of them is in single line. You need to locate and fix as many as bugs as you can.
To help you with this task, we provide you with three test suites (avaiable here), namely testUtils10, testUtils11, and testUtils12. The program will fail on some tests of these suites. Note that if it is impossible to locate faults with no failing tests. You need to use these test suites for fault localization.
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.
Get Free Quote!
265 Experts Online