Menu

#43 ComponentTestFixture setup/teardown for use elsewher

Next Release
closed
Framework (21)
1
2004-07-28
2004-02-10
Nick Bauman
No

I can't run more than one UI test per JUnit run because
it seems like I can't clear out the graphics context
between test runs.

I keeping getting this
MultipleComponentsFoundException, even though my
setup() and teardown() methods are nulling our
references to my components.

This is what I keep getting (note, the pretty-printing of
the components found I added to the Abbot source):

abbot.MultipleComponentsFoundException: Could not
distinguish between 2 components using <component
class="com.retek.platform.client.gui.editor.AbstractEditor"
name="exampleworkflow.field_label" />:
(0) com.retek.platform.client.gui.editor.AbstractEditor
[exampleworkflow.field_label,4,29,200x19,invalid,layout=c
om.retek.platform.client.gui.layout.TableLayout,alignment
X=null,alignmentY=null,border=,flags=1,maximumSize=,min
imumSize=,preferredSize=]
(1) com.retek.platform.client.gui.editor.AbstractEditor
[exampleworkflow.field_label,4,29,200x19,invalid,layout=c
om.retek.platform.client.gui.layout.TableLayout,alignment
X=null,alignmentY=null,border=,flags=1,maximumSize=,min
imumSize=,preferredSize=]
at abbot.script.ComponentReference.bestMatch
(ComponentReference.java:596)
at
abbot.script.ComponentReference.findInHierarchy
(ComponentReference.java:956)
at
abbot.script.ComponentReference.findInHierarchy
(ComponentReference.java:906)
at
com.retek.rpm.example.ExampleWorkflowTest2.testInit
(ExampleWorkflowTest2.java:46)
at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:41)
at java.lang.reflect.Method.invoke
(Method.java:386)
at junit.framework.TestCase.runTest
(TestCase.java:154)
at junit.framework.TestCase.runBare
(TestCase.java:127)
at junit.framework.TestResult.protect
(TestResult.java:106)
at junit.framework.TestResult.runProtected
(TestResult.java:124)
at junit.framework.TestResult.run
(TestResult.java:109)
at junit.framework.TestCase.run
(TestCase.java:118)
at junit.framework.TestSuite.runTest
(TestSuite.java:208)
at junit.framework.TestSuite.run
(TestSuite.java:203)
at junit.framework.TestSuite.runTest
(TestSuite.java:208)
at junit.framework.TestSuite.run
(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
Tests(RemoteTestRunner.java:392)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:276)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.mai
n(RemoteTestRunner.java:167)

Discussion

  • Timothy Wall

    Timothy Wall - 2004-02-10

    Logged In: YES
    user_id=54098

    Use junit.extensions.abbot.ComponentTestFixture instead of TestCase and
    the "context" will be cleaned up automatically so that it doesn't interfere
    with future runs.

     
  • Nick Bauman

    Nick Bauman - 2004-02-10

    Logged In: YES
    user_id=24639

    I can't do that because I must extend a BaseTestCase for our
    application. I work around this by holding an instance of
    the ComponentTestFixture in my BaseUITestCase, setting it up
    and tearing it down appropriately. This should be working,
    shouldn't it?

     
  • Nick Bauman

    Nick Bauman - 2004-02-13

    Logged In: YES
    user_id=24639

    It seems like it would be a good thing to be able to use
    ComponentTestFixture (or some subclass thereof) as a
    delegate or visit ComponentTestFixture via a subclass of
    TestCase instead of being forced into extending
    ComponentTestFixture.

     
  • Nick Bauman

    Nick Bauman - 2004-02-13
    • summary: MCFException when running more than one test in suite --> MCFException when not extending ComponentTestFixture
     
  • Timothy Wall

    Timothy Wall - 2004-02-21
    • summary: MCFException when not extending ComponentTestFixture --> ComponentTestFixture setup/teardown for use elsewher
     
  • Timothy Wall

    Timothy Wall - 2004-07-28
    • labels: --> Framework
    • priority: 5 --> 1
    • assigned_to: nobody --> twall
    • milestone: --> Next Release
    • status: open --> closed
     
  • Timothy Wall

    Timothy Wall - 2004-07-28

    Logged In: YES
    user_id=54098

    There are two primary elements that affect setup/teardown in this case.

    1) abbot.util.SystemState
    Saves/restores a number of system-related settings, including properties
    and locking key state

    2) abbot.finder.TestHierarchy
    Optionally ignores all extant components on creation, and provides for
    disposing all components it knows about.