Top "Spring-test" questions

`spring-test` is the testing module of the Spring Framework, providing support for unit and integration testing with JUnit and TestNG, including various mocks for unit testing and the Spring TestContext Framework & the Spring MVC Test Framework for integration testing Spring-based applications.

Spring Testing: How to enable auto-scan of beans

For example, now in each test class I have to do @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(loader=AnnotationConfigContextLoader.class) I …

spring unit-testing spring-test
Cannot JUnit test using Spring

My test is defined as follows: package com.mytest; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class SpringTestCase { @Test public void …

java spring junit4 spring-test
Maven: NoClassDefFoundError: org.springframework.test.context.junit4.SpringJUnit4ClassRunner

I have a classpath issue. Background: Building and running a Spring WebApp. Originally it was one big project including dao/…

maven spring-test
How to flush data into db inside active spring transaction?

I want to test hibernate session's save() method using spring testing framework. @Test method is : @Test @Transactional public void testSave() { …

java hibernate spring-transactions spring-test hibernate-session
Could not load TestContextBootstrapper - Spring Unit testing

I have to execute Unit test on one of my Dao classes using Spring. Here is my unit test: @RunWith(…

spring unit-testing spring-test
How to execute @Sql before a @Before method

I'm trying to combine the follow annotations: org.springframework.test.context.jdbc.Sql and org.junit.Before Like the follow …

spring spring-test
org.hibernate.service.UnknownServiceException: Unknown service requested

I am writing a unit test to for my AbstractHibernateRepository save method. I'm using spring test runner but I get …

java spring hibernate spring-test hibernate-session
How to run JUnit SpringJUnit4ClassRunner with Parametrized?

The following code is invalid due to duplicate @RunWith annotation: @RunWith(SpringJUnit4ClassRunner.class) @RunWith(Parameterized.class) @SpringApplicationConfiguration(classes = {ApplicationConfigTest.…

java spring junit spring-test
Spring integration tests with profile

In our Spring web applications, we use the Spring bean profiles to differentiate three scenarios: development, integration, and production. We …

java spring spring-mvc spring-test