stackoverflowmailer / guiceberry

Automatically exported from code.google.com/p/guiceberry
Apache License 2.0
0 stars 0 forks source link

Bind TearDownAccepter #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Guiceberry should include a binding for TearDownAccepter, so tests can 
dynamically add teardowns 
during execution.

TestScopeListener doesn't really work for us, since we only want to do a 
teardown for the tests that 
explicitly set something up.

http://code.google.com/p/test-libraries-for-
java/source/browse/trunk/src/com/google/common/testing/TearDownAccepter.java

Original issue reported on code.google.com by limpbizkit on 3 Feb 2009 at 6:42

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 3 Feb 2009 at 6:42

GoogleCodeExporter commented 9 years ago
Let me see if I understand what you want to do. Is this it?

class MyTest extends TearDownTestCase {
  @Inject
  SomeTestingInfra infra;

  public void testSomething() {
    infra.someMethod();
  }
}

class SomeTestingInfra {
  @Inject
  TearDownAccepter accepter; 
  (or TearDownTestCase testCase)

  public someMethod() {
    accepter.addTearDown(...);
  }
}

Original comment by zorze...@gmail.com on 3 Feb 2009 at 7:05

GoogleCodeExporter commented 9 years ago
Jesse, if this is what you want, I can check if "TestCase instanceof 
TearDownAccepter" 
and add a binding if so. This will, of course, blow if the test case being run 
is not a 
TearDownAccepter. Is this what you are looking for?

Original comment by zorze...@gmail.com on 10 Jun 2009 at 6:04

GoogleCodeExporter commented 9 years ago
Actually I was thinking you'd always bind a TearDownAcceptor. You'd run all of 
the supplied tear downs when 
the test scope exited. This is handy for building frameworks on top of 
Guiceberry.

Original comment by limpbizkit on 10 Jun 2009 at 7:48

GoogleCodeExporter commented 9 years ago
Very interesting idea! Do you think we should always bind a GuiceBerry-generated
TearDownAccepter, or bind the test case if it implements TearDownAccepter?

Original comment by zorze...@gmail.com on 10 Jun 2009 at 3:16

GoogleCodeExporter commented 9 years ago
Jesse, will you review:

http://code.google.com/p/guiceberry/source/detail?r=134

I'm loving this change...

Original comment by zorze...@gmail.com on 16 Jun 2009 at 8:28