-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Perf] Add strategy for performance test (#279)
* [Perf] Add strategy for performance test * Update test_task_spec_design * Rename IPerformanceListener.java -> PerformanceTestListener * Resolve comments * Update agent/doc/UML/performance_design.puml Co-authored-by: Nathan Bu <370788475@qq.com> * Apply suggestions for performance test design UML Co-authored-by: Nathan Bu <370788475@qq.com> * Refine performance_test_design.puml * Apply suggestions for PerformanceTestManagementService Co-authored-by: Nathan Bu <370788475@qq.com> * Apply suggestions from code review Co-authored-by: Nathan Bu <370788475@qq.com> * Update perf design uml Resolve comments Fix schedule bug * Add UT for PerformanceTestManagementService and AndroidBatteryInfoResultParser * Add PerformanceTestManagementServiceTest --------- Co-authored-by: Nathan Bu <370788475@qq.com>
- Loading branch information
Showing
37 changed files
with
1,191 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
|
||
@startmindmap performance_test_inspection_entrypoints | ||
* Performance Test | ||
** Define the strategy in TestTask | ||
*** LifeCycle | ||
****: | ||
TEST_STARTED | ||
TEST_FINISHED | ||
TEST_FAILED | ||
TEST_RUN_STARTED | ||
TEST_RUN_FINISHED | ||
; | ||
*** Schedule | ||
** Call inspect() method in a test case | ||
*** Hydra SDK | ||
*** T2C | ||
*** Espresso | ||
@endmindmap | ||
@startjson taps_to_cases_json_with_performance_test_actions | ||
{ | ||
"drivers": [ | ||
{ | ||
"id": "13211FDD400183", | ||
"platform": "android", | ||
' Deprecated Name : init | ||
"setUp": { | ||
"launcherApp": "" | ||
} | ||
' Can also add tearDown here to match the device action design | ||
} | ||
], | ||
' deprecated name: cases | ||
"actions": [ | ||
{ | ||
"index": 0, | ||
"driverId": "13211FDD400183", | ||
"action": { | ||
"actionType": "inspection", | ||
"arguments": { | ||
"inspectorType": "INSPECTOR_ANDROID_MEMORY_INFO", | ||
"targetApp": "com.microsoft.appmanager", | ||
"description": "Start LTW", | ||
"isReset": false | ||
} | ||
}, | ||
"isOptional": false | ||
}, | ||
{ | ||
"index": 1, | ||
"driverId": "13211FDD400183", | ||
"action": { | ||
"actionType": "inspection", | ||
"arguments": { | ||
"inspectorType": "INSPECTOR_ANDROID_BATTERY_INFO", | ||
"targetApp ": "com.microsoft.appmanager", | ||
"description ": "Start LTW", | ||
"isReset": true | ||
} | ||
}, | ||
"isOptional": false | ||
} | ||
] | ||
} | ||
@endjson | ||
|
||
@startuml perf_test_class_design | ||
class InspectionStrategy { | ||
|
||
+ StrategyType strategyType; | ||
|
||
// if the strategyType == TEST_LIFECYCLE | ||
+ List<WhenType> when; | ||
|
||
// if the strategyType == TEST_SCHEDULE | ||
+ long interval; | ||
+ TimeUnit intervalUnit; | ||
} | ||
|
||
interface PerformanceTestListener { | ||
void testStarted(); | ||
void testFinished(); | ||
void testFailure(); | ||
void testRunStarted(); | ||
void testRunFinished(); | ||
} | ||
|
||
class PerformanceTestManagementService { | ||
Map<String, List<ScheduledFuture<?>>> inspectPerformanceTimerMap | ||
Map<String, List<InspectionStrategy>> testLifeCycleStrategyMap | ||
} | ||
|
||
PerformanceTestManagementService -> InspectionStrategy | ||
PerformanceTestManagementService -u-|> PerformanceTestListener | ||
|
||
PerformanceTestManagementService -d-o TestRunner | ||
AppiumListener -d-> PerformanceTestListener | ||
Junit5Listener -d-> PerformanceTestListener | ||
EspressoTestInfoProcessorListener -d-> PerformanceTestListener | ||
@enduml | ||
|
||
@startuml espresso_performance_test_design | ||
class EspressoPerformanceParser { | ||
void processNewLines() | ||
} | ||
EspressoPerformanceParser --|> InstrumentationResultParser | ||
TestRunner <|-- EspressoRunner | ||
EspressoRunner -> EspressoPerformanceParser | ||
EspressoPerformanceParser -> PerformanceInspectionService | ||
@enduml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.