Skip to content

Commit 79ac685

Browse files
committed
added oracles
1 parent ac66298 commit 79ac685

File tree

91 files changed

+1222
-278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1222
-278
lines changed

lasso/src/components/SSN/templates.tsx

Lines changed: 163 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -123,29 +123,11 @@ study(name: 'GenChatGPT') {
123123
}
124124
}
125125
126-
action(name: 'generateTestsGpt', type: 'GenerateTestsOpenAI') {
127-
// pipeline specific
128-
dependsOn 'generateCodeGpt'
129-
include '*'
130-
profile('java17Profile')
131-
132-
// action configuration block
133-
apiKey = "demo" // see https://docs.langchain4j.dev/integrations/language-models/open-ai/
134-
model = "gpt-4o-mini"
135-
samples = {{SAMPLES}}
136-
137-
prompt { stimulusMatrix ->
138-
def prompt = [:] // create prompt model
139-
prompt.promptContent = """generate a junit test class to test the functionality of the following interface specification: \`\`\`\${stimulusMatrix.lql}\`\`\`. Assume that the specification is encapsulated in a class that uses the same naming as in the interface specification. Only output the JUnit test class and nothing else."""
140-
prompt.id = "lql_prompt"
141-
return [prompt] // list of prompts is expected
142-
}
143-
}
144-
145126
action(name: 'execute', type: 'Arena') {
146127
maxAdaptations = 1 // how many adaptations to try
128+
features = ['cc']
147129
148-
dependsOn 'generateTestsGpt'
130+
dependsOn 'generateCodeGpt'
149131
include '*'
150132
profile('java17Profile')
151133
}
@@ -210,6 +192,7 @@ study(name: 'GenChatGPT') {
210192
211193
action(name: 'execute', type: 'Arena') {
212194
maxAdaptations = 1 // how many adaptations to try
195+
features = ['cc']
213196
214197
dependsOn 'generateTestsGpt'
215198
include '*'
@@ -258,6 +241,7 @@ study(name: 'GenOllama') {
258241
259242
action(name: 'execute', type: 'Arena') {
260243
maxAdaptations = 1 // how many adaptations to try
244+
features = ['cc']
261245
262246
dependsOn 'generateCodeLlama'
263247
include '*'
@@ -325,13 +309,149 @@ study(name: 'GenOllama') {
325309
326310
action(name: 'execute', type: 'Arena') {
327311
maxAdaptations = 1 // how many adaptations to try
312+
features = ['cc']
328313
329314
dependsOn 'generateTestsLlama'
330315
include '*'
331316
profile('java17Profile')
332317
}
333318
}`
334319

320+
const ChatGPTEvoSuite = `dataSource 'lasso_quickstart'
321+
study(name: 'EvoSuiteGenChatGPT') {
322+
323+
// target profile
324+
profile('java17Profile') {
325+
scope('class') { type = 'class' }
326+
environment('java17') {
327+
image = 'maven:3.9-eclipse-temurin-17'
328+
}
329+
}
330+
331+
// profile for EvoSuite
332+
profile('java11Profile') {
333+
scope('class') { type = 'class' }
334+
environment('java17') {
335+
image = 'maven:3.6.3-openjdk-11' // EvoSuite won't run in > JDK 11
336+
}
337+
}
338+
339+
action(name: 'createStimulusMatrix') {
340+
execute {
341+
stimulusMatrix('myAb', """{{INTERFACE}}""", [/*impls*/], {{TESTS}})
342+
}
343+
}
344+
345+
action(name: 'generateCodeGpt', type: 'GenerateCodeOpenAI') {
346+
// pipeline specific
347+
dependsOn 'createStimulusMatrix'
348+
include '*'
349+
profile('java17Profile')
350+
javaVersion = "11" // because of EvoSuite ..
351+
352+
// action configuration block
353+
apiKey = "demo" // see https://docs.langchain4j.dev/integrations/language-models/open-ai/
354+
model = "gpt-4o-mini"
355+
samples = {{CODE_SAMPLES}}
356+
357+
// custom DSL command offered by the action (for each stimulus matrix, create one prompt to obtain impls)
358+
prompt { stimulusMatrix ->
359+
// can by for any prompts: FA, impls, models etc.
360+
def prompt = [:] // create prompt model
361+
prompt.promptContent = """implement a java class with the following interface specification, but do not inherit a java interface: \`\`\`\${stimulusMatrix.lql}\`\`\`. Only output the java class and nothing else."""
362+
prompt.id = "lql_prompt"
363+
return [prompt] // list of prompts is expected
364+
}
365+
}
366+
367+
// add tests: SBST
368+
action(name: 'evoSuite', type: 'EvoSuite') {
369+
searchBudget = 60 // we need this as upper bound for timeouts
370+
stoppingCondition = "MaxTime"
371+
372+
dependsOn 'generateCodeGpt'
373+
include '*'
374+
profile('java11Profile')
375+
}
376+
377+
action(name: 'execute', type: 'Arena') {
378+
maxAdaptations = 1 // how many adaptations to try
379+
380+
dependsOn 'evoSuite'
381+
include '*'
382+
profile('java17Profile')
383+
}
384+
}
385+
`
386+
387+
const OllamaEvoSuite = `dataSource 'lasso_quickstart'
388+
def ollamaServers = ["http://bagdana.informatik.uni-mannheim.de:11434"]
389+
study(name: 'EvoSuiteGenOllama') {
390+
391+
// target profile
392+
profile('java17Profile') {
393+
scope('class') { type = 'class' }
394+
environment('java17') {
395+
image = 'maven:3.9-eclipse-temurin-17'
396+
}
397+
}
398+
399+
// profile for EvoSuite
400+
profile('java11Profile') {
401+
scope('class') { type = 'class' }
402+
environment('java17') {
403+
image = 'maven:3.6.3-openjdk-11' // EvoSuite won't run in > JDK 11
404+
}
405+
}
406+
407+
action(name: 'createStimulusMatrix') {
408+
execute {
409+
stimulusMatrix('myAb', """{{INTERFACE}}""", [/*impls*/], {{TESTS}})
410+
}
411+
}
412+
413+
action(name: 'generateCodeLlama', type: 'GenerateCodeOllama') {
414+
// pipeline specific
415+
dependsOn 'createStimulusMatrix'
416+
include '*'
417+
profile('java17Profile')
418+
javaVersion = "11" // because of EvoSuite ..
419+
420+
// action configuration block
421+
servers = ollamaServers
422+
model = {{CODE_MODEL}}
423+
samples = {{CODE_SAMPLES}}
424+
425+
// custom DSL command offered by the action (for each stimulus matrix, create one prompt to obtain impls)
426+
prompt { stimulusMatrix ->
427+
// can by for any prompts: FA, impls, models etc.
428+
def prompt = [:] // create prompt model
429+
prompt.promptContent = """implement a java class with the following interface specification, but do not inherit a java interface: \`\`\`\${stimulusMatrix.lql}\`\`\`. Only output the java class and nothing else."""
430+
prompt.id = "lql_prompt"
431+
return [prompt] // list of prompts is expected
432+
}
433+
}
434+
435+
// add tests: SBST
436+
action(name: 'evoSuite', type: 'EvoSuite') {
437+
searchBudget = 60 // we need this as upper bound for timeouts
438+
stoppingCondition = "MaxTime"
439+
440+
dependsOn 'generateCodeLlama'
441+
include '*'
442+
profile('java11Profile')
443+
}
444+
445+
action(name: 'execute', type: 'Arena') {
446+
maxAdaptations = 1 // how many adaptations to try
447+
448+
dependsOn 'evoSuite'
449+
include '*'
450+
profile('java17Profile')
451+
}
452+
}
453+
`
454+
335455
export const TDS_PLACEHOLDER_DEFAULTS: {
336456
[templateKey: string]: {
337457
[placeholder: string]: {
@@ -428,7 +548,26 @@ export const TGS_PLACEHOLDER_DEFAULTS: {
428548
default: "1",
429549
description: "The number of test (classes) to generate"
430550
},
431-
}
551+
},
552+
OllamaEvoSuite: {
553+
CODE_MODEL: {
554+
label: "Code Model (LLM)",
555+
default: "\"gemma3:27b\"",
556+
description: "The Ollama model to use for generation"
557+
},
558+
CODE_SAMPLES: {
559+
label: "Number of Code Modules",
560+
default: "1",
561+
description: "The number of code modules to generate"
562+
}
563+
},
564+
ChatGPTEvoSuite: {
565+
CODE_SAMPLES: {
566+
label: "Number of Code Modules",
567+
default: "1",
568+
description: "The number of code modules to generate"
569+
},
570+
},
432571
};
433572

434573
export const TDSTemplates = {
@@ -439,6 +578,8 @@ export const TDSTemplates = {
439578
export const TDGTemplates = {
440579
ChatGPT,
441580
ChatGPTGenerateTests,
581+
ChatGPTEvoSuite,
442582
Ollama,
443-
OllamaGenerateTests
583+
OllamaGenerateTests,
584+
OllamaEvoSuite
444585
};

0 commit comments

Comments
 (0)