When working with software requirements or testing documents in a CSV format, crafting detailed queries or instructions using prompt engineering becomes crucial. These documents often have structured data (e.g., requirements, test cases, priorities) that require targeted processing, such as extracting specific information, analyzing gaps, or generating additional data like test scenarios.
In this blog, we’ll explore how to write detailed queries and instructions to process software requirements or testing documents stored in CSV format using prompt engineering.
Understanding the CSV Structure
Before writing prompts, it’s essential to understand the structure of the CSV file. Here’s an example of how software requirements or testing data might look in a CSV:
Example CSV Data: requirements.csv
ID,Requirement,Type,Priority,Status
1,Users must be able to register and log in using their email and password,Functional,High,Approved
2,Search functionality must return relevant results within 2 seconds,Functional,Medium,Pending
3,The platform must handle 500 concurrent users,Non-Functional,High,Approved
4,Payment processing must support credit cards and PayPal securely,Functional,High,Approved
5,Daily backups of all data must be performed automatically,Non-Functional,Medium,Pending
In this structure:
- ID: Unique identifier for each requirement.
- Requirement: The actual description of the requirement.
- Type: Whether it’s a functional or non-functional requirement.
- Priority: Priority level (High, Medium, Low).
- Status: Current status of the requirement (e.g., Approved, Pending).
Step-by-Step Guide for Writing Queries
Step 1: Define the Task
Clearly specify the goal of your query. Examples include:
- Extracting requirements based on specific criteria (e.g., type, priority, status).
- Generating test cases for functional requirements.
- Analyzing requirements for missing details or ambiguities.
- Summarizing the document for a quick overview.
Step 2: Include the Relevant CSV Data
Provide a subset of the CSV data in your prompt to help the AI understand the structure and context. If the CSV is large, include only a few rows as examples.
Example CSV Excerpt for Prompt:
Here is a sample of the software requirements document in CSV format:
ID,Requirement,Type,Priority,Status
1,Users must be able to register and log in using their email and password,Functional,High,Approved
2,Search functionality must return relevant results within 2 seconds,Functional,Medium,Pending
3,The platform must handle 500 concurrent users,Non-Functional,High,Approved
4,Payment processing must support credit cards and PayPal securely,Functional,High,Approved
5,Daily backups of all data must be performed automatically,Non-Functional,Medium,Pending
Step 3: Write a Detailed Query or Instruction
1. Extracting Specific Requirements
If you want to filter the requirements based on certain conditions (e.g., "High Priority" functional requirements), write the query like this:
Prompt:
Here is a sample of the software requirements document in CSV format:
ID,Requirement,Type,Priority,Status
1,Users must be able to register and log in using their email and password,Functional,High,Approved
2,Search functionality must return relevant results within 2 seconds,Functional,Medium,Pending
3,The platform must handle 500 concurrent users,Non-Functional,High,Approved
4,Payment processing must support credit cards and PayPal securely,Functional,High,Approved
5,Daily backups of all data must be performed automatically,Non-Functional,Medium,Pending
Query: Extract all "High Priority" functional requirements. Return them as a numbered list.
Expected Output:
1. Users must be able to register and log in using their email and password.
2. Payment processing must support credit cards and PayPal securely.
2. Generating Test Scenarios
To generate test cases for functional requirements, include an instruction for the AI to create test scenarios:
Prompt:
Here is a sample of the software requirements document in CSV format:
ID,Requirement,Type,Priority,Status
1,Users must be able to register and log in using their email and password,Functional,High,Approved
2,Search functionality must return relevant results within 2 seconds,Functional,Medium,Pending
3,The platform must handle 500 concurrent users,Non-Functional,High,Approved
4,Payment processing must support credit cards and PayPal securely,Functional,High,Approved
Query: Generate 2 test scenarios for each functional requirement. Return them as a list.
Expected Output:
1. Test Case for Requirement 1:
a. Verify that the user can register with a valid email and password.
b. Verify that the user cannot register with an invalid email format.
2. Test Case for Requirement 2:
a. Verify that searching for a keyword returns relevant results.
b. Verify that searching by category displays all matching results.
3. Test Case for Requirement 4:
a. Verify that payment can be processed securely via credit card.
b. Verify that payment can be processed securely via PayPal.
3. Summarizing Requirements
Sometimes, you may need a quick summary of all requirements.
Prompt:
Here is a sample of the software requirements document in CSV format:
ID,Requirement,Type,Priority,Status
1,Users must be able to register and log in using their email and password,Functional,High,Approved
2,Search functionality must return relevant results within 2 seconds,Functional,Medium,Pending
3,The platform must handle 500 concurrent users,Non-Functional,High,Approved
4,Payment processing must support credit cards and PayPal securely,Functional,High,Approved
5,Daily backups of all data must be performed automatically,Non-Functional,Medium,Pending
Query: Summarize the requirements by their type (Functional vs Non-Functional).
Expected Output:
Functional Requirements:
1. Users must be able to register and log in using their email and password.
2. Search functionality must return relevant results within 2 seconds.
3. Payment processing must support credit cards and PayPal securely.
Non-Functional Requirements:
1. The platform must handle 500 concurrent users.
2. Daily backups of all data must be performed automatically.
4. Analyzing for Missing Details
To identify missing or incomplete requirements:
Prompt:
Here is a sample of the software requirements document in CSV format:
ID,Requirement,Type,Priority,Status
1,Users must be able to register and log in using their email and password,Functional,High,Approved
2,Search functionality must return relevant results within 2 seconds,Functional,Medium,Pending
3,The platform must handle 500 concurrent users,Non-Functional,High,Approved
4,Payment processing must support credit cards and PayPal securely,Functional,High,Approved
Query: Analyze the requirements and identify any missing or incomplete details. Suggest improvements to make the requirements more comprehensive.
Expected Output:
1. Requirement 1: Add details about password complexity requirements (e.g., minimum length, special characters).
2. Requirement 2: Specify how relevance will be determined for search results (e.g., ranking algorithm).
3. Requirement 3: Include performance benchmarks for the 500 concurrent users (e.g., response time under load).
Step 4: Define the Output Format
Clearly specify the format for the output, such as lists, JSON, or plain text.
Example: JSON Format
Query: Extract all "High Priority" requirements and return them in JSON format.
Expected Output:
{
"High Priority Requirements": [
{"ID": 1, "Requirement": "Users must be able to register and log in using their email and password", "Type": "Functional", "Status": "Approved"},
{"ID": 3, "Requirement": "The platform must handle 500 concurrent users", "Type": "Non-Functional", "Status": "Approved"},
{"ID": 4, "Requirement": "Payment processing must support credit cards and PayPal securely", "Type": "Functional", "Status": "Approved"}
]
}
Tips for Writing Effective Prompts
- Be Specific:
- Use clear and concise instructions, such as "Extract all high-priority functional requirements."
- Provide Context:
- Include a sample of the CSV data to help the AI understand the structure.
- Break Down Complex Tasks:
- For tasks like generating test cases, split the query into multiple steps if needed.
- Define Output Format:
- Specify whether you want the output as plain text, a list, or JSON.
- Iterate and Refine:
- Test your prompts with different queries and refine them to improve accuracy.
Conclusion
Using prompts to process software requirements or testing documents in CSV format requires a clear understanding of the data structure and the task at hand. By following the steps outlined above, you can:
- Extract relevant information.
- Generate test cases.
- Analyze requirements for gaps.
- Summarize large documents.
With practice, you’ll be able to write detailed and effective queries that leverage the full power of Generative AI to streamline your software development and testing workflows. 🚀
Comments