Author | Message |
---|---|
jonathankroening
Posts: 39
|
Posted 14:46 Jan 24, 2015 |
Hey all, I've followed the directions up to the end of Testing (http://csns.calstatela.edu/wiki/content/cysun/course_materials/cs520/sham/testing). But when I try and run the UserDaoTest class as TestNG Test, I get a TestNGException: cannot instantiate class springmvc.model.dao.UserDaoTest I've made all the appropriate java files provided for us. And I've double-checked through postgresql that the tables were created by the sql script under database cs520stuXX by owner cs520stuXX (and no, I didn't also run the drop script.) Anyone have thoughts on why the UserDaoTest class won't instantiate? I've tried everything I can think of. |
cysun
Posts: 2935
|
Posted 15:15 Jan 24, 2015 |
Did you copy applicationContext.xml to src/test/resources? |
krunalsolanki
Posts: 3
|
Posted 16:12 Jan 24, 2015 |
I am attempting to test my UserDaoTests.java file with TestNG and receive a "FAILED CONFIGURATION: @BeforeClass
error : [TestNG] Running: FAILED CONFIGURATION: @BeforeClass springTestContextPrepareTestInstance SKIPPED CONFIGURATION: @BeforeMethod springTestContextBeforeTestMethod ===============================================
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@2db0f6b2: 27 ms |
jonathankroening
Posts: 39
|
Posted 16:29 Jan 24, 2015 |
yes, I did. |
plakhan
Posts: 37
|
Posted 17:32 Jan 24, 2015 |
I get the below error, when running the testng
org.testng.TestNGException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 5; Content is not allowed in prolog.
|
fgomz
Posts: 6
|
Posted 18:41 Jan 24, 2015 |
Remember to use the same version of spring-test as spring-mvc, which is 3.2.8.RELEASE. |
jonathankroening
Posts: 39
|
Posted 19:50 Jan 24, 2015 |
Thank you. That was the trick. I had it on the 4.1.4.RELEASE. |
lishenyu
Posts: 103
|
Posted 18:58 Jan 25, 2015 |
when I was doing the testNG test , I have put all the java files and sql scripts in its folders , then I run the testNG , it gave me an error of "org.postgresql.util.PSQLException: FATAL: password authentication failed for user "cysun" , could you tell me how to create database with name/username/password with gefp/gefp/abcd ? I am not clear with their relationships between them ,thanks ! |
lishenyu
Posts: 103
|
Posted 19:01 Jan 25, 2015 |
and do I need to make some change to springmvc-create.sql ? |
cysun
Posts: 2935
|
Posted 08:20 Jan 26, 2015 |
Read PostgreSQL documentation on CREATE USER and CREATE DATABASE, or use the GUI client pgAdmin III. |
sxiao11
Posts: 13
|
Posted 21:19 Jan 28, 2015 |
i had the same error "Cannot instantiate class gefp.model.dao.UserDaoTest" and it seem that i also used 4.1.4.RELEASE for spring-test dependency. However, when i tried to build the pom.xml file after i changed spring-test dependency to 3.2.8.RELEASE, it always show error on pom.xml file, Can you please help me with it? Thank you. |
cysun
Posts: 2935
|
Posted 21:43 Jan 28, 2015 |
Do a Maven -> Update Project ... If it doesn't fix the problem, try the fix for corrupted dependency. |
sxiao11
Posts: 13
|
Posted 22:41 Jan 28, 2015 |
After i updated the project, there was no more error in the pom.xml but show new errors in the UserDaoTest file as follows: Can you please help me figure it out? thank you |
cysun
Posts: 2935
|
Posted 08:32 Jan 29, 2015 |
The spring-test dependency probably was corrupted during download. Follow the instructions in the link in my previous post to re-download it. |