Skip to content

valantic/mutation-tester

Repository files navigation

Mutation Tester

This Plugin enables mutation testing in your IDE based on pitest.org.

build workflow Software License MutationReport MutationReport Coverage Lines of Code Bugs Code Smells Duplicated Lines (%) Vulnerabilities Reliability Rating Maintainability Rating Security Rating

This package is developed by valantic CEC Schweiz.

About

Mutation Testing is also called Fault-based testing strategy as it involves creating a fault in the program and it is a type of White Box Testing which is mainly used for Unit Testing. When the application code changes, it should produce different results and cause the unit tests to fail. If a unit test does not fail in this situation, it may indicate an issue with the test suite.

This kind of testing helps you to produce better testing results, not only based on line coverage but also on mutation coverage. If less of your code can mutate, you can be sure to have a higher code quality.

This Plugin will help you as developer to run mutation tests easy and fast in your IDE without wasting time in configurations.

For example is a full Pit Mutation Testing report of this plugin here

Versions

Tool Supported / Used Version
PIT 1.13.0
IntelliJ Idea 2021.2 - now

Installation

You can download the plugin from our github. Next open your IntelliJ and install the plugin from disk, as seen below. It is recommended to restart your IDE.

IntelliJ Marketplace

The Plugin will be published to the Intellij Marketplace. This should be available in the store after our beta testing. Publishing should be within end of 07.2022.

Update: Plugin is in IntelliJ Marketplace. You can download it here

Run the plugin

You can simply create a new RunConfigurations with Mutation Tester

This Plugin will save you a lot of time. You don't need to create everytime new configurations by hand to test your new unit test. With this tool you can automatically create configuration for your given test, as seen below by just executing the test in the run context of the unit test.

You can also select packages in your test directory and test all classes in this package with all the tests in same named package.

If you still need to adjust the configuration you can do this easily. Each run will create a RunConfiguration you can simply modify.

Configuration

If you need to adjust the defualt configuration, you can just go into your RunConfiguration and adjust the default settings.

In the tab settings the values of targetTests, targetClasses, reportDir, sourceDirs and mutators can not be empty. Otherwise the tests will not run. in the advanced tab you can easily modify default behaviour.

You can get more informations about the configuration fields here.

Limitations

This Plugin has a few limitation, we might (if needed) will fix in the near future.

automaticly determine name of to be testet Class

When executing the plugin from the context-menu oder inside a class, the targetTest and targetClass
will be set automaticly. This is handled by default naming conventions. For example, you test the
Class "SampleService" with the test "SampleServiceTest", there will no problem setting these values
automaticly. The plugin will you the targetTest "SampleServiceTest" and remove the suffix "Test",
and will check if the rest of the string "SampleService" is a valid class.
If it doesn't, the targetTestClass will be set by the package the test class "SampleServiceTest" is in.
You can always update the correct names by hand. If you might have different namingConventions relating
the application and testclass let us know, so we can add it to the automated process.

Copyright and Licensing Information

See LICENSE.md for the complete License.

Copyright [2022] [valantic CEC Schweiz AG]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contact Information

For any issue with plugin please use our issueboard on github.

For any information about our company go to valantic.com.

Credit and Acknowledgments

This Plugin is based on the commandline tools from pitest.org. So special credits go out to henry@pitest.org for developing such an amazing tool.

Also the Icon (mutation.png) is based on an icon from flaticon by Freepik. Gen Icons erstellt von Freepik - Flaticon

Change Notes

  • 1.4.1 - 2023-08: Added Junit5 Support. Updated Pitest to 1.14.2. Modified pitest-junit5 dependency to resolve compatibility issue with intellij marketplace. Fixed NullPointerException in ClassPathService.
  • 1.4.0 - 2023-06: Added Junit5 Support. Updated Pitest to 1.14.1. Updated min. supported IDE version to 2021.2. Updated Tests from Junit4 to Junit5.
  • 1.3.0 - 2023-05: Adjusted the command line tool to use a generated classpath file to support all OS. Fixed Issue with configuration template. Fixed issue with command line wrapper. Fixed issue with problems of multiple IDE windows. Updated pitest version to 1.13.0
  • 1.2.1 - 2023-05: Removed tabs icon in the Running configuration screen that prevent the edit configuration in recent versions of Intellij IDEA. Capitalize context menu entries.
  • 1.2.0 - 2022-12: Commandline fixed for windows. Updated pitest version to 1.10.0. Updated test reports. corrected classpath for missing jar.
  • 1.1.1 - 2022-08: Fixed issue #7
  • 1.1.0 - 2022-07: Enables untilBuild to the newest. Enabled Support for IntelliJ IDE since 2020.3.4
  • 1.0.0 - 2022-07: Updated Unittests. Enabled Upload to Marketplace. Fixed Bug with NoModuleDefinied Error.
  • end of beta
  • 0.1.3 - 2022-06: Enabled support for 2022.1. Include libs into jar for NoClassDefException. Updated Pitest to 1.9.0. Updated info.solidsoft.pitest to 1.7.4. Updated org.jetbrains.intellij to 1.6.0. Fixed Bug with JacocoTestReports
  • 0.1.2 - 2022-02: Setting up Sonarcube and refactoring classes
  • 0.1.1 - 2022-02: Raised Testcoverage. Fixed issue with missing module on run configuration
  • 0.1.0 - 2022-02: Published Beta Version with primary focused on SAP Commerce

Known Issues

  • No custom classpath entries / file
  • Custom pitest-junit5 dependency jar