From 5a32b95587e5c987e9c93d6969f83b11c044f206 Mon Sep 17 00:00:00 2001 From: Iurii Zaitsev Date: Sat, 7 Sep 2024 22:52:29 +0200 Subject: [PATCH 1/3] Modification prompt update --- .../research/testspark/core/generation/llm/Utils.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt b/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt index 1942a6a86..16933c294 100644 --- a/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt +++ b/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt @@ -82,7 +82,13 @@ fun executeTestCaseModificationRequest( errorMonitor: ErrorMonitor = DefaultErrorMonitor(), ): TestSuiteGeneratedByLLM? { // Update Token information - val prompt = "For this test:\n ```\n $testCase\n ```\nPerform the following task: $task" + val prompt = buildString { + append("For this test:\n ```\n ") + append(testCase) + append("\n```\nYou are allowed to generate only 1 test method. Do not change class and method names.") + append("\nPerform the following task:\n") + append(task) + } val packageName = getPackageFromTestSuiteCode(testCase, language) From b43d2acf22d46c0c70986cdc8ee54d7913d861ee Mon Sep 17 00:00:00 2001 From: Iurii Zaitsev Date: Sat, 7 Sep 2024 23:14:29 +0200 Subject: [PATCH 2/3] style changes --- .../research/testspark/core/generation/llm/Utils.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt b/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt index 16933c294..375080cb1 100644 --- a/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt +++ b/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt @@ -83,12 +83,12 @@ fun executeTestCaseModificationRequest( ): TestSuiteGeneratedByLLM? { // Update Token information val prompt = buildString { - append("For this test:\n ```\n ") - append(testCase) - append("\n```\nYou are allowed to generate only 1 test method. Do not change class and method names.") - append("\nPerform the following task:\n") - append(task) - } + append("For this test:\n ```\n ") + append(testCase) + append("\n```\nYou are allowed to generate only 1 test method. Do not change class and method names.") + append("\nPerform the following task:\n") + append(task) + } val packageName = getPackageFromTestSuiteCode(testCase, language) From f561b264b5401ae25327f7b72869927a61283a4b Mon Sep 17 00:00:00 2001 From: Iurii Zaitsev Date: Thu, 26 Sep 2024 20:51:28 +0200 Subject: [PATCH 3/3] minor prompt improvement --- .../jetbrains/research/testspark/core/generation/llm/Utils.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt b/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt index 375080cb1..4cf5956bf 100644 --- a/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt +++ b/core/src/main/kotlin/org/jetbrains/research/testspark/core/generation/llm/Utils.kt @@ -85,7 +85,7 @@ fun executeTestCaseModificationRequest( val prompt = buildString { append("For this test:\n ```\n ") append(testCase) - append("\n```\nYou are allowed to generate only 1 test method. Do not change class and method names.") + append("\n```\nGenerate a SINGLE test method. Do not change class and method names.") append("\nPerform the following task:\n") append(task) }