tools/rtf/plugins/README.md
The init plugin is used to initialize repositories and testing templates. It is already integrated by default in the RTF tool and does not need to be added manually.
rtf init -h
usage: app.py init [-h] {project,template} ...
optional arguments:
-h, --help show this help message and exit
init_type:
valid init commands
{project,template}
project init project
template init template
Initialize the current repository
rtf init project -h
usage: app.py init project [-h] [-p PATH]
optional arguments:
-h, --help show this help message and exit
-p PATH, --path PATH Specify the workspace path (default: '.')
Initialize the current repository in current path.
rtf init project --path .
rtf init template -h
usage: app.py init template [-h] -t TEMPLATE_TYPE -n TEMPLATE_NAME
optional arguments:
-h, --help show this help message and exit
-t TEMPLATE_TYPE, --type TEMPLATE_TYPE
Template type to initialize
-n TEMPLATE_NAME, --name TEMPLATE_NAME
Template name to initialize
Initialize a C++ test template named 'lynx'. After successful initialization, you will find the 'native-ut-lynx.template' file in the .rtf directory.
rtf init template --name lynx --type native-ut
The native ut plugin is used to manage C++ unit tests, responsible for building, running, and generating coverage.
# .rtf/config
plugins = ["NativeUT"]
rtf native-ut -h
usage: app.py native-ut [-h] {run,list} ...
optional arguments:
-h, --help show this help message and exit
command:
run|list
{run,list}
run run targets
list list targets
rtf native-ut run -h
usage: app.py native-ut run [-h] --names [NAMES ...] [--target TARGET] [--args ARGS]
optional arguments:
-h, --help show this help message and exit
--names [NAMES ...] Specify the template name
--target TARGET Specify the target name
--args ARGS User custom params, eg: --args="args_1=true, args_2=1"
Run all test cases under the 'lynx' template.
rtf native-ut run --names lynx
Run test_a under the 'lynx' template.
rtf native-ut run --names lynx --target test_a
rtf native-ut list --names lynx
You can use dynamic parameters to control the behavior of the template. Refer to:dynamic-params
rtf native-ut run --names lynx --target test_a --args="a=1,b=false"
The android ut plugin is used to manage android unit tests, responsible for building, running, and generating coverage.
# .rtf/config
plugins = ["AndroidUT"]
rtf android-ut -h
usage: app.py android-ut [-h] {run,list} ...
optional arguments:
-h, --help show this help message and exit
command:
run|list
{run,list}
run run targets
list list targets
rtf android-ut run -h
usage: app.py android-ut run [-h] --names [NAMES ...] [--target TARGET] [--args ARGS] [--rmd]
optional arguments:
-h, --help show this help message and exit
--names [NAMES ...] Specify the template name
--target TARGET Specify the target name
--args ARGS User custom params, eg: --args="args_1=true, args_2=1"
--rmd run test in real mobile device
Run all android test cases under the 'lynx' template.
rtf android-ut run --names lynx
Run test_a under the 'lynx' template.
rtf android-ut run --names lynx --target test_a
By default, Android unit tests run on an emulator. You can also use a real device by specifying --rmd.
rtf android-ut run --names lynx --target test_a --rmd
You can use dynamic parameters to control the behavior of the template. Refer to:dynamic-params
rtf android-ut run --names lynx --target test_a --args="a=1,b=false"
The coverage detection plugin is used to identify which lines of tests have not been covered in the current changes.
# .rtf/config
plugins = ["CoverageChecker"]
rtf coverage-check -h
usage: app.py coverage-check [-h] --type CHECK_TYPE --inputs [INPUTS ...] [--threshold THRESHOLD] [--job JOB]
optional arguments:
-h, --help show this help message and exit
--type CHECK_TYPE check type, android 、cpp、oc etc.
--inputs [INPUTS ...]
Specify the input data
--threshold THRESHOLD
Input a threshold
--job JOB
The coverage detection requires an input coverage information file, which can be obtained during the execution phase.
| TestType | Details |
|---|---|
| AndroidUT | coverage.xml |
| NativeUT | coverage.lcov |
The coverage threshold, 0.5 means that if the coverage is less than 50%, an error will be reported.
Specify a task name, which will be displayed in the output coverage detection report.
rtf coverage-check --type android --inputs coverage.xml --threshold 0.5 --job "android-coverage-check"