All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scalatest.TestSuiteMixin.scala Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2001-2013 Artima, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.scalatest

/**
 * Trait defining abstract "lifecycle" methods that are implemented in TestSuite
 * and can be overridden in stackable modification traits.
 *
 * 

* The main use case for this trait is to override withFixture in a mixin trait. * Here's an example: *

* *
 * trait Builder extends TestSuiteMixin { this: TestSuite =>
 *
 *   val builder = new StringBuilder
 *
 *   abstract override def withFixture(test: NoArgTest) = {
 *     builder.append("ScalaTest is ")
 *     try super.withFixture(test) // To be stackable, must call super.withFixture
 *     finally builder.clear()
 *   }
 * }
 * 
*/ trait TestSuiteMixin extends SuiteMixin { this: TestSuite => /** * Runs the passed test function with a fixture established by this method. * *

* This method should set up the fixture needed by the tests of the * current suite, invoke the test function, and if needed, perform any clean * up needed after the test completes. Because the NoArgTest function * passed to this method takes no parameters, preparing the fixture will require * side effects, such as initializing an external database. *

* * @param test the no-arg test function to run with a fixture */ protected def withFixture(test: NoArgTest): Outcome }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy