AI and Prompt Engineering

AI and Prompt Engineering

Generative AI can help speed up test creation by allowing you to describe what you want to test using natural language. Instead of defining every individual action yourself, you can provide testRigor with instructions describing your application and the tasks you want the AI to perform.

These instructions are called prompts. A prompt provides the AI with information about what you want it to accomplish. The clearer and more relevant the information in your prompt is, the better the AI can understand your application and generate appropriate tests.

One of the most important prompts is the description of the application being tested. This gives the AI context about what the application does, what features are available, and how users are expected to interact with it. The application description can be provided when creating a test suite or added later under Settings->Test generation->AI-based Test Generation.

Writing Effective Application Descriptions

Poor description for a banking app:
This is a banking app. It does the stuff a banking app usually does, but this bank is the best. Please be smart and make test cases based on the information that only I know about my application.
Good description for a banking app:
This is a desktop banking application. Users must log in before performing transactions. Users can view account balances and transaction history, transfer funds between accounts, pay bills, and access financial statements. Users can also apply for loans, view their loan status, and use financial calculators.

Providing Workflows for AI Test Generation

In addition to describing the application, you can provide the AI with workflows that describe what you want a user to accomplish. For example, a workflow for the banking application could be:
Transfer money from a checking account to a savings account and verify that the updated balance is displayed.

testRigor can suggest workflows automatically, but providing workflows that are specific to your application gives the AI more context about the scenarios you want to test. These instructions can be provided through test case descriptions or through smaller reusable instructions called AI-based rules, which we will cover later.

Generating Tests with AI

When creating tests with AI, testRigor provides two options:
Generate a sample test with AI: Generates a suggested sequence of testRigor steps based on your description. You can review and modify these steps before using them in your test.
Generate an actual test with AI: Allows testRigor to interact with your application and generate a test based on the application and the goal you provided.

In both cases, you begin by providing a title or description of what you want to test. After the test is generated, you can modify values, add assertions, or adjust the generated steps to better match your testing requirements.

Watch the video tutorial for a detailed walkthrough of AI-based test generation.

AI-based Rules

AI-based rules allow you to give testRigor a task using natural language without defining every step needed to complete it. For example:
find and select a Kindle
testRigor uses AI to interpret the instruction and determine the actions needed to complete the task.
If the AI doesn’t behave as expected, there are two ways to address it:
  • Prompt Engineering
  • Fixing the steps yourself manually

Prompt Engineering

The name of an AI-based rule acts as a prompt that tells the AI what to accomplish. Providing a clearer goal or additional context can help the AI better understand your intention.
find a Kindle
The AI might search for “Kindle” in the search bar and stop when it sees many Kindle options because it considers the product successfully found.
If you actually want it to select a product, you can make the goal clearer:
find and select a Kindle

Fixing the Steps

If you need more control, you can deselect the AI checkbox for the rule to view and modify its underlying testRigor steps yourself.

For example, you could explicitly add:
click "Kindle Paperwhite"

The rule will then follow your specified steps instead of relying on AI to determine the actions.

When to use Prompt Engineering vs. Fixing the Steps

AI-based rules are useful when you care about the outcome, but not the exact steps used to achieve it. For example, find and select a Kindle allows the AI to determine how to search for and select the product without requiring you to define every action.

The trade-off is that AI-based operations may be slower and can occasionally interpret your instructions differently than intended. If this happens, you can improve the prompt by providing a clearer goal or additional context.

If you need to verify that a feature follows a specific sequence of actions, explicit testRigor steps are a better choice. This gives you precise control over the test and ensures it fails if the expected behavior is not followed.

AI-based rules and standard testRigor steps can also be used together. For example, if you simply want to select any Kindle from a list of products, you could add choose a specific Kindle .
click "Search"
type "Kindle" into "Search"
press enter
choose a specific Kindle
click "Add to Cart"

The AI can determine which product to select without requiring you to identify a specific element or define the exact steps.

As a general rule, use AI when the outcome matters more than how it is achieved. Use explicit steps when the specific behavior or sequence of actions is what you want to test.

Watch the video tutorial here:

AI-Based Corner Case Generation

There is an ability to automatically generate corner cases for any given test case.
Corner case test: An unusual or less common scenario that may reveal issues not covered by the original test case. testRigor can automatically generate corner cases based on an existing test.
The cases generated will skip actions that enter/type data into fields one by one and find the errors associated with the step that has been skipped.
For example, if a test fills out several fields in a form, testRigor can generate variations that skip individual input steps and check whether the application handles the missing information correctly.
To generate these cases, click Generate corner cases in the information bar of a test case, located to the left of Link data set.
Generated corner cases are labeled accordingly and cannot be used to generate additional corner cases.
There is no way to do it with AI.
I want a TV, Samsung 80″, please!
find and select an 80″ Samsung TV
checkout 80″ Samsung TV
Regular test cases depend on the accuracy of steps in the test case editor and rules while generative AI relies on the clear description of the prompts it is given to work with.
AI-generated test cases cannot be edited.
AI-generated test cases have more assertions than the manually created ones.
AI-generated test cases are shorter and less comprehensive.
To automate QA testers out of their jobs.
To speed up initial test creation.
They only focus on the most critical parts of an application.
They are always 100% accurate in identifying bugs.