|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.softevo.ample.AmpleTestRunListener
public class AmpleTestRunListener
JUnit test run listener.
The instance of this class maintains up-to-date lists of passing and failing tests.
The Ample plugin initializes and registers a single instance of this class. It can be accessed
by calling the method AmplePlugin.getSharedListener()
.
Field Summary | |
---|---|
private java.util.ArrayList |
failingTests
List of JUnit tests that have failed in assertions or due to exceptions. |
private java.util.ArrayList |
passingTests
List of JUnit tests that have passed. |
private boolean |
testsAreRunning
Flag indictating that tests are currently running. |
Fields inherited from interface org.eclipse.jdt.junit.ITestRunListener |
---|
STATUS_ERROR, STATUS_FAILURE, STATUS_OK |
Constructor Summary | |
---|---|
AmpleTestRunListener()
Initializes a new instance of AmpleTestRunListener . |
Method Summary | |
---|---|
private org.eclipse.jdt.internal.junit.ui.TestRunInfo |
addTestIfNeeded(java.util.ArrayList aTests,
java.lang.String aTestId,
java.lang.String aTestName)
Adds a test to a given list of tests if not already present. |
boolean |
areTestsRunning()
Checks if there are tests currently running. |
org.eclipse.jdt.internal.junit.ui.TestRunInfo |
findFailingTestRun(java.lang.String testId)
Utility method that searches a failing test with a given id. |
org.eclipse.jdt.internal.junit.ui.TestRunInfo |
findPassingTestRun(java.lang.String testId)
Utility method that searches a passing test with a given id. |
static org.eclipse.jdt.internal.junit.ui.TestRunInfo |
findTestRun(java.util.ArrayList runs,
java.lang.String testId)
Utility method that searches a list of runs for a run with a given id. |
org.eclipse.jdt.internal.junit.ui.TestRunInfo |
getFailingTest(int index)
Gets the TestRunInfo at the specified position in the list of failing tests. |
java.util.ArrayList |
getFailingTests()
Gets the list of failing tests. |
org.eclipse.jdt.internal.junit.ui.TestRunInfo |
getPassingTest(int index)
Gets the TestRunInfo at the specified position in the list of passing tests. |
java.util.ArrayList |
getPassingTests()
Gets the list of passing tests. |
org.eclipse.jdt.internal.junit.ui.TestRunInfo[] |
getPassingTests(int[] indices)
Gets an array of all the specified passing tests. |
int |
getPassingTestsCount()
Gets the number of passing tests. |
int |
indexOfFailing(org.eclipse.jdt.internal.junit.ui.TestRunInfo testInfo)
Gets the index of the specified failing test. |
private void |
removeTest(java.util.ArrayList aTests,
java.lang.String aTestId)
Removes a test, if present, from a speicified list of tests. |
void |
testEnded(java.lang.String testId,
java.lang.String testName)
|
void |
testFailed(int status,
java.lang.String testId,
java.lang.String testName,
java.lang.String trace)
|
void |
testFailed(int status,
java.lang.String testId,
java.lang.String testName,
java.lang.String trace,
java.lang.String expected,
java.lang.String actual)
|
private boolean |
testHasFailed(java.lang.String aTestId)
Checks if a specified test has failed. |
void |
testReran(java.lang.String testId,
java.lang.String testClass,
java.lang.String testName,
int status,
java.lang.String trace)
|
void |
testRunEnded(long elapsedTime)
|
void |
testRunStarted(int testCount)
|
void |
testRunStopped(long elapsedTime)
|
void |
testRunTerminated()
|
void |
testStarted(java.lang.String testId,
java.lang.String testName)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private volatile boolean testsAreRunning
private java.util.ArrayList passingTests
private java.util.ArrayList failingTests
Constructor Detail |
---|
public AmpleTestRunListener()
AmpleTestRunListener
.
Note: This class is not intended to be instatiated by clients.
Method Detail |
---|
public void testFailed(int status, java.lang.String testId, java.lang.String testName, java.lang.String trace, java.lang.String expected, java.lang.String actual)
public void testRunStarted(int testCount)
testRunStarted
in interface org.eclipse.jdt.junit.ITestRunListener
public void testRunEnded(long elapsedTime)
testRunEnded
in interface org.eclipse.jdt.junit.ITestRunListener
public void testRunStopped(long elapsedTime)
testRunStopped
in interface org.eclipse.jdt.junit.ITestRunListener
public void testRunTerminated()
testRunTerminated
in interface org.eclipse.jdt.junit.ITestRunListener
public void testStarted(java.lang.String testId, java.lang.String testName)
testStarted
in interface org.eclipse.jdt.junit.ITestRunListener
public void testEnded(java.lang.String testId, java.lang.String testName)
testEnded
in interface org.eclipse.jdt.junit.ITestRunListener
public void testFailed(int status, java.lang.String testId, java.lang.String testName, java.lang.String trace)
testFailed
in interface org.eclipse.jdt.junit.ITestRunListener
public void testReran(java.lang.String testId, java.lang.String testClass, java.lang.String testName, int status, java.lang.String trace)
testReran
in interface org.eclipse.jdt.junit.ITestRunListener
public boolean areTestsRunning()
true
if JUnit tests are currently running; false
otherwise.public int getPassingTestsCount()
public java.util.ArrayList getPassingTests()
ArrayList
of all the passing tests.public org.eclipse.jdt.internal.junit.ui.TestRunInfo[] getPassingTests(int[] indices)
indices
- Array of zero-based indices of passing tests in the list of passing tests.
TestRunInfo
instances corresponding to the given indices.
IndexOutOfBoundException
- When any of the specified indices is out of range.public org.eclipse.jdt.internal.junit.ui.TestRunInfo getPassingTest(int index)
TestRunInfo
at the specified position in the list of passing tests.
This method is used for simplifying the call:
(TestRunInfo) AmplePlugin.getSharedListener().getPassingTests().get(i)
to:
AmplePlugin.getSharedListener().getPassingTest(i)
index
- Zero-based index of the test to return.
IndexOutOfBoundException
- When specified index is out of range.public java.util.ArrayList getFailingTests()
ArrayList
of all the failing tests.public org.eclipse.jdt.internal.junit.ui.TestRunInfo getFailingTest(int index)
TestRunInfo
at the specified position in the list of failing tests.
This method is used for simplifying the call:
(TestRunInfo) AmplePlugin.getSharedListener().getFailingTests().get(i)
to:
AmplePlugin.getSharedListener().getFailingTest(i)
index
- Zero-based index of the test to return.
IndexOutOfBoundException
- When specified index is out of range.public int indexOfFailing(org.eclipse.jdt.internal.junit.ui.TestRunInfo testInfo)
testInfo
- Information of the failing test the get the index of.
-1
if the specified test
does not belong to the list of failing tests.getFailingTests()
public static org.eclipse.jdt.internal.junit.ui.TestRunInfo findTestRun(java.util.ArrayList runs, java.lang.String testId)
runs
- the list of runs to be searchedtestId
- the id of the sought teset
null
if nothing was foundpublic org.eclipse.jdt.internal.junit.ui.TestRunInfo findFailingTestRun(java.lang.String testId)
testId
- the id of the sought teset
null
if nothing was foundpublic org.eclipse.jdt.internal.junit.ui.TestRunInfo findPassingTestRun(java.lang.String testId)
testId
- the id of the sought teset
null
if nothing was foundprivate boolean testHasFailed(java.lang.String aTestId)
aTestId
- ID of test to verify.
true
if failingTests
contains a test with the specified ID;
false
otherwise.private void removeTest(java.util.ArrayList aTests, java.lang.String aTestId)
aTests
- List of tests to be updated.aTestId
- ID of test to be removed.private org.eclipse.jdt.internal.junit.ui.TestRunInfo addTestIfNeeded(java.util.ArrayList aTests, java.lang.String aTestId, java.lang.String aTestName)
aTests
- List of test to search in.aTestId
- ID of the test to be added.aTestName
- Name of the test to be added.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |