Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » JUnit only runs properly in debug mode
- JUnit only runs properly in debug mode [message #516449] Tue, 23 February 2010 19:18 Go to next message
Eclipse UserFriend
I have a strange problem with JUnit. Basically, when I run a test class
in 'run' mode, only one test method runs and the JUnit view doesn't get
populated. If I run it in 'debug' mode, all the test methods are run and
the JUnit view gets populated correctly.

Eclipse 3.5.1 build 20090920-1017
JUnit4
The test classes extend AbstractTransactionalJUnit4SpringContextTests

I have rebuilt the workspace, tried Junit3 as well as 4 and wrote a
plain Junit4 test that loads the spring config manually, but nothing
makes any difference.

If the run configuration is of type JUnit, one would expect the test to
run as a JUnit test, but it almost seems to run as a plain old java
application instead.

Regards
Chris
- Re: JUnit only runs properly in debug mode [message #516560 is a reply to message #516449] Wed, 24 February 2010 06:46 Go to previous messageGo to next message
Eclipse UserFriend
Chris,

Have you looked closely at the corresponding run configurations? I.e.,
you're using the same run configuration in each case?


Chris wrote:
>
> I have a strange problem with JUnit. Basically, when I run a test
> class in 'run' mode, only one test method runs and the JUnit view
> doesn't get populated. If I run it in 'debug' mode, all the test
> methods are run and the JUnit view gets populated correctly.
>
> Eclipse 3.5.1 build 20090920-1017
> JUnit4
> The test classes extend AbstractTransactionalJUnit4SpringContextTests
>
> I have rebuilt the workspace, tried Junit3 as well as 4 and wrote a
> plain Junit4 test that loads the spring config manually, but nothing
> makes any difference.
>
> If the run configuration is of type JUnit, one would expect the test
> to run as a JUnit test, but it almost seems to run as a plain old java
> application instead.
>
> Regards
> Chris
>
>
>
>
>
- Re: JUnit only runs properly in debug mode [message #516889 is a reply to message #516560] Thu, 25 February 2010 08:17 Go to previous messageGo to next message
Eclipse UserFriend
I double checked and the only run configuration is a JUnit one.

I have run the test multiple times and each time, only one test method
runs, followed by the following exception...

13:07:21.062 [main] INFO o.s.t.c.t.TransactionalTestExecutionListener -
Rolled back transaction after test execution for test context
[[TestContext@19ec4ed testClass = AccountDaoTest, locations =
array<String>['classpath:/applicationContext.xml'], testInstance =
dao.AccountDaoTest@92dcdb, testMethod = fetchOneAccount@AccountDaoTest,
testException = [null]]]
org.junit.runner.notification.StoppedByUserException
at
org.junit.runner.notification.RunNotifier.fireTestStarted(Ru nNotifier.java:79)
at
org.junit.internal.runners.model.EachTestNotifier.fireTestSt arted(EachTestNotifier.java:41)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.runChild(SpringJUnit4ClassRunner.java:238)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java: 173)
at
org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
at
org.springframework.test.context.junit4.statements.RunBefore TestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java :61)
at
org.junit.internal.runners.statements.RunAfters.evaluate(Run Afters.java:31)
at
org.springframework.test.context.junit4.statements.RunAfterT estClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:7 0)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.run(SpringJUnit4ClassRunner.java:180)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:197)


Everytime I run it using: Debug As -> JUnit Test, it runs absolutely fine.
Interestingly, running it using: Run As -> JUnit Test, still creates an
entry in the JUnit view run history, even though there is no output
displayed in the JUnit view itself.

Cheers
Chris






On 24/02/2010 11:46, Ed Merks wrote:
> Chris,
>
> Have you looked closely at the corresponding run configurations? I.e.,
> you're using the same run configuration in each case?
>
>
> Chris wrote:
>>
>> I have a strange problem with JUnit. Basically, when I run a test
>> class in 'run' mode, only one test method runs and the JUnit view
>> doesn't get populated. If I run it in 'debug' mode, all the test
>> methods are run and the JUnit view gets populated correctly.
>>
>> Eclipse 3.5.1 build 20090920-1017
>> JUnit4
>> The test classes extend AbstractTransactionalJUnit4SpringContextTests
>>
>> I have rebuilt the workspace, tried Junit3 as well as 4 and wrote a
>> plain Junit4 test that loads the spring config manually, but nothing
>> makes any difference.
>>
>> If the run configuration is of type JUnit, one would expect the test
>> to run as a JUnit test, but it almost seems to run as a plain old java
>> application instead.
>>
>> Regards
>> Chris
>>
>>
>>
>>
>>
- Re: JUnit only runs properly in debug mode [message #517038 is a reply to message #516889] Thu, 25 February 2010 15:19 Go to previous message
Eclipse UserFriend
When I looked at RunNotifier.fireTestStarted method it appears that someone
has called the RunNotifier.pleaseStop method during execution of the first
test.

It seems very strange that it only happens in normal run mode; makes it very
hard to debug :(

Namaste, Bruce

"Chris" <chrisjames64@hotmail.co.uk> wrote in message
news:hm5t9h$qgs$1@build.eclipse.org...
>
> I double checked and the only run configuration is a JUnit one.
>
> I have run the test multiple times and each time, only one test method
> runs, followed by the following exception...
>
> 13:07:21.062 [main] INFO o.s.t.c.t.TransactionalTestExecutionListener -
> Rolled back transaction after test execution for test context
> [[TestContext@19ec4ed testClass = AccountDaoTest, locations =
> array<String>['classpath:/applicationContext.xml'], testInstance =
> dao.AccountDaoTest@92dcdb, testMethod = fetchOneAccount@AccountDaoTest,
> testException = [null]]]
> org.junit.runner.notification.StoppedByUserException
> at
> org.junit.runner.notification.RunNotifier.fireTestStarted(Ru nNotifier.java:79)
> at
> org.junit.internal.runners.model.EachTestNotifier.fireTestSt arted(EachTestNotifier.java:41)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.runChild(SpringJUnit4ClassRunner.java:238)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:46)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :180)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 41)
> at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java: 173)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
> at
> org.springframework.test.context.junit4.statements.RunBefore TestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java :61)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(Run Afters.java:31)
> at
> org.springframework.test.context.junit4.statements.RunAfterT estClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:7 0)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRun ner.run(SpringJUnit4ClassRunner.java:180)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:46)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:467)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:683)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:390)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:197)
>
>
> Everytime I run it using: Debug As -> JUnit Test, it runs absolutely fine.
> Interestingly, running it using: Run As -> JUnit Test, still creates an
> entry in the JUnit view run history, even though there is no output
> displayed in the JUnit view itself.
>
> Cheers
> Chris
>
>
>
>
>
>
> On 24/02/2010 11:46, Ed Merks wrote:
>> Chris,
>>
>> Have you looked closely at the corresponding run configurations? I.e.,
>> you're using the same run configuration in each case?
>>
>>
>> Chris wrote:
>>>
>>> I have a strange problem with JUnit. Basically, when I run a test
>>> class in 'run' mode, only one test method runs and the JUnit view
>>> doesn't get populated. If I run it in 'debug' mode, all the test
>>> methods are run and the JUnit view gets populated correctly.
>>>
>>> Eclipse 3.5.1 build 20090920-1017
>>> JUnit4
>>> The test classes extend AbstractTransactionalJUnit4SpringContextTests
>>>
>>> I have rebuilt the workspace, tried Junit3 as well as 4 and wrote a
>>> plain Junit4 test that loads the spring config manually, but nothing
>>> makes any difference.
>>>
>>> If the run configuration is of type JUnit, one would expect the test
>>> to run as a JUnit test, but it almost seems to run as a plain old java
>>> application instead.
>>>
>>> Regards
>>> Chris
>>>
>>>
>>>
>>>
>>>
>
Previous Topic:Common Navigator Framework: avoid showing file
Next Topic:Retrieve cookies from introPart
Goto Forum:
  


Current Time: Fri Mar 14 10:27:43 EDT 2025

Powered by FUDForum. Page generated in 0.03455 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top