Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 474562

Summary: No tests found with test runner 'JUnit 4'.
Product: [Eclipse Project] JDT Reporter: NoDataFound - <baldurien>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: kane.mx
Version: 4.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Eclipse plugins none

Description NoDataFound - CLA 2015-08-09 12:04:33 EDT
Whenever I try to run the whole "src/test/java" under test, Eclipse fails to do so with this message "No tests found with test runner 'JUnit 4'.".

I can run some package below the src/test/java source folder:

- In one package containing two jUnit 4 test case, I had to rename a method "test_that_..." to "testxx_that_..." so that it recognize the test inside the package. When renaming it back to its original value ... it worked.

- ... but still could not run the whole src/test/java

I don't have use case for that, since I can't reproduce the problem on a smaller subset. 


- mvn test find all my tests.
- I remember it to fail on Eclipse Luna too.
- I tried to rerun them after cleaning my workspace (eclipse.exe -clean)
- This is annoying when you work with EclEmma to look up for coverage.


Is there any way to trace what is Eclipse doing in that case ?






Here is a sample of my test:

public class BytesTest {

  @Test
  public void test_that_0_and_1_bytes_are_cached() {
    assertThat(Bytes.valueOf(1)).isSameAs(Bytes.valueOf(1));

    assertThat(Bytes.valueOf(0)).isSameAs(Bytes.valueOf(0));
    assertThat(Bytes.fromKiloBytes(0)).isSameAs(Bytes.valueOf(0));
    assertThat(Bytes.fromMegaBytes(0)).isSameAs(Bytes.valueOf(0));
    assertThat(Bytes.valueOf(0, GIGA_BYTES)).isSameAs(Bytes.valueOf(0));
    assertThat(Bytes.valueOf(0, TERA_BYTES)).isSameAs(Bytes.valueOf(0));
  }
}
Comment 1 NoDataFound - CLA 2015-08-09 12:16:23 EDT
Created attachment 255734 [details]
Eclipse plugins

Here are my Eclipse plugins, since I also suspected it was one particular plugin that made thing not working: 

- with the list in attached file, it fails
- without Scala IDE plugins below, it works.

      JDT Weaving for Scala     4.1.1.v-2_11-201507261049-bc34267       org.scala-ide.sdt.weaving.feature.feature.group scala-ide.org
      Scala IDE for Eclipse     4.1.1.v-2_11-201507261049-bc34267       org.scala-ide.sdt.feature.feature.group scala-ide.org
      Scala Worksheet   0.3.0.v-2_11-201507271104-4fe32b5       org.scalaide.worksheet.feature.feature.group    Scala IDE

I don't understand why it makes Eclipse fails to find the test, and while it works in other projects.
Comment 2 Noopur Gupta CLA 2015-08-10 06:50:45 EDT
*** Bug 473371 has been marked as a duplicate of this bug. ***
Comment 3 Meng Xin Zhu CLA 2015-08-10 09:24:16 EDT
In my env, I also installed Scala IDE for Eclipse(4.1.0.v-2_11-201507042104-ea6a75d).
Comment 4 NoDataFound - CLA 2015-08-10 16:57:26 EDT
It appear to be a Scala IDE bug: 

https://scala-ide-portfolio.assembla.com/spaces/scala-ide/support/tickets/1002529-no-tests-found-with-test-runner---39-junit-4--39-#/activity/ticket:
duplicate of https://scala-ide-portfolio.assembla.com/spaces/scala-ide/tickets/1002524

I don't know what they've done bad, but seems good with Scala IDE 4.2.0 nightly:

http://scala-ide.org/download/nightly.html

Could we have some insight on how Eclipse find tests ? 

And why it would fail even with a buggy plugin ?
Comment 5 NoDataFound - CLA 2015-08-26 19:18:17 EDT
Now that I don't use anymore the Scala IDE plugin, it work again like a charm.