Questions tagged [springjunit4classrunner]

55 questions
0
votes
1 answer

Cannot get some unit tests to run for a spring application

Spring newbie here. Trying to meld various online spring tutorials into a single working project. Started off with the spring mvc tutorial described in this link. Now I'm trying to meld this online tutorial on Spring data jpa into the above…
apil.tamang
  • 2,545
  • 7
  • 29
  • 40
0
votes
1 answer

get all Beans of type in SpringJUnit4ClassRunner

I have problems to find a suitable answer for my following test class: @ContextConfiguration("classpath:services.xml") @RunWith(SpringJUnit4ClassRunner.class) public class RunnableServiceTest { @Test public void testConfiguration(){ …
nano_nano
  • 12,351
  • 8
  • 55
  • 83
0
votes
1 answer

Spring data repository not injecting with @Mock in test case class returns null?

Repository object not injecting in testcase class. Here is my below test class …
0
votes
0 answers

Automated JUnit test errors in db code, does not when run manually

I have a suite of JUnit tests that works when run out of STS/Eclipse, but does not work when run from Bamboo using Jacoco. It used to work when we were running the tests out of Jenkins using Cobertura. When I say work, I mean the tests are…
0
votes
1 answer

spring boot tempory h2 database table empty in junit4 test

I am using Spring Boot 1.2.5 and want to do some JUnit4 testing. I have an Eclipse project that contains the test. During initializiation a temporay H2 database is created. I have a schema.xml and data.xml. The initialization is fine, but later…
0
votes
1 answer

Using multiple runner annotation in test class for spring-boot and testrail

I have to link my tests with testrail and for that I have to use the testrailrunner. But if I exclude the springjunit runner then my tests fail on starting the service and its not possible to use both the runners What's a workaround for this so that…
worrynerd
  • 705
  • 1
  • 12
  • 31
0
votes
1 answer

Junit test; Is it possible to configure a Bean's default property, before application context starts up?

I have a Bean with a property "DBServer"; It has a default of "location1"; During application startup, Depending on the value of "DBServer", different classes are instantiated. I have 200 tests where this default setting is fine. However, As of…
0
votes
0 answers

How do I use @RunWith with both JUnit4ClassRunner and JUnitParams?

I am writing an integration test that is a parameterized test, and I need to include @RunWith(SpringJUnit4ClassRunner.class) and @RunWith(JUnitParamsRunner.class). The problem is that I can only specify one @RunWith. Is there a workaround to this…
0
votes
1 answer

Logs are not printing

I am currently working on a project which has spring used in it. For Junit, i am using @RunWith(SpringJUnit4ClassRunner.class) annotation. Everything is working fine except I do not see any logs for spring processing of applicationContext. In the…
Shailesh Pratapwar
  • 4,054
  • 3
  • 35
  • 46
0
votes
1 answer

SpringJUnit4ClassRunner - Reloads Context for every test even though same context used

This is the base class of our unit tests: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/spring/test-context.xml") public abstract class BaseUnitTest {} All unit tests extend this class. When I run the tests locally in eclipse…
1 2 3
4