Generate Tests Using Vision Nova

Generating functional test scenarios for the app screen using our AI based service Vision Nova, through publicly accessible image url using both SDKs and APIs.

Usage 🚀

Refer to Setup Guide for installing dependecies for both Java and Python.

JAVA

There are 2 clients available with the Java SDK: SyncClient and AsyncClient

chevron-rightJava Client Codehashtag
# for async client 
import org.qyrus.ai_sdk.Clients.AsyncClient;
AsyncClient client = new AsyncClient(<API_TOKEN>, null);

# for sync client
import org.qyrus.ai_sdk.Clients.SyncClient;
SyncClient client = new SyncClient(<API_TOKEN>, null);

Using SyncClient

Here's an example of utilizing Vision Nova via publicly accessible image url to generate test scenarios with SyncClient.

chevron-rightJava SyncClient Codehashtag
private static void createTestVisionNovaScenarios(){

        Dotenv dotenv = Dotenv.load();
        String QYRUS_AI_SDK_API_TOKEN = dotenv.get("QYRUS_AI_SDK_API_TOKEN");

        SyncClient client = new SyncClient(QYRUS_AI_SDK_API_TOKEN, null);
        String image_url = <IMAGE_URL>;

        long startTime = System.currentTimeMillis();
        int numberOfRequests = 2;

        for (int i = 0; i < numberOfRequests; i++) {
            try {
                VisionNovaFunctionalTests.CreateScenariosResponse response = client.vision_nova.functional_tests.create(image_url);
                System.out.println("Creation Status: " + response.isOk());
                System.out.println("Creation Status: " + response.getMessage());
        
                //Show all the scenarios generated
                if (response != null && response.isOk() == true && response.getScenarios() != null) {
                    System.out.println("Creation Status: " + response.getVisionNovaRequestId());

                    List<VisionNovaFunctionalTests.Scenario> scenarios = response.getScenarios();

                    // Loop over the list and print out scenarios
                    for (VisionNovaFunctionalTests.Scenario scenario : scenarios) {
                        System.out.println("Scenario Name: " + scenario.getScenarioName());
                        System.out.println("Scenario Objective: " + scenario.getScenarioObjective());
                        System.out.println("Scenario Description: " + scenario.getScenarioDescription());
                        System.out.println("Scenario Steps: " + scenario.getSteps());
                        
                        System.out.println("--------------------------------------");
                    }

                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        long endTime = System.currentTimeMillis();
        System.out.println("Synchronous total time for Vision Nova functional tests" + numberOfRequests + " requests: " + (endTime - startTime) + " ms");
    }

Using AsyncClient

Here's an example of utilizing Vision Nova via the publicly accessible image url to generate test scenarios with AsyncClient.

chevron-rightJava AsyncClient Codehashtag

PYTHON

There are two clients available with the Python SDK: SyncQyrusAI and AsyncQyrusAI.

chevron-rightPython Client Codehashtag

Using SyncQyrusAI

Here's an example of utilizing Vision Nova via the publicly accessible image url to generate test scenarios with SyncQyrusAI.

chevron-rightPython SyncQyrusAI Codehashtag

Using AsyncQyrusAI

Here's an example of utilizing Vision Nova via the publicly accessible image url to generate test scenarios with AsyncQyrusAI.

chevron-rightPython AsyncQyrusAI Codehashtag

Rest APIs

  • Endpoint: POST {{GATEWAY_URL}}/vision-nova-sdk/v1/api/json-create-tests

  • Headers:

    • Authorization: [Your Authorization Token]

    • Custom: [Your Custom Header Value]

  • Request Body: { "image_url": "publicly accessible image url" }

  • Response:

Last updated