> This page is for Applications Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# Verify & test

> **Note**
>
> This guide is relevant for the current Mobile SDK. While we highly recommend using the latest version, if you are using a legacy integration, refer to the [iOS](/applications/ios-how-to-integrate-the-sdk-in-your-application-v3) or [Android](/applications/android-how-to-integrate-the-sdk-in-your-application-v3) documentation.

After integrating with the SDK, we recommend verifying and testing the integration before deploying to production. HUMAN has recommended checks that we encourage you follow to ensure your app works as expected and it delivers the best experience for your users.

## Verify the integration

The **Doctor App** is a verification tool that comes with the HUMAN SDK. It simulates a typical user flow in your application and helps you ensure that the SDK is integrated correctly. When you enable it, the Doctor App displays a popup as part of the application flow to guide you on how to simulate a user flow.

The Doctor App includes assets that it uses for its own UI. These assets are only required for the Doctor App and aren't needed in your production build. To minimize the SDK's footprint, the SDK loads these assets dynamically at runtime.

### Load Doctor App assets

#### Android

The Doctor App loads these assets automatically whenever you run the App with an internet connection.

#### iOS

For iOS 14 and above, the Doctor App loads these assets automatically whenever you run the App with an internet connection. No further action is needed.

However, if you run the Doctor App on a simulator or on a real device with iOS 13 or earlier, you need to add the `HUMAN.bundle` file to your project. To add the file:

> **Warning**
>
> This `HUMAN.bundle` file must be removed from your project before you build and deploy your app to production.

1. Run the following command to download the file. Be sure to update the version number according to your SDK version:

**`Terminal`**

```bash title="Terminal"
curl -LO https://jfrog.humansecurity.com/artifactory/files/doctor-app-assets/ios/5.0/HUMAN.bundle.zip

```

2. Unzip the file and drag the `HUMAN.bundle` file to your project. Make sure you link it to the relevant targets.

### The Doctor App's Flow

1. Set the `HSDoctorAppPolicy/enabled` to `true` while initializing the SDK.

#### Android

```kotlin
import android.app.Application
import com.humansecurity.mobile_sdk.HumanSecurity
import com.humansecurity.mobile_sdk.main.policy.HSPolicy

class MainApplication: Application() {

    override fun onCreate() {
        super.onCreate()
        startHumanSDK()
    }

    private fun startHumanSDK() {
        try {
            val policy = HSPolicy()
            policy.doctorAppPolicy.enabled = true

            HumanSecurity.start(this, "<APP_ID>", policy)
        }
        catch (exception: Exception) {
            println("Exception: ${exception.message}")
        }
    }
}
```

```java
import android.app.Application;
import android.util.Log;
import com.humansecurity.mobile_sdk.HumanSecurity;
import com.humansecurity.mobile_sdk.main.policy.HSPolicy;

public class MainApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        startHumanSDK();
    }

    void startHumanSDK() {
        try {
            HSPolicy policy = new HSPolicy();
            policy.getDoctorAppPolicy().setEnabled(true);

            HumanSecurity.INSTANCE.start(this, "<APP_ID>", policy);
        }
        catch (Exception exception) {
            Log.e("MainApplication","Exception: " + exception.getMessage());
        }
    }
}
```

#### iOS, iPadOS, & visionOS

```swift
import HUMAN

class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        startHumanSDK()
        return true
    }

    func startHumanSDK() {
        do {
            let policy = HSPolicy()
            policy.doctorAppPolicy.enabled = true

            try HumanSecurity.start(appId: "<APP_ID>", policy: policy)
        }
        catch {
            print("Error: \(error)")
        }
    }
}
```

**`Objective-C`**

```c title="Objective-C"
@import HUMAN;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self startHumanSDK];
    return YES;
}

- (void)startHumanSDK {
    HSPolicy *policy = [[HSPolicy alloc] init];
    policy.doctorAppPolicy.enabled = YES;

    NSError *error = nil;
    [HumanSecurity startWithAppId:@"<APP_ID>" policy:policy error:&error];
    if (error != nil) {
        NSLog(@"Error: %@", error);
    }
}
```

2. Run your app. The Doctor App UI will appear. Depending on the platform, the Doctor App flow will vary.

> **Warning**
>
> Retrying blocked requests after the challenge is solved will not work while running the Doctor App. In this case, your request handler will receive a "challenge was solved" error.

#### Android & iOS

3. Select whether to start a new test or load the summary of a previous test if one exists.

![Welcome Screen](/_fern-files/_img/6e21acb418029d50c671340d05cc61cbe9ba2e448b597a39c1c3c23ae36013bc.webp)

4. Select which product to test:
   * Bot Defender
   * Account Defender

![Product Selection Screen](/_fern-files/_img/3766f04651b89a961c48694fde72ddcd73e5e987e051f57c27ff5b4a761c6a94.webp)

5. Review the detailed instructions on how to start a new test, what is expected, and steps to resolve issues.

![Instruction Screen](/_fern-files/_img/190ca9974ea522b33579ce01b22f1d67d9150d4523252ca397834e7e5817bbab.webp)

6. Choose between:

   1. **Native app framework:** To test native URL requests.
   2. **Web view framework:** To test web view URL requests.

![Test Selection Screen](/_fern-files/_img/fb9077bfcd57a48a23061dfe8de8c48fe790c04c989f4cf7b4f0639da9b6d727.webp)

7. Run the test by using your app according to the instructions.

8. Review the test results on the summary screen. Explore detailed insights for each test and get troubleshooting tips for failed tests.

![Summary Screen](/_fern-files/_img/80058e27ba45e23be1e161e19c56dc6db084f6324d3420f2a925826e1323cc91.webp)

9. Export the test result to a JSON string from the summary screen. Share it with the support team if needed.

10. Exit the Doctor App. Your app will also be terminated.

#### visionOS

3. Select which product to test, Bot Defender or Account Defender, and which test to perform:
   1. **Native app framework:** To test native URL requests.
   2. **Web view framework:** To test web view URL requests.

![Summary Screen](/_fern-files/_img/078761d85fd6647096c1cf831f7e28201cd09f00b32be38cc7f752873edd2d77.webp)

4. Run the test by using your app according to the instructions. The main view shows the current step of the test, while the panel on the right provides a summary of the integration test results.

![Test Screen](/_fern-files/_img/94f84de496a3e1b9c5050cae817baa2ad99c7ecc131d1ada130af2139723971f.webp)

### Clean up

1. Set `HSDoctorAppPolicy/enabled` to `false` after you finish validating the SDK integration.
2. If you're using the Doctor App on a simulator or on a real device with iOS 13 or earlier, remove the `HUMAN.bundle` file from your project.

## Test the integration

To test the SDK, you can simulate challenges on various screens and scenarios in your app.

> **Note**
>
> These tests are relevant for Bot Defender integrations only.

1. Open [Challenge Settings](https://console.humansecurity.com/botDefender/settings/challenge) in the HUMAN Console.
2. Select **Testing (Native Mobile)** tab.
3. Retrieve the VID of your device by using one of the following methods:
   * Using the **VID Extractor:**
     1. Click on **Find your VID**.
     2. Enter your device's public IP.
     3. Select the relevant session.
   * Using the SDK's API:
     1. Use the `HumanSecurity/vid(forAppId:)` function.
4. Enter the VID in the appropriate field in the Console.
5. Click on **Start Testing**.
6. In your app, trigger URL requests to your server to display a challenge. If a challenge doesn't appear:
   1. Move your app to the background
   2. Bring it back to the foreground after few seconds.
   3. Trigger URL requests to your server again.
7. Solve or cancel the challenge and verify how your app behaves.