'No JUnit tests found' in Eclipse

后端 未结 22 2744
闹比i
闹比i 2020-12-13 08:35

So I\'m new to JUnit, and we have to use it for a homework assignment. Our professor gave us a project that has one test class, BallTest.java. When I right clic

相关标签:
22条回答
  • 2020-12-13 09:19

    The best way to resolve this issue is to put public Access modifier for your Junit Test Case class name and then run the scenario by right click on your Junit test case class and run as Junit Test.

    0 讨论(0)
  • 2020-12-13 09:22
    1. Right click your project ->Properties->Java Build Path and go to Source Tab then add your test src folder.
    2. Select Project menu and unselect 'Build Automatically' option if selected
    3. Select Clean and then select 'Build Automatically' option
    4. Restart Eclipse and run your junit.
    0 讨论(0)
  • 2020-12-13 09:22

    The solution was, after making a backup of the src/test folder, removing it from the filesystem, then creating it again.

    That's after I did the "Remove from build path" hint and it screwed the folders when opening the project in STS 4.

    0 讨论(0)
  • I had this problem too with JUnit 5.4.2. I use Eclipse 2019-09 with gradle 5.3.1.

    So I had to add this two dependencies to build.gradle file with right configuration for it (testImplementation and testRuntimeOnly):

    apply plugin: "java"
    
    //enabled the Gradle’s native JUnit 5 support  
    test {  
      useJUnitPlatform()  
    }  
    testImplementation  group: "org.junit.jupiter", name: "junit-jupiter-api", version: "${junitVer}"
    testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: "${junitVer}"
    
    0 讨论(0)
提交回复
热议问题