Performance

Caching

To optimize execution time, you can use our caching mechanism. This way, AI is only required when changes are made to the test definition or the app, reducing unnecessary consumption for repetitive executions.

The SDK supports 3 caching modes:

  • NONE - No caching will be used

  • FULL_SCREEN - We only take an action from cache if the full screen matches previous successful executions

  • INTERACTION_REGION - We take an action from cache if the interaction region from a previous successful execution matches (e.g. the area of where we tapped on an element).

You can set those caching modes on a global level in the GPT Driver constructor, and/or overwrite the caching mode per step.

Setting caching mode in the GPT Driver constructor:

new GptDriver({
    apiKey: browser.options.gptDriverApiKey,
    cachingMode: "FULL_SCREEN",
    ...
});

Overwriting caching mode per step

await gptDriver.aiExecute({
    "prompt": "Add product to cart",
    "cachingMode": "INTERACTION_REGION"
})

AI as fallback

For those proficient in writing Appium scripts, you can directly input the Appium code into the aiExecute method. Initially, we'll attempt to run the Appium code. If execution results in an exception, likely due to broken locators, we'll revert to AI for completion.

await gptDriver.aiExecute({
    "prompt": "Enter todo title: " + TEST_TODO.title,
    "appiumHandler": async () => {
        const input = await $('~add-todo-input');
        await input.setValue(TEST_TODO.title);
    }
})

Last updated