Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom 3rd party mutators #563

Open
rnveach opened this issue Feb 11, 2019 · 2 comments
Open

Custom 3rd party mutators #563

rnveach opened this issue Feb 11, 2019 · 2 comments

Comments

@rnveach
Copy link
Contributor

rnveach commented Feb 11, 2019

I am interested in knowing what it takes to create a mutator, what are the limitations, and knowing if it is possible for pitest to allow users to add their own 3rd party custom mutators without being added to pitest repo.

I haven't seen any documentation on this on the website so I don't think it was a consideration. Looking at Mutator.java, it seems the method to add mutators is hidden behind a private method and pitest doesn't have any options that I saw to allow users to specify a custom mutator by classpath. I know mutations work on the byte code, but I don't know how complex the search algorithm can be.

Looking at https://github.com/LaurentTho3/ExtendedPitest , it seems the extended mutators could only be used by replacing the original pitest jar before it was integrated into pitest directly.

For our project checkstyle, we have an integer array that says what tokens checks are allowed to stop on for static processing in the check. Example: https://github.com/checkstyle/checkstyle/blob/63afcb8a76cb73ae198afe87bcf01765e84fc713/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java#L147-L154
It would be interesting to try and write a mutator that modified these integer arrays under these methods and replace each token with a dummy token to see if the specific token is actually needed.

@szpak
Copy link
Contributor

szpak commented Nov 24, 2022

@rnveach I've accidentally bumped into this question and I wonder in the pluggable mutators mechanism, introduced in PIT 1.7.0 (on 2021-09-01, so some time after your initial question) wouldn't be useful for you?

I don't know if the procedure is described anywhere, but looking at the mechanism's own tests, it should be possible to provide mutator(s) in the external JAR and they should be discovered by the Gregor engine.

@szpak
Copy link
Contributor

szpak commented Nov 25, 2022

Btw, accidentally again, I have crashed into https://github.com/pitest/pitest-rv-plugin which clearly show an external plugin with extra mutators :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants