Class TestsManagerImpl
java.lang.Object
com.atlassian.bamboo.resultsummary.tests.TestsManagerImpl
- All Implemented Interfaces:
TestsManager
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTestsManagerImpl(TestCaseDao testCaseDao, TestCaseResultDao testCaseResultDao, TestResultsDao testResultsDao, TestsDao testsDao, PlanManager planManager, CachedPlanManager cachedPlanManager, ResultsSummaryManager resultsSummaryManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyTestResultsToBuildResultsSummary(@NotNull BuildResultsSummary summary, @NotNull BuildResults buildResults, @NotNull BuildContext buildContext) Converts the test results sent back from the agent to a list of TestClassResults and attaches them to the BRS.@NotNull List<Pair<TestCaseResult,Integer>> getLastNFailingResults(@NotNull TestCase testCase, int number) Retrieve the last n failing testResults for this given test case, latest first.@NotNull List<Pair<TestCaseResult,Integer>> getLastNFailingResults(@NotNull TestCase testCase, @NotNull 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.getLongestRunningTestCases(@NotNull ImmutablePlan 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)getLongestToFixTestCases(@NotNull ImmutablePlan plan) Retrieve a list of the test cases that have taken the longest amount of time to fix.getLongestToFixTestCases(@NotNull List<BuildResultsSummary> buildResults) Retrieve a list of the test cases that have taken the longest amount of time to fix.getMostFailingTestCases(@NotNull ImmutablePlan plan) Provide a list of the top 10 most failing test cases for a plan.getMostFailingTestCases(@NotNull List<BuildResultsSummary> buildResults) Provide a list of the top 10 most failing test cases for a plan.@NotNull List<TestCaseResultStatisticsProvider>getResultStatistics(@NotNull TestCase testCase) Returns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g.@NotNull List<TestCaseResultStatisticsProvider>getResultStatistics(@NotNull TestCase testCase, @NotNull 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.@Nullable BuildResultsSummarygetSucceedingSinceBuildResultSummary(TestCase testCase) Find the build in which the given test has been successful since.@Nullable TestCasegetTestCaseById(long testCaseId) Find a specific testCase by idgetTestCaseResultById(long testCaseId) Find a specific testCaseResult by id@NotNull List<TestCaseResult>getTestCaseResults(TestCase testCase, long buildNumber) Find a specific run of a testCase@Nullable TestClassgetTestClassById(long testClassId) Find a specific testClass by idgetTestClassResultById(long testClassResultId) Find a specific testClassResult by id@NotNull List<TestClassResult>getTestClassResults(@NotNull PlanResultKey planResultKey) Retrieves a list of all testClassResults for a BuildResultSummary@NotNull TreeMultimap<TestClassResult,TestCaseResult> getTestOrderedMap(@NotNull List<TestCaseResult> tests) Generate a ListOrderedMap of TestClassResult to list ofTestCaseResultbased on a given list of TestCaseResults.@NotNull 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)@NotNull List<TestCaseResult>getTestsForBuildResultByState(BuildResultsSummary summary, TestState state) Retrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS)@NotNull 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).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)@NotNull 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)@NotNull List<TestCaseResult>getTestsForChainResultByState(@NotNull ChainResultsSummary summary, @NotNull TestState testState, int firstResult, int maxCount) Retrieves a list of testCaseResults for a ChainResultSummary based on theirTestStategetTopBrokenTests(@NotNull PlanKey planKey, BuildResultsFilter filter) Returns a pai of the top 10 tests that's broken + the count for a given filter periodintremoveResultsByPlan(@NotNull Plan plan) Remove allTestClassResultobjects referenced byResultsSummaryobjects identified by planKeyintremoveResultsByPlan(@NotNull PlanKey planKey) Remove allTestClassResultobjects referenced byResultsSummaryobjects identified by planKeyvoidrepopulateTestResultsInBuildResultsSummary(@NotNull BuildResultsSummary summary, @NotNull Supplier<List<TestResults>> unorderedSuccessfulTestsSupplier) voidrepopulateTestResultsInBuildResultsSummary(@NotNull BuildResultsSummary summary, @NotNull List<TestResults> unorderedSuccessfulTests) voidsaveTestCase(TestCase testCase) Save an individual TestCase to the databasevoidsaveTestClass(TestClass testClass) Save a TestClass (and included TestCases) to the database
-
Field Details
-
TEST_SKIP_HISTORY_ENABLED_KEY
- See Also:
-
-
Constructor Details
-
TestsManagerImpl
public TestsManagerImpl(TestCaseDao testCaseDao, TestCaseResultDao testCaseResultDao, TestResultsDao testResultsDao, TestsDao testsDao, PlanManager planManager, CachedPlanManager cachedPlanManager, ResultsSummaryManager resultsSummaryManager)
-
-
Method Details
-
saveTestClass
Description copied from interface:TestsManagerSave a TestClass (and included TestCases) to the database- Specified by:
saveTestClassin interfaceTestsManager- Parameters:
testClass- to save
-
saveTestCase
Description copied from interface:TestsManagerSave an individual TestCase to the database- Specified by:
saveTestCasein interfaceTestsManager- Parameters:
testCase- to save
-
getTestCaseResultById
Description copied from interface:TestsManagerFind a specific testCaseResult by id- Specified by:
getTestCaseResultByIdin interfaceTestsManager- Parameters:
testCaseId- of the test you want to find- Returns:
- the testCaseResult corresponding to the id provided.
-
getTestClassResultById
Description copied from interface:TestsManagerFind a specific testClassResult by id- Specified by:
getTestClassResultByIdin interfaceTestsManager- Parameters:
testClassResultId- of the test you want to find- Returns:
- the testClassResult corresponding to the id provided.
-
getTestClassById
Description copied from interface:TestsManagerFind a specific testClass by id- Specified by:
getTestClassByIdin interfaceTestsManager- Parameters:
testClassId- of the test class you want to find- Returns:
- the testClass corresponding to the id provided.
-
getTestCaseById
Description copied from interface:TestsManagerFind a specific testCase by id- Specified by:
getTestCaseByIdin interfaceTestsManager- Parameters:
testCaseId- of the test case you want to find- Returns:
- the testCase corresponding to the id provided.
-
getTestsForBuildResultByState
@NotNull public @NotNull List<TestCaseResult> getTestsForBuildResultByState(BuildResultsSummary summary, TestState state) Description copied from interface:TestsManagerRetrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS)- Specified by:
getTestsForBuildResultByStatein interfaceTestsManager- Parameters:
summary- the BuildResultsSummary to get the tests forstate- - The TestState to search for.- Returns:
- a list of testCaseResults for a BuildResultSummary with the given state
-
getTestsForBuildResultByState
@NotNull public @NotNull List<TestCaseResult> getTestsForBuildResultByState(BuildResultsSummary summary, TestState state, int firstResult, int maxCount) Description copied from interface:TestsManagerRetrieves a list of testCaseResults for a BuildResultSummary based on their state (e.f FAILED or SUCCESS). To be used whenever pagination is required.- Specified by:
getTestsForBuildResultByStatein interfaceTestsManager- Parameters:
summary- the BuildResultsSummary to get the tests forstate- - The TestState to search for.firstResult- - index of the first resultmaxCount- - maximum amount of records returned- Returns:
- a list of testCaseResults for a BuildResultSummary with the given state
-
getTestsForBuildResultByDeltaState
@NotNull public @NotNull List<TestCaseResult> getTestsForBuildResultByDeltaState(BuildResultsSummary summary, TestDeltaState deltaState, int firstResult, int maxCount) Description copied from interface:TestsManagerRetrieves a list of testCaseResults for a BuildResultSummary based on their delta state (e.g BROKEN, FIXED)- Specified by:
getTestsForBuildResultByDeltaStatein interfaceTestsManager- Parameters:
summary- the BuildResultsSummary to get the tests fordeltaState- - The TestDeltaState to search for.firstResult- - index of the first resultmaxCount- - maximum amount of records returned- Returns:
- a list of testCaseResults for a BuildResultSummary with the given delta state
-
getTestsForChainResultByDeltaState
public List<TestCaseResult> getTestsForChainResultByDeltaState(ChainResultsSummary summary, TestDeltaState deltaState, int firstResult, int maxCount) Description copied from interface:TestsManagerRetrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)- Specified by:
getTestsForChainResultByDeltaStatein interfaceTestsManagerfirstResult- - index of the first resultmaxCount- - maximum amount of records returned- Returns:
- testCaseResults
-
getTestsForChainResultByDeltaStates
@NotNull public @NotNull List<TestCaseResult> getTestsForChainResultByDeltaStates(@NotNull @NotNull ChainResultsSummary summary, @NotNull @NotNull TestDeltaState[] deltaStates, int firstResult, int maxCount) Description copied from interface:TestsManagerRetrieves a list of testCaseResults for a ChainResultSummary based on their delta state (e.g BROKEN, FIXED)- Specified by:
getTestsForChainResultByDeltaStatesin interfaceTestsManagerfirstResult- - index of the first resultmaxCount- - maximum amount of records returned- Returns:
- testCaseResults
-
getTestsForChainResultByState
@NotNull public @NotNull List<TestCaseResult> getTestsForChainResultByState(@NotNull @NotNull ChainResultsSummary summary, @NotNull @NotNull TestState testState, int firstResult, int maxCount) Description copied from interface:TestsManagerRetrieves a list of testCaseResults for a ChainResultSummary based on theirTestState- Specified by:
getTestsForChainResultByStatein interfaceTestsManager- Returns:
- testCaseResults
-
getResultStatistics
@NotNull public @NotNull List<TestCaseResultStatisticsProvider> getResultStatistics(@NotNull @NotNull TestCase testCase) Description copied from interface:TestsManagerReturns a list of wrapped TestCaseResult and BuildResultSummary for a particular test case, for use by e.g. graphs- Specified by:
getResultStatisticsin interfaceTestsManager- Parameters:
testCase- to find the results for- Returns:
- list of
TestCaseResultStatisticsProviderfor each TestCaseResult found for the TestCase
-
getResultStatistics
@NotNull public @NotNull List<TestCaseResultStatisticsProvider> getResultStatistics(@NotNull @NotNull TestCase testCase, @NotNull @NotNull List<BuildResultsSummary> buildResults) Description copied from interface:TestsManagerReturns 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- Specified by:
getResultStatisticsin interfaceTestsManager- Parameters:
testCase- to find the results forbuildResults- to contain search to (this list must not be empty)- Returns:
- list of
TestCaseResultStatisticsProviderfor each TestCaseResult found for the TestCase
-
getLastNFailingResults
@NotNull public @NotNull List<Pair<TestCaseResult,Integer>> getLastNFailingResults(@NotNull @NotNull TestCase testCase, int number) Description copied from interface:TestsManagerRetrieve the last n failing testResults for this given test case, latest first.- Specified by:
getLastNFailingResultsin interfaceTestsManager- 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 public @NotNull List<Pair<TestCaseResult,Integer>> getLastNFailingResults(@NotNull @NotNull TestCase testCase, @NotNull @NotNull List<BuildResultsSummary> buildResults, int number) Description copied from interface:TestsManagerRetrieve the last n failing testResults for this given test case, but only those that occurred within the provided build results. Latest first.- Specified by:
getLastNFailingResultsin interfaceTestsManager- 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.
-
getLongestRunningTestCases
@NotNull public @NotNull List<TestCase> getLongestRunningTestCases(@NotNull @NotNull ImmutablePlan plan) Description copied from interface:TestsManagerProvide 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)- Specified by:
getLongestRunningTestCasesin interfaceTestsManager- Parameters:
plan- to search in for the tests.- Returns:
- List of TestCases
-
getMostFailingTestCases
@NotNull public @NotNull List<Pair<TestCase,Long>> getMostFailingTestCases(@NotNull @NotNull ImmutablePlan plan) Description copied from interface:TestsManagerProvide 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.- Specified by:
getMostFailingTestCasesin interfaceTestsManager- Parameters:
plan- to search for the tests- Returns:
- List of Pairs containing the testCase and the number of failures found (int)
-
getMostFailingTestCases
@NotNull public @NotNull List<Pair<TestCase,Long>> getMostFailingTestCases(@NotNull @NotNull List<BuildResultsSummary> buildResults) Description copied from interface:TestsManagerProvide 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.- Specified by:
getMostFailingTestCasesin interfaceTestsManager- Parameters:
buildResults- to search in for the tests.- Returns:
- List of Pairs containing the testCase and the number of failures found (int)
-
getLongestToFixTestCases
@NotNull public @NotNull List<Pair<TestCase,Float>> getLongestToFixTestCases(@NotNull @NotNull ImmutablePlan plan) Description copied from interface:TestsManagerRetrieve 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.- Specified by:
getLongestToFixTestCasesin interfaceTestsManager- 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)
-
getTopBrokenTests
public List<Pair<TestCase,Long>> getTopBrokenTests(@NotNull @NotNull PlanKey planKey, BuildResultsFilter filter) Description copied from interface:TestsManagerReturns a pai of the top 10 tests that's broken + the count for a given filter period- Specified by:
getTopBrokenTestsin interfaceTestsManager- Returns:
-
getLongestToFixTestCases
@NotNull public @NotNull List<Pair<TestCase,Float>> getLongestToFixTestCases(@NotNull @NotNull List<BuildResultsSummary> buildResults) Description copied from interface:TestsManagerRetrieve 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.- Specified by:
getLongestToFixTestCasesin interfaceTestsManager- 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)
-
getTestCaseResults
@NotNull public @NotNull List<TestCaseResult> getTestCaseResults(TestCase testCase, long buildNumber) Description copied from interface:TestsManagerFind a specific run of a testCase- Specified by:
getTestCaseResultsin interfaceTestsManager- Parameters:
testCase- to look forbuildNumber- of the build the run should have occurred in- Returns:
- the TestCaseResult for the given test case, if it ran in the given build.
-
getSucceedingSinceBuildResultSummary
@Nullable public @Nullable BuildResultsSummary getSucceedingSinceBuildResultSummary(TestCase testCase) Description copied from interface:TestsManagerFind the build in which the given test has been successful since. AKA the last recored "FIXED" test run.- Specified by:
getSucceedingSinceBuildResultSummaryin interfaceTestsManager- Parameters:
testCase- to search history for.- Returns:
- the BuildResultSummary that this test has been successful since.
-
removeResultsByPlan
Description copied from interface:TestsManagerRemove allTestClassResultobjects referenced byResultsSummaryobjects identified by planKey- Specified by:
removeResultsByPlanin interfaceTestsManager- Parameters:
plan- plan- Returns:
- number of removed objects
-
removeResultsByPlan
Description copied from interface:TestsManagerRemove allTestClassResultobjects referenced byResultsSummaryobjects identified by planKey- Specified by:
removeResultsByPlanin interfaceTestsManager- Parameters:
planKey- planKey- Returns:
- number of removed objects
-
getTestOrderedMap
@NotNull public @NotNull TreeMultimap<TestClassResult,TestCaseResult> getTestOrderedMap(@NotNull @NotNull List<TestCaseResult> tests) Description copied from interface:TestsManagerGenerate a ListOrderedMap of TestClassResult to list ofTestCaseResultbased on a given list of TestCaseResults.- Specified by:
getTestOrderedMapin interfaceTestsManager- Parameters:
tests- to put in the map- Returns:
- a ListOrderedMap of TestClassResult to list of
TestCaseResult
-
copyTestResultsToBuildResultsSummary
public void copyTestResultsToBuildResultsSummary(@NotNull @NotNull BuildResultsSummary summary, @NotNull @NotNull BuildResults buildResults, @NotNull @NotNull BuildContext buildContext) Description copied from interface:TestsManagerConverts 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.- Specified by:
copyTestResultsToBuildResultsSummaryin interfaceTestsManager- Parameters:
summary- for the interesting tests to be attached to.buildResults- for the boring tests to be attached tobuildContext- for the build that has the tests we want to move
-
getTestClassResults
@NotNull public @NotNull List<TestClassResult> getTestClassResults(@NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:TestsManagerRetrieves a list of all testClassResults for a BuildResultSummary- Specified by:
getTestClassResultsin interfaceTestsManager- Parameters:
planResultKey- key of the BuildResultsSummary to get the tests class results for- Returns:
- a list of all testClassResults for the BuildResultSummary
-
repopulateTestResultsInBuildResultsSummary
public void repopulateTestResultsInBuildResultsSummary(@NotNull @NotNull BuildResultsSummary summary, @NotNull @NotNull List<TestResults> unorderedSuccessfulTests) - Specified by:
repopulateTestResultsInBuildResultsSummaryin interfaceTestsManager
-
repopulateTestResultsInBuildResultsSummary
public void repopulateTestResultsInBuildResultsSummary(@NotNull @NotNull BuildResultsSummary summary, @NotNull @NotNull Supplier<List<TestResults>> unorderedSuccessfulTestsSupplier) - Specified by:
repopulateTestResultsInBuildResultsSummaryin interfaceTestsManager
-