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")
    }
}

Last updated