com.atlassian.bamboo.resultsummary.tests
Interface TestsManager

All Known Implementing Classes:
TestsManagerImpl

public interface TestsManager

Manager for manipulating all things test related


Method Summary
 void copyTestResultsToBuildResultsSummary(BuildResultsSummary summary, BuildResults buildResults, BuildContext buildContext)
          Converts the test results sent back from the agent to a list of TestClassResults and attaches them to the BRS.
 void copyTestResultsToBuildResultsSummary(Plan plan, BuildResultsSummary summary, java.util.List<TestResults> oldTests)
          Converts a set of test results to a list of TestClassResults and attaches them to the BRS.
 java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResults(TestCase testCase, int number)
          Retrieve the last n failing testResults for this given test case, latest first.
 java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResults(TestCase testCase, java.util.List<BuildResultsSummary> buildResults, int number)
          Retrieve the last n failing testResults for this given test case, but only those that occurred within the provided build results.
 java.util.List<TestCase> getLongestRunningTestCases(Plan plan)
          Provide a list of the top ten longest running tests for a plan, based on the duration of the TestCase's TestCaseResults Finds top 10 results in order (longest first)
 java.util.List<Pair<TestCase,java.lang.Float>> getLongestToFixTestCases(java.util.List<BuildResultsSummary> buildResults)
          Retrieve a list of the test cases that have taken the longest amount of time to fix.
 java.util.List<Pair<TestCase,java.lang.Float>> getLongestToFixTestCases(Plan plan)
          Retrieve a list of the test cases that have taken the longest amount of time to fix.
 java.util.List<Pair<TestCase,java.lang.Integer>> getMostFailingTestCases(java.util.List<BuildResultsSummary> buildResults)
          Provide a list of the top 10 most failing test cases for a plan.
 java.util.List<Pair<TestCase,java.lang.Integer>> getMostFailingTestCases(Plan plan)
          Provide a list of the top 10 most failing test cases for a plan.
 java.util.List<TestCaseResultStatisticsProvider> getResultStatistics(TestCase testCase)
          Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g.
 java.util.List<TestCaseResultStatisticsProvider> getResultStatistics(TestCase testCase, java.util.List<BuildResultsSummary> buildResults)
          Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case and contained within a specific span of build result summaries.
 BuildResultsSummary getSucceedingSinceBuildResultSummary(TestCase testCase)
          Find the build in which the given test has been successful since.
 TestCase getTestCaseById(long testCaseId)
          Find a specific testCase by id
 TestCaseResult getTestCaseResult(TestCase testCase, long buildNumber)
          Deprecated. since 3.3 use getTestCaseResults(TestCase, long)
 TestCaseResult getTestCaseResultById(long testCaseResultId)
          Find a specific testCaseResult by id
 java.util.List<TestCaseResult> getTestCaseResults(TestCase testCase, long buildNumber)
          Find a specific run of a testCase
 TestClass getTestClassById(long testClassId)
          Find a specific testClass by id
 TestClassResult getTestClassResultById(long testClassResultId)
          Find a specific testClassResult by id
 java.util.List<TestClassResult> getTestClassResults(PlanResultKey planResultKey)
          Retrieves a list of all testClassResults for a BuildResultSummary
 com.google.common.collect.TreeMultimap<TestClassResult,TestCaseResult> getTestOrderedMap(java.util.List<TestCaseResult> tests)
          Generate a ListOrderedMap of TestClassResult to List based on a given list of TestCaseResults.
 java.util.List<TestCaseResult> getTestsForBuildResultByDeltaState(BuildResultsSummary summary, TestDeltaState deltaState, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a BuildResultSummary based on their delta state (e.g BROKEN, FIXED)
 java.util.List<TestCaseResult> getTestsForBuildResultByState(BuildResultsSummary summary, TestState state)
          Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS)
 java.util.List<TestCaseResult> getTestsForBuildResultByState(BuildResultsSummary summary, TestState state, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS).
 java.util.List<TestCaseResult> getTestsForChainResultByDeltaState(ChainResultsSummary summary, TestDeltaState deltaState, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)
 java.util.List<TestCaseResult> getTestsForChainResultByDeltaStates(ChainResultsSummary summary, TestDeltaState[] deltaStates, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)
 java.util.List<TestCaseResult> getTestsForChainResultByState(ChainResultsSummary summary, TestState testState, int firstResult, int maxCount)
          Retrieves a list of testCaseResults for a ChainResultSummary based on their TestState
 int removeResultsByPlan(Plan plan)
          Remove all TestClassResult objects referenced by ResultsSummary objects identified by planKey
 int removeResultsByPlan(PlanKey planKey)
          Remove all TestClassResult objects referenced by ResultsSummary objects identified by planKey
 void repopulateTestResultsInBuildResultsSummary(Plan plan, BuildResultsSummary summary, java.util.List<TestResults> successfulTests)
           
 void saveTestCase(TestCase testCase)
          Save an individual TestCase to the database
 void saveTestClass(TestClass testClass)
          Save a TestClass (and included TestCases) to the database
 

Method Detail

saveTestClass

void saveTestClass(TestClass testClass)
Save a TestClass (and included TestCases) to the database

Parameters:
testClass - to save

saveTestCase

void saveTestCase(TestCase testCase)
Save an individual TestCase to the database

Parameters:
testCase - to save

copyTestResultsToBuildResultsSummary

void copyTestResultsToBuildResultsSummary(BuildResultsSummary summary,
                                          @NotNull
                                          BuildResults buildResults,
                                          BuildContext buildContext)
Converts the test results sent back from the agent to a list of TestClassResults and attaches them to the BRS. Also updates (but does not save) testResultsSummary information in the BRS. This method does not save the test results, or the summary, but does save TestClass and TestCase objects to the database as required.

Parameters:
summary - for the interesting tests to be attached to.
buildResults - for the boring tests to be attached to
buildContext - for the build that has the tests we want to move

copyTestResultsToBuildResultsSummary

void copyTestResultsToBuildResultsSummary(@NotNull
                                          Plan plan,
                                          @NotNull
                                          BuildResultsSummary summary,
                                          @NotNull
                                          java.util.List<TestResults> oldTests)
Converts a set of test results to a list of TestClassResults and attaches them to the BRS. Also updates (but does not save) testResultsSummary information in the BRS. This method does not save the test results, or the summary, but does save TestClass and TestCase objects to the database as required.

Parameters:
plan - the tests are run against
summary - for the tests to be attached to.
oldTests - the set of tests to convert.

repopulateTestResultsInBuildResultsSummary

void repopulateTestResultsInBuildResultsSummary(@NotNull
                                                Plan plan,
                                                @NotNull
                                                BuildResultsSummary summary,
                                                @NotNull
                                                java.util.List<TestResults> successfulTests)

getTestsForBuildResultByState

@NotNull
java.util.List<TestCaseResult> getTestsForBuildResultByState(BuildResultsSummary summary,
                                                                     TestState state)
Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS)

Parameters:
summary - the BuildResultsSummary to get the tests for
state - - The TestState to search for.
Returns:
a list of testCaseResults for a BuildResultSummary with the given state

getTestsForBuildResultByState

@NotNull
java.util.List<TestCaseResult> getTestsForBuildResultByState(BuildResultsSummary summary,
                                                                     TestState state,
                                                                     int firstResult,
                                                                     int maxCount)
Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS). To be used whenever pagination is required.

Parameters:
summary - the BuildResultsSummary to get the tests for
state - - The TestState to search for.
firstResult - - index of the first result
maxCount - - maximum amount of records returned
Returns:
a list of testCaseResults for a BuildResultSummary with the given state

getTestsForBuildResultByDeltaState

@NotNull
java.util.List<TestCaseResult> getTestsForBuildResultByDeltaState(BuildResultsSummary summary,
                                                                          TestDeltaState deltaState,
                                                                          int firstResult,
                                                                          int maxCount)
Retrieves a list of testCaseResults for a BuildResultSummary based on their delta state (e.g BROKEN, FIXED)

Parameters:
summary - the BuildResultsSummary to get the tests for
deltaState - - The TestDeltaState to search for.
firstResult - - index of the first result
maxCount - - maximum amount of records returned
Returns:
a list of testCaseResults for a BuildResultSummary with the given delta state

getTestsForChainResultByDeltaState

java.util.List<TestCaseResult> getTestsForChainResultByDeltaState(ChainResultsSummary summary,
                                                                  TestDeltaState deltaState,
                                                                  int firstResult,
                                                                  int maxCount)
Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)

Parameters:
summary -
deltaState -
firstResult - - index of the first result
maxCount - - maximum amount of records returned
Returns:
testCaseResults

getTestsForChainResultByDeltaStates

@NotNull
java.util.List<TestCaseResult> getTestsForChainResultByDeltaStates(@NotNull
                                                                           ChainResultsSummary summary,
                                                                           @NotNull
                                                                           TestDeltaState[] deltaStates,
                                                                           int firstResult,
                                                                           int maxCount)
Retrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)

Parameters:
summary -
deltaStates -
firstResult - - index of the first result
maxCount - - maximum amount of records returned
Returns:
testCaseResults

getTestsForChainResultByState

@NotNull
java.util.List<TestCaseResult> getTestsForChainResultByState(@NotNull
                                                                     ChainResultsSummary summary,
                                                                     @NotNull
                                                                     TestState testState,
                                                                     int firstResult,
                                                                     int maxCount)
Retrieves a list of testCaseResults for a ChainResultSummary based on their TestState

Parameters:
summary -
testState -
firstResult -
maxCount -
Returns:
testCaseResults

getTestOrderedMap

@NotNull
com.google.common.collect.TreeMultimap<TestClassResult,TestCaseResult> getTestOrderedMap(@NotNull
                                                                                                 java.util.List<TestCaseResult> tests)
Generate a ListOrderedMap of TestClassResult to List based on a given list of TestCaseResults.

Parameters:
tests - to put in the map
Returns:
a ListOrderedMap of TestClassResult to List

getTestCaseResultById

@Nullable
TestCaseResult getTestCaseResultById(long testCaseResultId)
Find a specific testCaseResult by id

Parameters:
testCaseResultId - of the test you want to find
Returns:
the testCaseResult corresponding to the id provided.

getTestClassResultById

@Nullable
TestClassResult getTestClassResultById(long testClassResultId)
Find a specific testClassResult by id

Parameters:
testClassResultId - of the test you want to find
Returns:
the testClassResult corresponding to the id provided.

getTestCaseById

@Nullable
TestCase getTestCaseById(long testCaseId)
Find a specific testCase by id

Parameters:
testCaseId - of the test case you want to find
Returns:
the testCase corresponding to the id provided.

getTestClassById

@Nullable
TestClass getTestClassById(long testClassId)
Find a specific testClass by id

Parameters:
testClassId - of the test class you want to find
Returns:
the testClass corresponding to the id provided.

getResultStatistics

@NotNull
java.util.List<TestCaseResultStatisticsProvider> getResultStatistics(@NotNull
                                                                             TestCase testCase)
Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g. graphs

Parameters:
testCase - to find the results for
Returns:
List for each TestCaseResult found for the TestCase

getResultStatistics

@NotNull
java.util.List<TestCaseResultStatisticsProvider> getResultStatistics(@NotNull
                                                                             TestCase testCase,
                                                                             @NotNull
                                                                             java.util.List<BuildResultsSummary> buildResults)
Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case and contained within a specific span of build result summaries. For use by e.g. graphs

Parameters:
testCase - to find the results for
buildResults - to contain search to (this list must not be empty)
Returns:
List for each TestCaseResult found for the TestCase

getLongestRunningTestCases

@NotNull
java.util.List<TestCase> getLongestRunningTestCases(@NotNull
                                                            Plan plan)
Provide a list of the top ten longest running tests for a plan, based on the duration of the TestCase's TestCaseResults Finds top 10 results in order (longest first)

Parameters:
plan - to search in for the tests.
Returns:
List of TestCases

getMostFailingTestCases

@NotNull
java.util.List<Pair<TestCase,java.lang.Integer>> getMostFailingTestCases(@NotNull
                                                                                 Plan plan)
Provide a list of the top 10 most failing test cases for a plan. It is calculated based on failure count, not percentage. Results are ordered from most failing to least failing.

Parameters:
plan - to search for the tests
Returns:
List of Pairs containing the testCase and the number of failures found (int)

getMostFailingTestCases

@NotNull
java.util.List<Pair<TestCase,java.lang.Integer>> getMostFailingTestCases(@NotNull
                                                                                 java.util.List<BuildResultsSummary> buildResults)
Provide a list of the top 10 most failing test cases for a plan. It is calculated based on failure count, not percentage Results are ordered from most failing to least failing.

Parameters:
buildResults - to search in for the tests.
Returns:
List of Pairs containing the testCase and the number of failures found (int)

getLongestToFixTestCases

@NotNull
java.util.List<Pair<TestCase,java.lang.Float>> getLongestToFixTestCases(@NotNull
                                                                                Plan plan)
Retrieve a list of the test cases that have taken the longest amount of time to fix. Returns top 10 with the longest to fix first.

Parameters:
plan - to search for results in
Returns:
List of Pairs containing the testCase and the average number of builds between breakages and its corresponding fix (float)

getLongestToFixTestCases

@NotNull
java.util.List<Pair<TestCase,java.lang.Float>> getLongestToFixTestCases(@NotNull
                                                                                java.util.List<BuildResultsSummary> buildResults)
Retrieve a list of the test cases that have taken the longest amount of time to fix. Returns top 10 with the longest to fix first.

Parameters:
buildResults - to search in for the tests.
Returns:
List of Pairs containing the testCase and the average number of builds between breakages and its corresponding fix (float)

getLastNFailingResults

@NotNull
java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResults(@NotNull
                                                                                      TestCase testCase,
                                                                                      int number)
Retrieve the last n failing testResults for this given test case, latest first.

Parameters:
testCase - to look for the results for.
number - of results to retrieve
Returns:
List of pairs containing the offending TestCaseResult and the build number it occurred in.

getLastNFailingResults

@NotNull
java.util.List<Pair<TestCaseResult,java.lang.Integer>> getLastNFailingResults(@NotNull
                                                                                      TestCase testCase,
                                                                                      @NotNull
                                                                                      java.util.List<BuildResultsSummary> buildResults,
                                                                                      int number)
Retrieve the last n failing testResults for this given test case, but only those that occurred within the provided build results. Latest first.

Parameters:
testCase - to look for the results for.
buildResults - to search in for the tests.
number - of results to retrieve
Returns:
List of pairs containing the offending TestCaseResult and the build number it occurred in.

getTestCaseResult

@Nullable
@Deprecated
TestCaseResult getTestCaseResult(TestCase testCase,
                                                     long buildNumber)
Deprecated. since 3.3 use getTestCaseResults(TestCase, long)

Find a specific run of a testCase

Parameters:
testCase - to look for
buildNumber - of the build the run should have occured in
Returns:
the TestCaseResult for the given test case, if it ran in the given build.

getTestCaseResults

@NotNull
java.util.List<TestCaseResult> getTestCaseResults(TestCase testCase,
                                                          long buildNumber)
Find a specific run of a testCase

Parameters:
testCase - to look for
buildNumber - of the build the run should have occured in
Returns:
the TestCaseResult for the given test case, if it ran in the given build.

getSucceedingSinceBuildResultSummary

@Nullable
BuildResultsSummary getSucceedingSinceBuildResultSummary(TestCase testCase)
Find the build in which the given test has been successful since. AKA the last recored "FIXED" test run.

Parameters:
testCase - to search history for.
Returns:
the BuildResultSummary that this test has been successful since.

removeResultsByPlan

int removeResultsByPlan(@NotNull
                        Plan plan)
Remove all TestClassResult objects referenced by ResultsSummary objects identified by planKey

Parameters:
plan - plan
Returns:
number of removed objects

removeResultsByPlan

int removeResultsByPlan(PlanKey planKey)
Remove all TestClassResult objects referenced by ResultsSummary objects identified by planKey

Parameters:
planKey - planKey
Returns:
number of removed objects

getTestClassResults

@NotNull
java.util.List<TestClassResult> getTestClassResults(@NotNull
                                                            PlanResultKey planResultKey)
Retrieves a list of all testClassResults for a BuildResultSummary

Parameters:
planResultKey - key of the BuildResultsSummary to get the tests class results for
Returns:
a list of all testClassResults for the BuildResultSummary


Copyright © 2012 Atlassian. All Rights Reserved.