Class TestResults
- java.lang.Object
-
- com.atlassian.bamboo.results.tests.TestResults
-
- All Implemented Interfaces:
Serializable,Comparable<TestResults>
public class TestResults extends Object implements Serializable, Comparable<TestResults>
This class is a POJO for representing unit test results.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TestResults(String className, String methodName, @Nullable Long durationMs)Create a new testTestResults(String className, String methodName, String duration)Deprecated.since 5.10 use $TestResults(String, String, Long)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddError(TestCaseResultError error)Add an error to the testintcompareTo(TestResults o)booleanequals(Object o)StringgetActualMethodName()Returns the actual method name without the pretty spaces@NotNull StringgetClassName()The name of the classlonggetDurationMs()How long did the test take to execute?List<TestCaseResultError>getErrors()How many errors does the test have.@Nullable StringgetMethodName()Returns a sentence describing the test, derived from the method name of the test.StringgetPrettyDuration()Deprecated.since 5.9 without replacement@NotNull StringgetShortClassName()The short name of the classTestStategetState()StringgetSystemOut()longgetTestCaseId()booleanhasErrors()inthashCode()static @Nullable StringmethodNameToDescription(String methodName)Attempts to convert a test method name to a sentence describing the test.voidsetState(TestState state)voidsetSystemOut(String systemOut)voidsetTestCaseId(long testCaseId)StringtoString()
-
-
-
Constructor Detail
-
TestResults
@Deprecated public TestResults(String className, String methodName, String duration)
Deprecated.since 5.10 use $TestResults(String, String, Long)Create a new test- Parameters:
className- The name of the class containing the testmethodName- The name of the testduration- The time the test took to execute in seconds
-
-
Method Detail
-
getActualMethodName
public String getActualMethodName()
Returns the actual method name without the pretty spaces- Returns:
- the raw method name
-
getMethodName
@Nullable public @Nullable String getMethodName()
Returns a sentence describing the test, derived from the method name of the test.
- Returns:
- The sentence
-
methodNameToDescription
@Nullable public static @Nullable String methodNameToDescription(String methodName)
Attempts to convert a test method name to a sentence describing the test. "testManualTriggering works" becomes "Manual triggering works"
-
getClassName
@NotNull public @NotNull String getClassName()
The name of the class- Returns:
- The class name
-
getShortClassName
@NotNull public @NotNull String getShortClassName()
The short name of the class- Returns:
-
getDurationMs
public long getDurationMs()
How long did the test take to execute?- Returns:
- the length of the test in milliseconds
-
addError
public void addError(TestCaseResultError error)
Add an error to the test- Parameters:
error- a new error
-
getErrors
public List<TestCaseResultError> getErrors()
How many errors does the test have.- Returns:
- The collection of errors. An empty list is returned is there are no errors.
-
setSystemOut
public void setSystemOut(String systemOut)
-
getSystemOut
public String getSystemOut()
-
hasErrors
public boolean hasErrors()
-
getPrettyDuration
@Deprecated public String getPrettyDuration()
Deprecated.since 5.9 without replacement
-
compareTo
public int compareTo(TestResults o)
- Specified by:
compareToin interfaceComparable<TestResults>
-
getState
public TestState getState()
-
setState
public void setState(TestState state)
-
getTestCaseId
public long getTestCaseId()
-
setTestCaseId
public void setTestCaseId(long testCaseId)
-
-