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

Add support for testing specific mutants #10

Open
Aimless321 opened this issue Nov 19, 2024 · 2 comments
Open

Add support for testing specific mutants #10

Aimless321 opened this issue Nov 19, 2024 · 2 comments

Comments

@Aimless321
Copy link

Currently, it is possible to specify which blocks of code need to be tested using mutation ranges, but there's no way to specify which individual mutants within those blocks should be tested.

Use case

In the Stryker Cloud Orchestrator, a mutation test run is split into tasks, where each task contains a set of mutants to be tested. These tasks are optimized based on test coverage to allow multiple mutants to be tested in the same task as long as there is no overlap in their test coverage.

To support this use case, it would be helpful to have a mechanism to specify exactly which mutants should be tested, rather than testing all mutants within a given code block.

Would it be possible to do this based on the mutatorName in combination with the current ranges?

@rouke-broersma
Copy link
Member

rouke-broersma commented Nov 19, 2024

In our use case mutant IDs are stable - for this specific use case, so we could also simply optionally allow mutant ID in MSP.

We could optionally allow mutant ID, to be used if the specific MSP server supports guaranteed stable mutant IDs when there are not changed to source code.

@Aimless321
Copy link
Author

To add another example where the current implementation could cause issues.

These mutants are returned by a discover:

{
  "id": "1",
  "location": {
    "start": {
      "line": 7,
      "column": 41
    },
    "end": {
      "line": 9,
      "column": 4
    }
  },
  "description": null,
  "mutatorName": "BlockStatement",
  "replacement": "{}"
},
{
  "id": "2",
  "location": {
    "start": {
      "line": 8,
      "column": 32
    },
    "end": {
      "line": 8,
      "column": 64
    }
  },
  "description": null,
  "mutatorName": "ObjectLiteral",
  "replacement": "{}"
}

Passing only the file and location of the BlockStatement mutant, would also cause the 2nd mutant to be tested.

Perhaps it would make more sense to treat the locations passed to the mutationTest method as exact locations, instead of an area to search for mutants. Combined with the mutatorName i think that would be a consistent way of specifying a single mutant?

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