TestNG/Spring integration (Hani?)
This is not really an IDEA-related question.
I'm wondering if TestNG supports something similar to AbstractDependencyInjectionSpringContextTests.
Quite nice for integration tests that use beans from a spring context.
-tt
Please sign in to leave a comment.
Taras Tielkes wrote:
I believe there is something for that, I remember seeing something
mentioned (i use my own home grown spring based tests thou).
Just about to run out for the afternoon but I'll dig something up when I
get back (unless Hani or someone else replies sooner).
Mark
Hello Mark,
>> I'm wondering if TestNG supports something similar to
>> AbstractDependencyInjectionSpringContextTests.
>> Quite nice for integration tests that use beans from a spring
>> context.
Thanks in advance.
By the way, is there any special reason why you're using a custom approach?
-tt
Taras Tielkes wrote:
At the time testng-spring sub project didn't exist.
I can see the project at:
http://www.mvnrepository.com/artifact/org.testng/testng-spring
And the code is at:
http://www.google.com/codesearch?hl=en&q=package:testng.googlecode.comspring+show:9laUwZ570Bs:q0NY7bpPp9I:NxW6P2BO4jw&sa=N&cd=1&ct=rc&cs_p=http://testng.googlecode.com/svn/trunk&cs_f=spring/src/jdk14/org/testng/spring/test/AbstractSingleSpringContextTests.java#a0
from the testng repository.
Yeah, the reason for the custom code approach instead of reusing the spring classes is because...well...they're very stupidly written, and are impossible to reuse. They're very hardcoded to JUnit's test hierarchy (extent TestCase, with all logic embedded in the subclasses, as well as doing stuff like overriding runBare), and do not make use of any abstractions for commonly needed functionality. Thus, the only way to 'testng'fy them was to copy them over without the silly hardcoded JUnit assumptions.
Kinda surprising to see code this bad from the Spring people, but I guess nobody's perfect!
Please take a look at http://www.unitils.org/. This framework is powful, and it can integrate TestNG, JUnit 4.x and 3.x, EasyMock and so on. I use it for daily unit test.
Does the TestNG-J Plugin work for Selena?
Thanks
-Pete
Its shipped with it now, so yes!
The reason I ask is because I am getting an error with Selena 7041. I
created a simple test class...
package com.idiots.startup;
import org.testng.annotations.Test;
public class CommandlineOptionsTest
{
@Test(groups = {"fast"})
public void aFastTest()
{
System.out.println("Fast test");
}
@Test(groups = {"slow"})
public void aSlowTest()
{
System.out.println("Slow test");
}
} // - End CommandlineOptionsTest Class Definition.
And when I tried to execute the test I get the following exception
Error during dispatching of
java.awt.event.MouseEvent[MOUSE_RELEASED,(536,60),absolute(546,90),button=1,modifiers=Button1,clickCount=1]
on frame0:
com.theoryinpractice.testng.TestNGConsoleView.createUpDownStacktraceActions()[Lcom/intellij/openapi/actionSystem/AnAction;
java.lang.AbstractMethodError:
com.theoryinpractice.testng.TestNGConsoleView.createUpDownStacktraceActions()[Lcom/intellij/openapi/actionSystem/AnAction;
at
com.intellij.execution.runners.RunContentBuilder.a(RunContentBuilder.java:66)
at
com.intellij.execution.runners.RunContentBuilder.a(RunContentBuilder.java:44)
at
com.intellij.execution.runners.RunContentBuilder.showRunContent(RunContentBuilder.java:100)
at
com.intellij.execution.runners.RunStrategyImpl.a(RunStrategyImpl.java:86)
at
com.intellij.execution.runners.RunStrategyImpl.access$100(RunStrategyImpl.java:26)
at
com.intellij.execution.runners.RunStrategyImpl$3.run(RunStrategyImpl.java:5)
at
com.intellij.execution.impl.ExecutionManagerImpl$1.run(ExecutionManagerImpl.java:2)
at
com.intellij.execution.impl.ExecutionManagerImpl.compileAndRun(ExecutionManagerImpl.java:33)
at
com.intellij.execution.runners.RunStrategyImpl.execute(RunStrategyImpl.java:43)
at
com.intellij.execution.runners.RunStrategyImpl.execute(RunStrategyImpl.java:65)
at com.intellij.execution.actions.RunnerAction.a(RunnerAction.java:29)
at
com.intellij.execution.actions.RunnerAction.actionPerformed(RunnerAction.java:23)
at
com.intellij.openapi.actionSystem.impl.ActionButton.a(ActionButton.java:70)
at
com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:58)
at
com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:29)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at com.intellij.ide.IdeEventQueue.c(IdeEventQueue.java:173)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:42)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:27)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
This works with version 6.04
Any ideas?
Thanks
-Pete
On Mon, 09 Jul 2007 22:29:55 -0700, Hani Suleiman <hani@formicary.net>
wrote:
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
I do believe that exception was fixed, possibly in a build later than 7041.
Have you tried the latest 7051 EAP build?
Pete Haidinyak wrote:
I just tried the new 7051 build with the same problem. BTW the build is
pretty unstable.
-Pete
On Wed, 11 Jul 2007 04:39:59 -0700, Mark Derricutt <mark@talios.com> wrote:
>
>
>
>> on frame0:
>> com.theoryinpractice.testng.TestNGConsoleView.createUpDownStacktraceActions()[Lcom/intellij/openapi/actionSystem/AnAction;
Hello Pete,
TestNG plugin is now bundled with IDEA. Could you please check that you do
not have another instance of plugin and use only bundled version. Exception
is caused by inconsistency between plugin and IDEA versions.
Thank you
-
Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
>> Its shipped with it now, so yes!
>>
Hello Hani,
It seems that spring 2.1 will (try to) improve the situation:
http://opensource.atlassian.com/projects/spring/browse/SPR-1555
The nightly builds contain documentation for the JUnit4 support (I assume
the TestNG side will look similar).
Did you take a look at it already? If so, any comments?
-tt
Taras Tielkes wrote:
Taras - I see this is also being discussed on the TestNG mailing list
itself, last I saw Hani had mentioned that the Spring team had gathered
feedback from the TestNG team for changes, but that Hani as yet hasn't
had a look at what they've finally come up with.