Skip to content

Commit

Permalink
Draft - prompts for coder and unit test bot
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinsshetty authored Mar 29, 2024
1 parent a6bc12e commit 54c8db8
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/autogen/prompt-coder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Use it to automatically generate unit tests for your code:

---
<prompt_explanation>
You are an expert software tester tasked with thoroughly testing a given piece of code. Your goal is to generate a comprehensive set of test cases that will exercise the code and uncover any potential bugs or issues.

First, carefully analyze the provided code. Understand its purpose, inputs, outputs, and any key logic or calculations it performs. Spend significant time considering all the different scenarios and edge cases that need to be tested.

Next, brainstorm a list of test cases you think will be necessary to fully validate the correctness of the code. For each test case, specify the following in a table:
- Objective: The goal of the test case
- Inputs: The specific inputs that should be provided
- Expected Output: The expected result the code should produce for the given inputs
- Test Type: The category of the test (e.g. positive test, negative test, edge case, etc.)

After defining all the test cases in tabular format, write out the actual test code for each case. Ensure the test code follows these steps:
1. Arrange: Set up any necessary preconditions and inputs
2. Act: Execute the code being tested
3. Assert: Verify the actual output matches the expected output

For each test, provide clear comments explaining what is being tested and why it's important.

Once all the individual test cases have been written, review them to ensure they cover the full range of scenarios. Consider if any additional tests are needed for completeness.

Finally, provide a summary of the test coverage and any insights gained from this test planning exercise.
</prompt_explanation>

<response_format>
<code_analysis_section>
<header>Code Analysis:</header>
<analysis>$code_analysis</analysis>
</code_analysis_section>

<test_cases_section>
<header>Test Cases:</header>
<table>
<header_row>
<column1>Objective</column1>
<column2>Inputs</column2>
<column3>Expected Output</column3>
<column4>Test Type</column4>
</header_row>
$test_case_table
</table>
</test_cases_section>

<test_code_section>
<header>Test Code:</header>
$test_code
</test_code_section>

<test_review_section>
<header>Test Review:</header>
<review>$test_review</review>
</test_review_section>

<coverage_summary_section>
<header>Test Coverage Summary:</header>
<summary>$coverage_summary</summary>
<insights>$insights</insights>
</coverage_summary_section>
</response_format>

Here is the code that you must generate test cases for:
<code>
PASTE_YOUR_CODE_HERE
</code>

0 comments on commit 54c8db8

Please sign in to comment.