mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 15:20:34 +00:00
Adapt to aa test dynamic key-value parameters
Signed-off-by: njupthan <hanhaibin@huawei.com>
This commit is contained in:
parent
e8ac6d7f87
commit
7f01b79cf2
@ -28,16 +28,10 @@ AbilityDelegatorArgs::AbilityDelegatorArgs()
|
||||
AbilityDelegatorArgs::AbilityDelegatorArgs(const AAFwk::Want &want)
|
||||
{
|
||||
bundleName_ = want.GetStringParam(AbilityDelegatorArgs::KEY_TEST_BUNDLE_NAME);
|
||||
params_[AbilityDelegatorArgs::KEY_TEST_BUNDLE_NAME] =
|
||||
want.GetStringParam(AbilityDelegatorArgs::KEY_TEST_BUNDLE_NAME);
|
||||
params_[AbilityDelegatorArgs::KEY_TEST_RUNNER_CLASS] =
|
||||
want.GetStringParam(AbilityDelegatorArgs::KEY_TEST_RUNNER_CLASS);
|
||||
if (!want.GetStringParam(AbilityDelegatorArgs::KEY_TEST_CASE).empty()) {
|
||||
params_[AbilityDelegatorArgs::KEY_TEST_CASE] = want.GetStringParam(AbilityDelegatorArgs::KEY_TEST_CASE);
|
||||
}
|
||||
if (!want.GetStringParam(AbilityDelegatorArgs::KEY_TEST_WAIT_TIMEOUT).empty()) {
|
||||
params_[AbilityDelegatorArgs::KEY_TEST_WAIT_TIMEOUT] =
|
||||
want.GetStringParam(AbilityDelegatorArgs::KEY_TEST_WAIT_TIMEOUT);
|
||||
auto wantParams = want.GetParams();
|
||||
std::set<std::string> keys = wantParams.KeySet();
|
||||
for (auto key : keys) {
|
||||
params_[key] = want.GetStringParam(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,14 +85,18 @@ const std::string HELP_MSG_DUMPSYS = "usage: aa dump <options>\n"
|
||||
" The original -s parameter is invalid\n"
|
||||
" The original -m parameter is invalid\n";
|
||||
|
||||
|
||||
const std::string HELP_MSG_TEST =
|
||||
"usage: aa test <options>\n"
|
||||
"options list:\n"
|
||||
" -h, --help \
|
||||
list available commands\n"
|
||||
" -p <bundle-name> -s unittest <test-runner> [-s class <test-class>] [-w <wait-time>] \
|
||||
start the test framework with options\n";
|
||||
" -h, --help list available commands\n"
|
||||
" -p <bundle-name> -s unittest <test-runner> start the test framework with options\n"
|
||||
" [-s class <test-class>]\n"
|
||||
" [-s level <test-level>]\n"
|
||||
" [-s size <test-size>]\n"
|
||||
" [-s testType <test-testType>]\n"
|
||||
" [-s timeout <test-timeout>]\n"
|
||||
" [-s <any-key> <any-value>]\n"
|
||||
" [-w <wait-time>]\n";
|
||||
|
||||
const std::string HELP_MSG_FORCE_STOP = "usage: aa force-stop <bundle-name>\n";
|
||||
const std::string HELP_MSG_FORCE_TIMEOUT =
|
||||
|
@ -1239,14 +1239,10 @@ ErrCode AbilityManagerShellCommand::RunAsTestCommand()
|
||||
params[opt] = argv;
|
||||
} else if (opt == "-s") {
|
||||
if (i >= argc_ - USER_TEST_COMMAND_PARAMS_NUM) {
|
||||
return TestCommandError(
|
||||
"error: option Should be [-s unittest <test-runner>] or [-s class <test-class>].\n");
|
||||
return TestCommandError("error: option [-s] is incorrect.\n");
|
||||
}
|
||||
std::string argKey = argv_[++i];
|
||||
std::string argValue = argv_[++i];
|
||||
if (!(argKey == "unittest" || argKey == "class")) {
|
||||
return TestCommandError("error: option Should be [-s unittest] or [-s class].\n");
|
||||
}
|
||||
params[opt + " " + argKey] = argValue;
|
||||
} else if (opt.at(0) == '-') {
|
||||
return TestCommandError("error: unknown option: " + opt + "\n");
|
||||
|
Loading…
Reference in New Issue
Block a user