public class FreeSpec extends FreeSpecBase implements LambdaTest
Inherit from this class to create a new TestNG test suite and use the
test(java.lang.String, de.tobiasroeser.lambdatest.RunnableWithException) method to add test cases.
It provides the following methods:
test(String, RunnableWithException) to declare a new test
case
FreeSpecBase.intercept(Class, RunnableWithException) and
FreeSpecBase.intercept(Class, String, RunnableWithException) to intercept
and assert expected exceptions.
FreeSpecBase.pending() to mark a test case as pending. All code before
it’s usage including asserts will be executed, but code after it will be
skipped. Thus you can mark a test also as work-in-progress.
TODO: example
FreeSpecBase.F0WithException<R>| Constructor and Description |
|---|
FreeSpec() |
| Modifier and Type | Method and Description |
|---|---|
Iterator<Object[]> |
freeSpecParallelTestCases() |
Iterator<Object[]> |
freeSpecTestCases() |
void |
pending(String reason)
Marks the test as pending and uses the given
reason as
message. |
void |
runFreeSpecParallelTestCases(DefaultTestCase testCase) |
void |
runFreeSpecTestCases(DefaultTestCase testCase) |
void |
setExpectFailFast(boolean failFast)
If
true, the first failed assertion will also fail the test. |
void |
setRunInParallel(boolean runInParallel)
If
true tests in this suite can be run in parallel. |
void |
test(String name,
RunnableWithException testCase)
Adds a test to the test suite.
|
getCurrentSection, getDefaultReporter, getExpectFailFast, getReporter, getRunInParallel, getSuiteName, getTestCases, intercept, intercept, pending, section, setDefaultReporter, setReporter, withDefaultReporterclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetReporter, intercept, intercept, pending, setReporterpublic void setRunInParallel(boolean runInParallel)
LambdaTestIf true tests in this suite can be run in parallel.
setRunInParallel in interface LambdaTestsetRunInParallel in class FreeSpecBaserunInParallel - If true, tests may execute in parallel.public void setExpectFailFast(boolean failFast)
LambdaTestIf true, the first failed assertion will also fail the test. If
false, the test runs as long as possible, potentially collection
multipe failed assertions.
setExpectFailFast in interface LambdaTestsetExpectFailFast in class FreeSpecBasefailFast - If true, to fail fast.public void test(String name, RunnableWithException testCase)
Adds a test to the test suite.
test in class FreeSpecBasename - The name of the new test.testCase - The test case. It should return when it is successful, else it
should throw an exception. Exceptions of type
TestException which are typically thrown by
Assert.assertXXX methods (e.g.
Assert.assertEquals(String, String)) are specially
recognized by TestNG.public void pending(String reason)
Marks the test as pending and uses the given reason as
message. Instructions after pending() will not be executed
and TestNG marks the test as skipped.
pending in interface LambdaTestpublic void runFreeSpecTestCases(DefaultTestCase testCase) throws Throwable
Throwablepublic void runFreeSpecParallelTestCases(DefaultTestCase testCase) throws Throwable
ThrowableCopyright © 2019. All rights reserved.