1# Native Tests 2 3As mentioned earlier, native tests are typically used for exercising HAL or 4interacting directly with lower level system services, and to leverage 5continuous testing service, native tests should be built with 6[gtest](https://github.com/google/googletests) framework. 7 8Here are some general instructions: 9 101. See sample native test module setup at: `libs/hwui/unit_tests` 111. Test module makefile should use `BUILD_NATIVE_TEST` build rule so that 12gtest dependencies are included automatically 131. Write a [test config](test-config.md) 141. Build the test module with `mmm` or `mma` (depends on if it's an 15incremental or full build), e.g.: 16 17 ```shell 18 make hwui_unit_tests -j 19 ``` 201. Automatic installation and run with the TradeFederation test harness: 21 22 ``` 23 make tradefed-all -j 24 tradefed.sh run template/local_min --template:map test=hwui_unit_tests 25 ``` 261. Manually Install and Run: 27 1. Push the generated test binary onto device: 28 29 ```shell 30 adb push ${OUT}/data/nativetest/hwui_unit_tests/hwui_unit_tests \ 31 /data/nativetest/hwui_unit_tests/hwui_unit_tests 32 ``` 33 1. Execute the test by invoking test binary on device: 34 35 ```shell 36 adb shell /data/nativetest/hwui_unit_tests/hwui_unit_tests 37 ``` 38 39 This launches the native test. You can also add `--help` parameter to your test 40 binary to find out more about the different ways to customize test execution. 41 You can also check out the gtest advanced guide for more parameters usage: 42 43 * https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md 44