Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Mutation testing tool configuration-muclipse

Shulou Source: shulou.com Published: 2022-06-03 03:22:17 10月03日 Update

Mutation testing is to judge the quality of unit test cases by changing the source code of the tested object and comparing the results of unit test cases. The understanding is not very deep, can only be rough introduction, welcome to add.

The data of mutation test found on the Internet are very few, mostly academic papers.

The public of mutation testing is that mujava and muclipse,muclipse are plug-ins based on mujava and integrated on eclipse, according to the official website

Mujava http://cs.gmu.edu/~offutt/mujava/

Muclipse http://muclipse.sourceforge.net/index.php

According to the official website step by step, unexpectedly did not succeed, change the parameters one by one to explore, and finally get the results, so write down the article here, hoping to reduce everyone's research time

1. Install muclipse

As the download url provided by the official website can not be opened, we have to find an edu.ncsu.muclipse_1.3.0.jar to download online, put it in the eclipse plugins directory, and restart eclipse. Even if it is installed, this installation method of eclipse is really simple.

two。 Prepared test case

Package demo1

Public class Example {

Public int multiply (int a, int b) {

Return a * b

}

}

Package demo1

Public class ExampleTest {

Public void setUp () throws Exception {

}

Public void tearDown () throws Exception {

}

Public int testMultiply ()

{

Example ex = new Example ()

Return ex.multiply (1,1)

}

}

3. Configure the environment

1. Create or import a project, download the extendedOJ.jar package, and import it to Libraries

Right click project name-> properties-> java build path-> Libraries-> Add External JARs, select it and click ok

In source tab, you can modify output folder, which is the address of the compiled .class file. The default is bin.

two。 When you compile the project, you can see the compiled .class file in bin.

Right-click the project name, build project

3. Generate the mutated source file

1. Right-click the project name-> run as-> run configuration...

Configure Deriectories

Configure Operator

Click run generates mutation code. For more information, please see result directory.

Mutation results are displayed in 4.eclipse

Windows-> show view

Note that there are only examples of mutations in method-level.

5. Execute test

Configure muclipse test: right-click the project name-> run as-> run configuration

Configure testing operation: since only method level is the mutation instance in production, do not check class-level, or there will be errors, click run button

6. Look at the results.

Click the Refresh button

Tags: Variation test configuration project result compilation unit only instance file directory build success code princess parameter address academic academic paper object Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB OPPO Reno Docker NVidia MySQL