Package jetbrains.buildServer
Class AfterTestHook
- java.lang.Object
-
- junit.framework.Assert
-
- jetbrains.buildServer.MockSupport
-
- jetbrains.buildServer.AfterTestHook
-
- All Implemented Interfaces:
org.testng.IHookable
,org.testng.ITestNGListener
- Direct Known Subclasses:
BaseTestCase
public class AfterTestHook extends MockSupport implements org.testng.IHookable
TestNG hook allowing to perform custom verification after each test (for example, ensure that there were no errors inTestLogger
). We shouldn't do it usingAfterMethod
method because it results in that TestNG skips all the following tests.- Author:
- Dmitry Treskunov
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.MockSupport
ANYTHING, NOT_NULL, NULL
-
-
Constructor Summary
Constructors Constructor Description AfterTestHook()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finishAfterTestHook()
In the current TestNG version (6.8)is NOT invoked if the test has a specified timeout. So we have to perform the same logic in the
protected void
initializeAfterTestHook()
protected void
performAfterTestVerification()
You should implement this method if you want to perform any checks after test was run.void
run(org.testng.IHookCallBack callBack, org.testng.ITestResult testResult)
-
Methods inherited from class jetbrains.buildServer.MockSupport
and, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, atLeastOnce, collectionContaining, collectionContaining, compatibleType, contains, containsInAnyOrder, containsInAnyOrder, containsInOrder, containsInOrder, defaultMockNameForType, doAll, doAll, doAll, doAll, endsWith, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, exactly, hasProperty, hasProperty, isA, isGreaterThan, isIn, isIn, isLessThan, mapContaining, mapContaining, mapWithKey, mapWithKey, mapWithValue, mapWithValue, mock, mock, never, never, newDummy, newDummy, newDummy, not, not, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, or, returnIterator, returnIterator, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, same, setUpMocks, startsWith, stringContains, tearDownMocks, throwException, toString, verify
-
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
-
-
-
-
Method Detail
-
initializeAfterTestHook
@BeforeMethod(alwaysRun=true) protected void initializeAfterTestHook() throws Exception
- Throws:
Exception
-
finishAfterTestHook
@AfterMethod(alwaysRun=true) protected void finishAfterTestHook() throws Exception
In the current TestNG version (6.8)is NOT invoked if the test has a specified timeout. So we have to perform the same logic in the
- Throws:
Exception
-
run
public void run(org.testng.IHookCallBack callBack, org.testng.ITestResult testResult)
- Specified by:
run
in interfaceorg.testng.IHookable
-
performAfterTestVerification
protected void performAfterTestVerification()
You should implement this method if you want to perform any checks after test was run. You shouldn't do it in theAfterMethod
because any exception there will result in that TestNG skip all following tests.
-
-