Skip to content

Commit e3a3787

Browse files
authored
Merge pull request #3 from ljylun/features/improve_prompt
Update CodeGenerationService.java for improve prompt
2 parents 6c68ffd + 7a4b0ab commit e3a3787

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

backend/src/main/java/ch/xxx/aidoclibchat/usecase/service/CodeGenerationService.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ public class CodeGenerationService {
3939
Analyse the classes provided and generate tests for all methods. Base your tests on the example.
4040
Generate and implement the test methods. Generate and implement complete tests methods.
4141
Generate the complete source of the test class.
42+
43+
Your additional guidelines:
44+
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).
45+
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.
46+
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.
47+
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.
48+
5.Leverage TypeScript's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
49+
6.Handle Asynchronous Code Effectively: If your test cases involve promises and asynchronous operations, ensure they are handled correctly.
50+
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.
4251
4352
Generate tests for this class:
4453
{classToTest}
@@ -56,7 +65,17 @@ public class CodeGenerationService {
5665
4. Generate a test class for the source class and use the context classes as sources for creating the test class.
5766
5. Use the code of the test class as test example.
5867
6. Generate tests for each of the public methods of the source class.
59-
Generate the complete source code of the test class implementing the tests.
68+
69+
Your additional guidelines:
70+
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).
71+
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.
72+
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.
73+
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.
74+
5.Leverage TypeScript's Type System: Leverage static typing to catch potential bugs before they occur, potentially reducing the number of tests needed.
75+
6.Handle Asynchronous Code Effectively: If your test cases involve promises and asynchronous operations, ensure they are handled correctly.
76+
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.
77+
78+
Generate the complete source code of the test class implementing the tests.
6079
6180
{testExample}
6281

0 commit comments

Comments
 (0)