tests/ directory in ImsMedia contains all the ImsMedia's Unit Tests.ImsMediaJavaTests - consists all junit tests.ImsMediaNativeTests - consists all gtest tests.ImsMedia-alltests - consists two testmodules explained above.Create and connect Cuttlefish before executing atest commands.
gcert acloud create --local-image acloud reconnect
atest -c --rebuild-module-info
A testgroup is a collection of multiple testmodules.
atest --test-mapping :<TESTGROUP>
Example: To run all testmodules in ImsMedia-alltests testgroup.
atest --test-mapping :ImsMedia-alltests
atest <TESTMODULE>
Example: To run all tests in ImsMediaNativeTests testmodule
atest ImsMediaNativeTests
atest <TESTMODULE>:<TESTCLASS>
Example: To run all tests in RtpBufferTest test class in ImsMediaNativeTests testmodule
atest ImsMediaNativeTests:RtpBufferTest
--rebuild-module-info as last argument for any atest command to build and run.-c as first argument for any atest command to clean old cache.Example: To build and run a test module along with clear cache:
atest -c <TESTMODULE> --rebuild-module-info
Example: To build and run ImsMediaNativeTests testmodule if new test is added
atest -c ImsMediaNativeTests --rebuild-module-info
After building ImsMedia with mm command, connect Cuttlefish.
$ adb root $ adb remount $ adb sync
adb shell ./data/nativetest64/<TESTMODULE>/<TESTMODULE>
Example: To run ImsMediaNativeTests testmodule on CVD/device
adb shell ./data/nativetest64/ImsMediaNativeTests/ImsMediaNativeTests
Testapk should be installed on device
adb shell am instrument -w <test_package_name>/<runner_class>
Example: To run ImsStackJavaTests testmodule on CVD/device
adb shell am instrument -w com.android.telephony.imsmedia.tests.java.imsapp/androidx.test.runner.AndroidJUnitRunner