Returns the number of tests expected to be run by JUnit when run
is invoked
on this Suite
.
Returns the number of tests expected to be run by JUnit when run
is invoked
on this Suite
.
If tagsToInclude
in the passed Filter
is defined, this class's
implementation of this method returns 0. Else this class's implementation of this method
returns the size of the set returned by testNames
on the current instance.
Overrides to use JUnit 3 to run the test(s).
Overrides to use JUnit 3 to run the test(s).
an optional name of one test to run. If None
, all relevant tests should be run.
I.e., None
acts like a wildcard that means run all relevant tests in this Suite
.
the Args
for this run
a Status
object that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred.
Throws UnsupportedOperationException
, because this method is unused by this
class, given this class's run
method delegates to JUnit to run
its tests.
Throws UnsupportedOperationException
, because this method is unused by this
class, given this class's run
method delegates to JUnit to run
its tests.
The main purpose of this method implementation is to render a compiler error an attempt
to mix in a trait that overrides runNestedSuites
. Because this
trait does not actually use runNestedSuites
, the attempt to mix
in behavior would very likely not work.
the Args
for this run
always.
Throws UnsupportedOperationException
, because this method is unused by this
class, given this class's run
method delegates to JUnit to run
its tests.
Throws UnsupportedOperationException
, because this method is unused by this
class, given this class's run
method delegates to JUnit to run
its tests.
The main purpose of this method implementation is to render a compiler error an attempt
to mix in a trait that overrides runTest
. Because this
trait does not actually use runTest
, the attempt to mix
in behavior would very likely not work.
the name of one test to run.
the Args
for this run
always.
Throws UnsupportedOperationException
, because this method is unused by this
class, given this class's run
method delegates to JUnit to run
its tests.
Throws UnsupportedOperationException
, because this method is unused by this
class, given this class's run
method delegates to JUnit to run
its tests.
The main purpose of this method implementation is to render a compiler error an attempt
to mix in a trait that overrides runTests
. Because this
trait does not actually use runTests
, the attempt to mix
in behavior would very likely not work.
an optional name of one test to run. If None
, all relevant tests should be run.
I.e., None
acts like a wildcard that means run all relevant tests in this Suite
.
the Args
for this run
always.
Suite style name.
Returns an empty Map
, because tags are not supported by JUnit 3.
Returns an empty Map
, because tags are not supported by JUnit 3.
Returns the set of test names that will be executed by JUnit when run
is invoked
on an instance of this class, or the instance is passed directly to JUnit for running.
Returns the set of test names that will be executed by JUnit when run
is invoked
on an instance of this class, or the instance is passed directly to JUnit for running.
The iterator obtained by invoking elements
on this
returned Set
will produce the test names in their natural order, as determined by String
's
compareTo
method. Nevertheless, this method is not consulted by JUnit when it
runs the tests, and JUnit may run the tests in any order.
If message or message contents are null, throw a null exception, otherwise create a function that returns the option.
If message or message contents are null, throw a null exception, otherwise create a function that returns the option.
(Since version 3.1.0) The conversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The convertEquivalenceToAToBConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The convertEquivalenceToBToAConversionConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
(Since version 3.1.0) The lowPriorityConversionCheckedConstraint method has been deprecated and will be removed in a future version of ScalaTest. It is no longer needed now that the deprecation period of ConversionCheckedTripleEquals has expired. It will not be replaced.
A
Suite
that is also ajunit.framework.TestCase
.A
JUnit3Suite
may be run by either JUnit 3 (such as JUnit 3.8) or ScalaTest's runner. You write it the way you write a JUnit 3TestCase
. Tests are methods that start withtest
, take no parameters, and have aUnit
return type. You manage fixtures with methodssetUp
andtearDown
. Here's an example:You can use either JUnit's assertions, inherited from
TestCase
, or ScalaTest's, inherited fromAssertionsForJUnit
.When writing JUnit 3 tests in Scala, you should keep in mind that JUnit 3 will not run tests that have a return type other than
Unit
. Thus it is best to explicitly state theUnit
result type, like this:Instead of this:
If the
testBadIdea
method ends in an expression that has a result type other thanUnit
, the Scala compiler will infer a result type to thetestBadIdea
method to be the same non-Unit
type. As a "result," JUnit 3 will not discover or run thetestBadIdea
method at all.