Reputation: 31
I'm developing a custom device targeting Android P, and have added custom system service which uses some hidden APIs. The service then will be used by the android application which is not part of the AOSP source tree.
I have added some unit and instrumentation tests for my service and now want to integrate them into my CI pipeline. What would be the best approach - extend CTS? But it's only my service and doesn't expose any public API. VTS? But afaik VTS is only about testing HALs and kernels. Is there a way just to declare custom test suite to be able to run it with Trade Federation/Atest harness like "tradefed.sh run my_test_suite"?
Upvotes: 2
Views: 1433
Reputation: 31
Finally I found what I was looking for - there is a good explanation of how to add custom TradeFed test suite tag (based on Android P sources) - [aosp]/tools/tradefederation/core/tests/res/config/suite/suite.md
Basically you have to create a new config file like this (so far I tried to add it to TradeFederation folder as written in the doc):
<?xml version="1.0" encoding="utf-8"?>
<configuration description="My test suite config">
<test class="com.android.tradefed.testtype.suite.TfSuiteRunner">
<option name="run-suite-tag" value="my-test-suite" />
</test>
</configuration>
And then use it in your test config files like this:
<option name="test-suite-tag" value="my-test-suite" />
And then you can execute your suite like this:
make tradefed-all
make YourTestModule
tradefed.sh run template/local --template:map test=suite/my-test-suite
Upvotes: 1
Reputation: 659
Atest uses TEST_MAPPING
to find the tests should be run. So if you just want to test your APK/services with your API
, maybe you can add your instrumentation test module to TEST_MAPPING
in the code top directory, and run the atest
in code top directory to run your instrumentation test.
The source.android.com
provides the document about how to use atest to run your instrumentation tests and tradefederation tests based on TEST_MAPPING
.
If your unit test is based on Robolectric
, the atest
can run it correctly, because atest supports Robolectric
unit tests too in Android P.
Upvotes: 1
Reputation: 2499
Since your changes are part of the AOSP
code, CTS/VTS
covers all the test cases required for the compatibility test suite. I don't think, it is required to add your custom test suite as a part of CTS/VTS
test cases. However, you can write independent unit test cases for your module. Even if you add extensions in existing CTS code, it doesn't be useful, as final CTS will run on the official test suite(Google submission for verification and official release).
For more details, please refer https://source.android.com/compatibility/tests
Upvotes: 0