AiTester¶
Overview¶
AiTester enables AI-powered capabilities during test case execution. With AiTester, you can send text and image-augmented queries to AI models, allowing your tests to leverage generative AI for tasks that would be difficult or impossible with traditional automation approaches.
AiTester enhances the testing process by introducing advanced visual testing capabilities, simulating the keen observational skills of a manual tester. This feature enables automated detection of visual discrepancies, such as layout shifts, missing elements, or subtle changes in design, that traditional functional tests might overlook.
Key Capabilities¶
- Generate Data: Create test data on-the-fly using AI prompts
- Image-Based Verifications: Detect visual discrepancies, count UI elements, compare screenshots
- OCR: Extract text from images and screenshots
- AI-Based Assertions: Validate application state using natural language assertions
- Question Answering: Ask questions about the current application state
Supported AI Providers¶
AiTester works with all AI providers configured in the AI Dashboard:
Installation¶
Rapise 9.1+
Starting from Rapise 9.1, AiTester is included in Rapise by default. You can use it directly without importing any modules.
For earlier versions of Rapise, AiTester is available as a public page object that you can import into your framework:
- Right-click Modules/Pages in the Object Tree
- Select Import Public Page Object > AiTester
- AiTester will appear in your Modules/Pages folder
Configuration¶
Before using AiTester, configure your AI provider connection in the AI Dashboard Settings.
Usage Examples¶
Compare Images¶
Use AI to identify differences between two images:
var img1 = Navigator.DoScreenshot();
// ... perform some action ...
var img2 = Navigator.DoScreenshot();
AiTester.DoImageQuery("Compare these two images and list the differences", img1);
Generate Random Data¶
Generate test data using AI:
var result = AiTester.DoTextQuery("Generate a random US phone number in format (XXX) XXX-XXXX");
Tester.Message("Generated phone: " + result);
Count UI Elements¶
Count elements visible on screen:
AiTester.DoWebImageQuery("How many rows are visible in the data grid?");
Assess Application State¶
Verify the application is in an expected state:
AiTester.DoWebImageQuery("Is the login form displayed? Answer yes or no.");
AiTester.AssertLastResponse("yes");
Perform OCR¶
Extract text from an image:
var screenshot = Navigator.DoScreenshot();
AiTester.DoImageQuery("Extract all text visible in this image", screenshot);
Visual Comparison with Assertions¶
Compare screenshots and assert no significant changes:
AiTester.StackWebImage(); // Before action
// ... perform action ...
AiTester.StackWebImage(); // After action
AiTester.DoMultiImageQuery("Compare these screenshots. Are there any unexpected visual changes?");
AiTester.SoftAssertLastResponse("no unexpected changes");
API Reference¶
For the complete API reference, see AiTester.
Best Practices¶
- Be Specific: Write clear, specific prompts for better AI responses
- Use Assertions: Combine AI queries with assertions to create verifiable test steps
- Manage Token Usage: AI calls consume tokens; use them judiciously in large test suites
- Set Appropriate Workflows: Different workflows are optimized for different tasks (chat, code generation, data generation)
- Review AI Responses: AI responses may vary; design tests that tolerate reasonable variations
Video Tutorial¶
Watch the AiTester demo on YouTube to see these capabilities in action.