-
Notifications
You must be signed in to change notification settings - Fork 0
0.07_LLM_test_suite
Giuliano Ranauro edited this page Dec 3, 2024
·
1 revision
Given the class TeamTest, we want to automatically generate a JUnit test suite that completely covers the methods from the class.
- Open
Team.javain IntelliJ - Open Copilot chat from the sidebar
- Entering the following prompt:
scrivi una test suite con coverage 100% di team - The answer from the LLM is the following:
- We then proceed to copy the code into
TeamTest.java. - Execute JUnit test with coverage; the result is
| Class | Method | Line | Branch |
|---|---|---|---|
| 100% | 94% | 91% | 56% |
- Since Branch coverage is not that good, we then proceed to enter a second prompt:
il branch coverage è basso, sopratutto nel metodo equals(), alcuni branch non sono coperti. aggiungi dei casi di test per alzare la copertura sui branch. - The output is the following:
- I test vengono eseguiti nuovamente con coverage, ed il risultato è il seguente:
| Class | Method | Line | Branch |
|---|---|---|---|
| 100% | 94% | 97% | 100% |
- Ora il coverage è soddisfacente.