Skip to content

Commit

Permalink
Merge pull request #3 from ljylun/features/improve_prompt
Browse files Browse the repository at this point in the history
Update CodeGenerationService.java for improve prompt
  • Loading branch information
Angular2Guy authored Nov 19, 2024
2 parents 6c68ffd + 7a4b0ab commit e3a3787
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ public class CodeGenerationService {
Analyse the classes provided and generate tests for all methods. Base your tests on the example.
Generate and implement the test methods. Generate and implement complete tests methods.
Generate the complete source of the test class.
Your additional guidelines:
1.Implement the AAA Pattern: Implement the Arrange-Act-Assert (AAA) paradigm in each test, establishing necessary preconditions and inputs (Arrange), executing the object or method under test (Act), and asserting the results against the expected outcomes (Assert).
2.Test the Happy Path and Failure Modes: Your tests should not only confirm that the code works under expected conditions (the 'happy path') but also how it behaves in failure modes.
3.Testing Edge Cases: Go beyond testing the expected use cases and ensure edge cases are also tested to catch potential bugs that might not be apparent in regular use.
4.Avoid Logic in Tests: Strive for simplicity in your tests, steering clear of logic such as loops and conditionals, as these can signal excessive test complexity.
5.Leverage TypeScript's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
6.Handle Asynchronous Code Effectively: If your test cases involve promises and asynchronous operations, ensure they are handled correctly.
7.Write Complete Test Cases: Avoid writing test cases as mere examples or code skeletons. You have to write a complete set of tests. They should effectively validate the functionality under test.
Generate tests for this class:
{classToTest}
Expand All @@ -56,7 +65,17 @@ public class CodeGenerationService {
4. Generate a test class for the source class and use the context classes as sources for creating the test class.
5. Use the code of the test class as test example.
6. Generate tests for each of the public methods of the source class.
Generate the complete source code of the test class implementing the tests.
Your additional guidelines:
1.Implement the AAA Pattern: Implement the Arrange-Act-Assert (AAA) paradigm in each test, establishing necessary preconditions and inputs (Arrange), executing the object or method under test (Act), and asserting the results against the expected outcomes (Assert).
2.Test the Happy Path and Failure Modes: Your tests should not only confirm that the code works under expected conditions (the 'happy path') but also how it behaves in failure modes.
3.Testing Edge Cases: Go beyond testing the expected use cases and ensure edge cases are also tested to catch potential bugs that might not be apparent in regular use.
4.Avoid Logic in Tests: Strive for simplicity in your tests, steering clear of logic such as loops and conditionals, as these can signal excessive test complexity.
5.Leverage TypeScript's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
6.Handle Asynchronous Code Effectively: If your test cases involve promises and asynchronous operations, ensure they are handled correctly.
7.Write Complete Test Cases: Avoid writing test cases as mere examples or code skeletons. You have to write a complete set of tests. They should effectively validate the functionality under test.
Generate the complete source code of the test class implementing the tests.
{testExample}
Expand Down

0 comments on commit e3a3787

Please sign in to comment.