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

Pitclipse is not detecting testng test cases #187

Closed khushwinder closed 2 years ago

khushwinder commented 2 years ago

Bug description

I am trying to use piteclipse in a springboot+ testng project. But it is not detecting testng test cases. Following is the logs:

have installed pitclipse latest version and using macbook. While running "PIT Mutation Test" command from eclipse is not finding any test case in my code. I am using TestNG framework for writing test cases. Please suggest what I am doing wrongly. I have beed trying from a few days but so far no luck . These are the logs from my eclipse console when I am trying to run mutation test for a single class:

3:29:32 PM PIT >> INFO : ---------------------------------------------------------------------------

3:29:32 PM PIT >> INFO : Enabled (+) and disabled (-) features.

3:29:32 PM PIT >> INFO : -----------------------------------------

3:29:32 PM PIT >> INFO : +FANN Filters mutations in classes and methods with matching annotations of class or runtime retention

3:29:32 PM PIT >> INFO : [annotation] Annotation to avoid (full package name not required)

3:29:32 PM PIT >> INFO : +FFBLOCK Filters mutations in code duplicated by finally block inlining

3:29:32 PM PIT >> INFO : +FFEACH Filters mutations in compiler generated code that implements for each loops

3:29:32 PM PIT >> INFO : +FFLOOP Filters any mutations to increments in for loops as they may cause timeouts

3:29:32 PM PIT >> INFO : +FINFINC Filters mutations to increments that may cause infinite loops

3:29:32 PM PIT >> INFO : +FINFIT Filters mutations that may cause infinite loops by removing calls to iterator.next

3:29:32 PM PIT >> INFO : +FINULL Filters mutations in compiler generated code that checks for null by calling getClass

3:29:32 PM PIT >> INFO : +FKOTLIN Filters out junk mutations in bytecode created by compiler for kotlin language features

3:29:32 PM PIT >> INFO : +FLOGCALL Filters mutations in code that makes calls to logging frameworks

3:29:32 PM PIT >> INFO : +FMRNULL Filters mutations in compiler generated code that inserts Objects.requireNonNull for method references

3:29:32 PM PIT >> INFO : +FRETEQUIV Filters return vals mutants with bytecode equivalent to the unmutated class

3:29:32 PM PIT >> INFO : +FSEQUIVEQUALS Filters equivalent mutations that affect only performance in short cutting equals methods

3:29:32 PM PIT >> INFO : +FSTATI Filters mutations in static initializers and code called only from them

3:29:32 PM PIT >> INFO : +FSTATINIT Filters mutations in static initializers and code called only from them

3:29:32 PM PIT >> INFO : +FTRYWR Filters mutations in code generated for try with resources statements

3:29:32 PM PIT >> INFO : -CLASSLIMIT Limits the maximum number of mutations per class

3:29:32 PM PIT >> INFO : [limit] Integer value for maximum mutations to create per class

3:29:32 PM PIT >> INFO : -EXPORT Exports mutants bytecode and other details to disk

3:29:32 PM PIT >> INFO : ---------------------------------------------------------------------------

3:29:32 PM PIT >> FINE : Running report with ReportOptions [targetClasses=[........I have purposely removed classes from logs.....]

3:29:32 PM PIT >> FINE : System class path is...

3:29:32 PM PIT >> FINE : Maximum available memory is 4096 mb

3:29:33 PM PIT >> FINE : MINION : Installing PIT agent 3:29:33 PM PIT >> INFO : Sending 1 test classes to minion

3:29:33 PM PIT >> INFO : Sent tests to minion

3:29:33 PM PIT >> INFO : MINION : 3:29:33 PM PIT >> FINE : Expecting 1 tests classes from parent

3:29:33 PM PIT >> FINE : Tests classes received 3:29:33 PM PIT >> INFO : MINION : 3:29:33 PM PIT >> INFO : Checking environment

3:29:33 PM PIT >> INFO : MINION : 3:29:33 PM PIT >> INFO : Found 0 tests 3:29:33 PM PIT >> INFO : MINION : 3:29:33 PM PIT >> INFO : Dependency analysis reduced number of potential tests by 0 3:29:33 PM PIT >> INFO : 0 tests received 3:29:33 PM PIT >> INFO : MINION : 3:29:33 PM PIT >> FINE : Running 0 units 3:29:33 PM PIT >> FINE : Coverage generator Minion exited ok

3:29:33 PM PIT >> INFO : Calculated coverage in 0 seconds.

3:29:33 PM PIT >> FINE : Used memory after coverage calculation 7 mb

3:29:33 PM PIT >> FINE : Free Memory after coverage calculation 2 mb

3:29:34 PM PIT >> FINE : According to coverage no tests hit the mutation............

How to reproduce

Steps to reproduce the behavior:

  1. Go to 'eclipse'
  2. Right Click on 'project'
  3. Choose option of run as PIT Mutation
  4. See error as given in the logs

Additional context

LorenzoBettini commented 2 years ago

As stated in the main features

"JUnit support: works with both JUnit 4 and JUnit 5 tests"

That is, pitclipse does not support testng

khushwinder commented 2 years ago

Thanks, is there any work in progress for testng?

LorenzoBettini commented 2 years ago

I don't think so, @echebbi ? I've never used testng myself and as far as I know there's no official support from Eclipse itself (but of course, there's an external plugin)