Extending Pitest to validate Project Reactor tests

Skip to first unread message


May 2, 2022, 8:25:18 AMMay 2
to PIT Users
Hello everyone,

For my graduation project at the university, I am evaluating the benefits of mutation testing to validate the effectiveness of tests for reactive programs. Existing mutators made for Java do not suffice here, because we also need to validate if the "streaming" nature of reactive programs is tested well enough.

For this reason I am trying to make an extension to Pitest with these mutators. A first mutator idea is to add a sleep call to every function, to check if the time constraint of reactive programs is tested.
Are there people who have experience creating such mutators, that can give me some guidance on where to start and what to think of while implementing this? I have looked at the source code of Pitest, but this doesn't give me real indications on how this can be done.

Thank you in advance,

Nick Moone

Henry Coles

May 3, 2022, 3:46:14 AMMay 3
to pitu...@googlegroups.com
Hi Nick,

I'm afraid your best bet for understanding how to implement a mutator is to look at the source of the existing ones

The pit rv plugin gives an example of how to add mutators via a plugin

Mutations are created via bytecode manipulation. If you're not already familiar with java bytecode, manipulating it is easier than it sounds. Pitest uses ASM

There are plugins for eclipse and (I think) intellij that will show you the bytecode and asm code that would create it if you feed it a java class. This is a good way to get started.

Adding a sleep should be relatively straightforward, although this sort of mutation is not a good fit with unit testing. What would a test that could detect that sleep look like? Would it have some expectation of how long the code took to execute? If so, would it give the same result run millions of times on different machines? Or would it sometimes fail because another process was running on the box which slowed things down?


You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pitusers+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pitusers/617f3c4e-3508-4893-a7a4-ab954d3ba5c2n%40googlegroups.com.
Reply all
Reply to author
0 new messages