Author | Message |
---|---|
hgadhia
Posts: 52
|
Posted 15:15 Jan 27, 2015 |
Hi, I have created a function to test if a user with username jdoe1 exists. After running the UserDaoTest for Test NG, I am getting the following error in console. FAILED CONFIGURATION: @BeforeClass springTestContextPrepareTestInstance
Here's the code snippets that I am using for test purpose.
UserDaoImpl.java @Override
UserDaoTest.java @Test
Can someone please help?
|
sikandarahmad
Posts: 19
|
Posted 15:20 Jan 27, 2015 |
Did you define the bean in Test class and annotate it wit autowire. for example: @Autowired |
akshays
Posts: 5
|
Posted 15:22 Jan 27, 2015 |
Your UserDaoTest needs to extend "AbstractTransactionalTestNGSpringContextTests", can you make sure you have done that? |
hgadhia
Posts: 52
|
Posted 15:22 Jan 27, 2015 |
Yes I have done that. Basically I just added a new function to get the User with a user name jdoe1. And all the required functions in respective interfaces and classes. Rest everything is same as the the example code. |
cysun
Posts: 2935
|
Posted 15:36 Jan 27, 2015 |
You probably missed the @repository annotation in UserDaoImpl. |
hgadhia
Posts: 52
|
Posted 15:41 Jan 27, 2015 |
I have checked, its there. I didn't modify anything in the sample code from springmvc, else except for creating the functions as mentioned above. And I also added this function to the UserDao interface. |
hgadhia
Posts: 52
|
Posted 15:44 Jan 27, 2015 |
I also replaced springmvc with gefp in the package name. I also updated the base package in applicationContext.xml <context:component-scan base-package="gefp.model" /> I am not sure what am I missing. |
cysun
Posts: 2935
|
Posted 15:45 Jan 27, 2015 |
The error says : No qualifying bean of type [gefp.web.model.dao.UserDao] found for dependency, which means it couldn't find a bean that implements the UserDao interface. There are really just a few possibilities:
|
cysun
Posts: 2935
|
Posted 15:47 Jan 27, 2015 |
Reading the error message, it seems like your model classes are under gefp.web.model, i.e. you don't have a gefp.model package. |
hgadhia
Posts: 52
|
Posted 15:57 Jan 27, 2015 |
All my model classes in the are under gefp.web.model package under src/main/java folder. Its same as explained in the example code. I am attaching the screenshots of the classes if that helps to find the issue.
|