GPT Driver User Guide
GPT Driver SDK
GPT Driver SDK
  • 👋Welcome
  • Overview
    • 💡Why GPTD
    • SDKs
      • Prerequisites
      • Python
        • Setup
        • Examples
        • Reference
      • Typescript
        • Setup
        • Examples
        • Reference
      • Java
        • Setup
        • Examples
          • GPT Driver + TestNG
          • GPTD + Lambdatest
          • GPTD + SauceLabs
          • GPT Driver + BrowserStack
        • Reference
        • Use within Android
      • Android Native (Java/Kotlin)
        • Setup
        • Example
        • Reference
      • Swift
        • Setup
        • Usage
Powered by GitBook
On this page
  • Inside the test file
  • Simple test example:
  1. Overview
  2. SDKs
  3. Android Native (Java/Kotlin)

Example

Inside the test file

  1. Import necessary dependencies

import io.mobileboost.gptdriver_lib.GptDriver
  1. Create the GPT Driver instance and start the session

val sdkInstance = GptDriver("<api_key>")
  1. Use execute method to perform AI-driven steps:

sdkInstance.execute("Tap on the home button and verify it leads to the main screen")

Simple test example:

import androidx.test.ext.junit.rules.ActivityScenarioRule
import io.mobileboost.gptdriver_lib.GptDriver

import org.junit.Before
import org.junit.Rule
import org.junit.Test


class TestWithGptDriverAndroidLib {

    @get:Rule
    val activityRule = ActivityScenarioRule(MainActivity::class.java)

    private lateinit var sdkInstance: GptDriver

    @Before
    fun setUp() {
        sdkInstance = GptDriver("<api_key>")
    }

    @Test
    fun basicNavigationTest() {

        sdkInstance.execute("Log into the app with credentials: username=test, password=test")
        sdkInstance.assertCondition("You are on the home screen")
        
        sdkInstance.setSessionStatus("success")
    }
}
PreviousSetupNextReference

Last updated 3 months ago