com.github.scalaspring

scalatest

package scalatest

Visibility
  1. Public
  2. All

Type Members

  1. trait TestContextManagement extends BeforeAndAfterAll

    Manages Spring test contexts via a TestContextManager.

    Manages Spring test contexts via a TestContextManager.

    Implemented as a stackable trait that uses beforeAll() and afterAll() hooks to invoke initialization and destruction logic, respectively. Test contexts are marked dirty, and hence cleaned up, after all test methods have executed. There is currently no support for indicating that a test method dirties a context.

    Sample usage:

    @ContextConfiguration(classes = Array(classOf[SomeConfiguration]))
    class SomeTestSpec extends FlatSpec with TestContextManagement with Matchers {
    
      // Use standard Autowired Spring annotation to inject necessary dependencies
      // Note that Spring will inject val (read-only) fields
      @Autowired
      val someDependency: SomeClass = null
    
      "Some test" should "verify something" in {
        // Test implementation that uses injected dependency
        someDependency should not be null
      }
    
    }
    See also

    org.springframework.test.context.TestContextManager

Value Members

  1. object AlwaysDirtiesContextTestExecutionListener extends DirtiesContextTestExecutionListener

    Test execution listener that always dirties the context to ensure that contexts get cleaned after test execution.

    Test execution listener that always dirties the context to ensure that contexts get cleaned after test execution.

    Note that this class dirties the context after all test methods have run.

    Attributes
    protected

Ungrouped