I have a small requirement here. The application I need to test has been developed using the hibernate, struts framework. I need to write few unit test scripts for them. The application has Data Access Objects.
I started writing the unit-tests from the DAO. I could successfully build the war file using the build.xml for the application. The war file gets generated successfully. Now to deploy it in the tomcat server, what i am doing is running a small script that stops the tomcat server , copies the war file to webapps and then starts the server.
After this is over. I am trying to run the junit targets for testing the DAO. But i am not able to get the ant script read the hibernate.cfg.xml file. As a result my tests are not able to get the database connection.
- whether above architecture is correct ? Or is there ant other simple and easy step to get it done ?
- Is there a way to over come this error ?
-------below is the snipped of the code----------------------
<target name="tests" depends="prepare" description="run your test suite" >
[junit] net.sf.hibernate.HibernateException: net.sf.hibernate.HibernateException: /hibernate.cfg.xml not found [junit] at com.x1.x2.common.util.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:58)
We're pleased to have you here with us in the Testing forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.