As the use of Generative AI and LLMs in daily work has drastically increased, so has the creation of different prompting frameworks. You’ve likely come across many yourself, like Chain of Thought, Zero-Shot Prompting, or CRISPE, to name just a few.
The CRAFTING AI Prompts framework is made up of three parts, represented by the acronyms “CRAFT,” “ING,” and “AI.” This framework empowers users to employ Generative AI to create written and visual content while ensuring ethical and responsible use.
Today we’re looking at the first main concept of the CRAFTING AI Prompts framework—the Crafting phase.
Let’s see the CRAFT framework in action! Here’s a user story example, and the following test case generation.
The price for entering the “Fairy Elevator Ride” in QualityLand is based on age.
I require your assistance in generating test cases for the below user story:
[Insert user story]
EXAMPLE
### Register ###
Write in a formal and professional tone. Include appropriate jargon for software testers.
### Acting Role ###|
Act as a software tester with 10 years of experience.
### Format ###|
The table with test cases must include the following columns:
1. Test Case ID
2. Input value
3. Expected outcome, based on the requirements in Context
### Task ###
Generate test cases for the user story above using 3-value Boundary Value Analysis. Follow the below steps as specified:
Step 1: Identify each relevant boundary to determine the correct outcomes for a given user.
Step 2: Define 3 test situations at each boundary, where one value is exactly on the boundary, one value is directly above the boundary, and one value is directly below the boundary.
Step 3: Generate the table as specified in the Format section above.
The response shows that even though it was calculated and provided with a detailed explanation, upon revision, we see that there is an invalid test case, highlighted as 4. 4 is not a boundary value because it’s inside the range, not at the edges. It can be tested for general coverage but should not replace proper boundary testing (e.g., 2, 3, 17, 18).
Here, we can see that it's necessary to double-check the generated outputs, as they are not always 100% accurate. We must always validate our outputs or iterate our prompts.
Let’s take a look at this example prompt for generating test data:
- Generate test data for ordering tickets for the QualityLand amusement park.
- Variables to consider:
- Name
- Number of tickets
- Age(s) of visitor(s)
- Code of discount voucher (if applicable)
- Expected price for the tickets
You:
I want you to create test data for me. Please ask me questions to help you create a useful prompt for this task.
Copilot
Sure, I'd be happy to help you create test data! Here are a few questions to get us started:
1. What type of data are you looking to generate? (e.g., customer data, financial data, product data, etc.)
2. How many records do you need?
3. What specific fields or attributes should each record contain? (e.g. name, age, email, transaction amount etc.)
4. Are there any specific formats or constraints for the data? (e.g, date formats, numerical ranges, specific 1 patterns, etc.)
5. Do you need the data to follow any particular distribution or pattern? (e.g. normal distribution, random. sequential, etc.)
6. Are there any relationships or dependencies between the fields? (e.g, age should be consistent with birthdate, total price should be the sum of item prices, etc.)
7. Do you need any specific values or edge cases included? (e.g., null values, maximum/minimum values, special characters, etc.)
Feel free to provide as much detail as possible so I can create the most useful test data for you!
The next prompt:
You
1. it is about ordering tickets for the QualityLand Amusement park
2. 10 records
3. The data needs to contain the name of the customer, the number of tickets, the age(s) of visitor(s), code of discount voucher (if applicable, so not all records have a code).
4. name should be text only, number of tickets between 1 and 20, age between 0 and 117, code of discount voucher is 8 random characters including numbers and letters (no special characters)
5. no special pattern
6. the number of ages specified must meet the number of tickets ordered
7. no special values or edge cases (that will be a next exercise)
Please format the output in a table, with a column for every data item and a line for every record.
In this test data management example, we see that we also need to check the output and verify if it aligns with our requirements, as highlighted in the image. Parts of the output were not 100% accurate and needed to be further iterated. In the second installment of this guide, we will dive deeper into the iteration phase!
This first phase of the CRAFTING AI Prompts framework gives us the basis for receiving a quality response. We’ll soon continue with the Validation, or “ING” phase, to evaluate the prompts we’ve created. Stay tuned!
Edgar Rodriguez is a Senior QA Expert on the First Line Software team, and a Tech Titan in our Ambassador program. Edgar is active in several of our QA initiatives, and has shared his expertise at many of our meetups and on our SPAM JAM podcast.