In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
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
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.