Maven TestNG事务测试,maven运行测试但结果是测试运行:0

时间:2016-11-30 07:29:35

标签: java spring hibernate testng maven-3

我正在用Spring使用TestNG和mvn为简单的hibernate应用程序编写一些测试。我的问题:跑步时

mvn clean install

Maven回归:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.me.service.test.BorowerTest
Configuring TestNG with:
org.apache.maven.surefire.testng.conf.TestNG652Configurator@77556fd
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.375 sec

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

我的测试班:

import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.testng.Assert;

import com.me.daoImpl.Borrower.BorrowerDAOImpl;
import com.altkom.model.Borrower.Borrower;

@Transactional
public class BorowerTest {

@Autowired
private BorrowerDAOImpl borrowerDAOImpl;
private Borrower borrowerOne;
private Borrower borrowerTwo;

@Before
public void setUpData() {
    borrowerOne = new Borrower.BorrowerBuilder().firstName("Dave").lastName("Lombardo").adress("New York")
            .phoneNumber("666666666").build();
    borrowerTwo = new Borrower.BorrowerBuilder().firstName("Tom").lastName("Araya").adress("Los Angeles")
            .phoneNumber("445533123").build();
}

@Test
@Rollback(false)
public void persistBorrowerTest() {
    boolean test = borrowerDAOImpl.persist(borrowerOne) && borrowerDAOImpl.persist(borrowerTwo);
    Assert.assertTrue(test);
}

}

我无法找到合适的解决方案。在pom中,我只为java 1.8配置了编译器插件。

0 个答案:

没有答案