pitest / pitclipse

Mutation testing for Java in Eclipse IDE. Based on PIT (Pitest).
https://pitest.org
Apache License 2.0
59 stars 17 forks source link

Provide project-specific preferences #77

Open echebbi opened 5 years ago

echebbi commented 5 years ago

Motivation

Currently Pitclipse only allows for workspace-scope preferences. However, it would be great to allow users to set their preferences per project.

Implementation

In term of UI, this requires creating a project property page. This is not really complicated but sadly we cannot reuse the code written for the Preferences page (actually there is a way but I don't know whether it is worth the effort).

In term of core, this requires an abstraction layer between the core and the preferences so that we can uniformely use either workspace-specific or project-specific preferences. At the moment preferences are retrieved through PitCoreActivator.getConfiguration().

To this end, creating a Pitest project nature might be useful.

LorenzoBettini commented 4 years ago

It's already possible to store a Pitclipe launch configuration in a project, but one cannot specify in the launch configuration the set of mutators to enable (by the way, it would be great to have a finer grain control on mutators to enable, e.g., for excluding/including single mutators, but probaly that's a separate issue?). I think having the set mutators (default, stronger, all) in the launch configuration would already be useful by itself

echebbi commented 4 years ago

It's already possible to store a Pitclipe launch configuration in a project

True, but I would consider the following points:

IMO, storing a launch configuration file is more like a workaround and providing a dedicated UI would be more convenient.

it would be great to have a finer grain control on mutators to enable

Sure, but that would be a separate issue. Pitclipse currently relies on Pitest's CLI so we should be able to easily support every option available from the CLI. Regarding the mutators themselves, it seems to be only a question of UI (everything else seems to be already implemented); maybe a table with the name of the mutator, a short description and a checkable box would do? I invite you to create a dedicated issue if you want to see it implemented.

LorenzoBettini commented 4 years ago

First of all, I agree this feature would be really nice

It's already possible to store a Pitclipe launch configuration in a project

True, but I would consider the following points:

  • leaving RCP developers aside, I'm not sure that most Eclipse IDE users use or are even aware of launch configurations (disclaimer: I don't have any study or experience to support this point, it's just a personal feeling),

well, launch configurations are a crucial part in the Eclipse workbench, thus the users should be aware of that (including the fact they can store such configurations in the projects) ;)

  • dedicated UI forms are easier to edit than XML (AFAIK there's no editor for launch configurations),

launch configurations are meant to be edited through the Eclipse dialog, not directly

  • Pitclipse allows to analyze all workspace projects at once and does not take launch configurations into account,

mh... I didn't know that... or maybe I don't understand what you say

  • in a big project one may want to run Pitest on specific packages; each one would require a distinct launch configuration,

Again, that's pretty standard, even with plain JUnit launch configurations: you can have many of them, possibly stored in the projects

IMO, storing a launch configuration file is more like a workaround and providing a dedicated UI would be more convenient.

As I said, I didn't mean to decrease the importance of this feature; I was only saying that you can already store launch configurations. It's not a workaround: it's a different use case

it would be great to have a finer grain control on mutators to enable

Sure, but that would be a separate issue. Pitclipse currently relies on Pitest's CLI so we should be able to easily support every option available from the CLI. Regarding the mutators themselves, it seems to be only a question of UI (everything else seems to be already implemented); maybe a table with the name of the mutator, a short description and a checkable box would do? I invite you to create a dedicated issue if you want to see it implemented.

Yes, I will ASAP

echebbi commented 4 years ago

As I said, I didn't mean to decrease the importance of this feature; I was only saying that you can already store launch configurations. It's not a workaround: it's a different use case

Excuse me, I misunderstood you.

  • Pitclipse allows to analyze all workspace projects at once and does not take launch configurations into account

mh... I didn't know that... or maybe I don't understand what you say

I took a deeper look and in fact it's not all projects in the workspace but rather "selected project and the projects in its classpath". To activate this "mode":

  1. Window > Preferences > Pitest > Check All projects in workspace under Pit execution scope
  2. Create two Java projects with some tests and add the second to the classpath of the first
  3. Run Pitest on the first project
  4. Pitclipse will also run Pitest on the second project

I discovered the feature while looking at the tests and have been confused by the wording.