4. Integration Testing
4.1. Integration Testing Instructions
This section explains how to enable test ads in ad integration. Enabling test ads during development is very important so you can click on them without charging advertisers.
If ads still cannot be loaded or displayed after test setup, follow the Troubleshooting Guide.
Choose one method based on the ad source you need to test:
- To test only Hisavana SSP ads without rebuilding the app, keep
testDevice(false)and add the device's Google Advertising ID (GAID) in the Hisavana SSP dashboard. - To test Hisavana SSP, AdMob, Facebook, AppLovin, Unity, or MAX ads, set
testDevice(true)in code and rebuild the app. - To test other ad sources, keep
testDevice(false)and configure test ads separately according to the corresponding platform documentation.
Note: For Hisavana SSP ads, either the code setting or the dashboard GAID setting is sufficient; you do not need to configure both. Adding a GAID in the Hisavana SSP dashboard affects Hisavana SSP ads only and cannot control other ad platforms.
4.2. Enable a Test Device in Code
Set testDevice to true. This requires changing the code and rebuilding the app.
TAdManager.init(this, new TAdManager.AdConfigBuilder()
// Whether to print ad logs, default is false; if set to true, logs will be printed with keywords ADSDK_M, ADSDK_N
.setDebug(false)
// Whether to mark the current device as a test device; the default is false
// This affects only Hisavana SSP, AdMob, Facebook, AppLovin, Unity, and MAX
// Configure other ad sources according to their platform documentation
.testDevice(true)
.build());
Important Reminder: Before going live, be sure to set testDevice to false to prevent test data from affecting production statistics.
Enable Log Commands
adb shell setprop log.tag.ADSDK DEBUG //Enable advertising log
adb shell setprop log.tag.AD_NET_LOG DEBUG //Enable ad network request log
4.3. Enable a Test Device in the Dashboard
This method does not require a code change. Keep testDevice(false) and add the device's Google Advertising ID (GAID) in the test settings of the Hisavana SSP dashboard. This setting affects Hisavana SSP ads only and does not control other ad platforms. For detailed steps, see Add Test Device.
4.4. Testing Process
- Apply for official app id and related ad unit ids from the Hisavana SSP platform. If you have questions, please contact Operations Personnel.
- Select the appropriate testing method according to Section 4.1. For Hisavana SSP ads, either the code setting or the dashboard GAID setting is sufficient. For other ad sources, see Section 4.8.
- To test third-party ads such as AdMob and Facebook, first register with the corresponding platform, and then add the corresponding ad source in the Hisavana SSP dashboard.
- Before going live, be sure to change the testDevice method parameter to false.
Reminder: When switching ad units, due to the need to update ad unit configuration information, please clear the app cache data promptly. Clear cache operation is in app details, or execute the command adb shell pm clear package name, otherwise the following error may occur:
9009 ad unit is closed by operational staff
4.5. How to Verify Test Ads
To check the current ad network request log parameters, run the following commands to enable and filter ad network request logs:
adb shell setprop log.tag.AD_NET_LOG DEBUG
adb logcat | grep ADSDK_N
Confirm test ads primarily through the test label on the creative, the third-party platform's test-device configuration, and that platform's testing documentation. For the Hisavana SSP platform, check testResponse in the network logs; testResponse=true means that the current response is a Hisavana SSP test ad. This field applies only to Hisavana SSP and cannot be used to determine whether other ad sources returned test ads.
4.6. Pre-release Checklist
- Set
testDevicetofalse. - Set
setDebugtofalse, or ensure it is enabled only in Debug builds. - Replace all demo ad unit IDs provided by third-party platforms and disable test mode in third-party dashboards.
- Confirm that production App IDs, ad unit IDs, and ad source parameters are used.
- Perform a load, display, and callback smoke test with the Release build. Do not click production ads unless test mode has been confirmed.
4.7. Integration Examples
Please download the integration example code and refer to the code for integration.
4.8. Test Ad Sources
Important Reminder: Please configure the third-party advertising ID on the Hisavana SSP platform.