没有使用Netbeans在JUnit中执行测试

时间:2015-09-02 14:43:59

标签: maven ubuntu java-ee netbeans junit

环境:

  • Ubuntu 14.04
  • Netbeans 8.0.2
  • JUnit 4.12

您好(测试课程)

import static org.junit.Assert.assertTrue;
import org.junit.Test;

public class Hi {
    @Test
        public void hola(){
            assertTrue(true);
        }
}

的pom.xml

...
<dependencies>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.17</version>            
    </dependency>
    <dependency>
        <groupId>org.glassfish</groupId>
        <artifactId>javax.json</artifactId>
        <version>1.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-processing</artifactId>
        <version>2.17</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
</dependencies>
...

1 个答案:

答案 0 :(得分:1)

对于Maven projekt,测试类必须在src / test / java中,而不是src / main / java。