I am using simple test class for testing my DAO. I am extending
AbstractJpaTests.
I am using spring 2.5 and testNG 5.7-jdk 1.5
[testng] FAILED CONFIGURATION: @BeforeTest launchSetup
[testng] junit.framework.AssertionFailedError: TestCase.getName()
cannot be null
[testng] at junit.framework.Assert.fail(Assert.java:47)
[testng] at junit.framework.Assert.assertTrue(Assert.java:20)
[testng] at junit.framework.Assert.assertNotNull(Assert.java:214)
[testng] at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.getTestMethod(AbstractAnnotationAwareTransactionalTests.java:
226)
[testng] at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.isRollback(AbstractAnnotationAwareTransactionalTests.java:
257)
[testng] at
org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(AbstractTransactionalSpringContextTests.java:
207)
[testng] at
org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:
103)
[testng] at
com.grey.npas.dao.survey.SurveyDAOTest.launchSetup(SurveyDAOTest.java:
73)
[testng] ... Removed 19 stack frames
[testng] SKIPPED CONFIGURATION: @AfterTest launchTearDown
here is my code,
// $Id$
//
public class SurveyDAOTest extends AbstractJpaTests{
private SurveyDAO surveyDAO;
@Test( testName="TestName")
public void getSurvey() throws Exception{
System.out.println("**************** Is Entity Manager SET ???
***********");
System.out.println(surveyDAO);
String call = surveyDAO.doNothing();
System.out.println("************ call *********"+call);
}
public void setSurveyDAO(SurveyDAO surveyDAO){
this.surveyDAO = surveyDAO;
}
@BeforeTest
public void launchSetup() throws Exception {
setUp();
}
@AfterTest
public void launchTearDown() throws Exception {
tearDown();
}
protected String[] getConfigLocations() {
return new String[]{"classpath:config\\applicationContext-
test.xml"};
}
}
ApplicationContext
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="
http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"
default-autowire="byName">
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="generateDdl" value="true" />
<property name="databasePlatform"
value="org.hibernate.dialect.MySQL5Dialect" />
</bean>
</property>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
destroy-method="close">
<property name="driverClassName"
value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/npas" />
<property name="username" value="root" />
<property name="password" value="liferay" />
</bean>
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager" />
<tx:annotation-driven />
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /
>
<bean id="surveyDAO" class="com.grey.npas.dao.survey.SurveyDAOImpl" >
</bean>
</beans>
I read somewhere online that in newer version of spring-test.jar it is
not allowing testNG to set method name.
IS it BUG ??????
Thank You in advance for you time to reading this thread. Solutions
will be appreciated.