Sorry for the mess. I m posting again:
I have wrote one test case in my new work place. now i have seen in other
codes they have POM.xml.
ques # 1==Could anybody tell me what exactly I have to put there to run my
test. I am adding a pom.xml which i tried but did not work. let me know what
i have to add. We are using Spring jdbc template. I am adding the test code
and the pom.xml.
first the test code is :
import java.util.List;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import com.tracfone.core.bean.User;
import com.tracfone.core.component.ApplicationContextLoader;
import com.tracfone.domain.api.user.UserDAO;
public class UserDaoTestCase extends TestCase {
private static final String CONFIG_FILE =
"C:/projects//Sadd/src/test/java/userTestCase.xml";
private JdbcTemplate jdbcTemplate = null;
private UserDAO userDAO = null;
public UserDaoTestCase() {
super();
}
protected void setUp() throws Exception {
ApplicationContext applicationContext =
ApplicationContextLoader.load(CONFIG_FILE);
jdbcTemplate = (JdbcTemplate)
applicationContext.getBean("jdbcTemplate");
userDAO = (UserDAO)
applicationContext.getBean("userDAO");
jdbcTemplate.execute("delete from table_user where
objid=323");
System.out.println("Junit Test case for user setUp3");
jdbcTemplate.execute("INSERT INTO TABLE_USER ( " +
"OBJID, LOGIN_NAME , PASSWORD )
VALUES (323,'testtracfone','test')");
super.setUp();
}
protected void tearDown() throws Exception {
jdbcTemplate.execute("delete from table_user where
objid=323");
super.tearDown();
}
public void testFindUser(){
User user = userDAO.findUser("testtracfone");
String password="";
if(user.getPassword()!=null){
password=user.getPassword();
}
String id="";
if(user.getId()!=null){
id=user.getId();
}
assertEquals("323",id);
assertEquals("test",password);
}
public void testFindUsersByGroup(){
List userList =
userDAO.findUsersByGroup("ADMINCONSOLE");
//String password="";
assertNotNull(userList);
assertEquals(userList.size(),4);
}
}
the rough pom i have wrote is
http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>
4.0.0
Sadd
//Ques#2:what should be groupID?? if my folder name is Sadd
simple
// Ques#3what should I put here in artifactId, what does it mean
jar
1.0-SNAPSHOT
simple
http://maven.apache.org
junit
junit
3.8.1
test
org.springframework
spring
2.0
Sadd
// Ques#4 Again if my folder name is Sadd, am i doing right?
com.core
// Ques#5my Sadd folder is dependant on com.core, am i doing right??
1.0
test
org.apache.maven.plugins
maven-compiler-plugin
1.4
1.4
true
org.apache.maven.plugins
maven-surefire-plugin