Skip to content

Commit

Permalink
Add parameterized test generation in CI (#1114)
Browse files Browse the repository at this point in the history
* Add parameterized test generation in ci

* Little style corrections

* Move *containsMocking* flag to UtSymbolicExecution

Co-authored-by: Egor Kulikov <egor.k.kulikov@gmail.com>
  • Loading branch information
sofurihafe and EgorkaKulikov authored Oct 11, 2022
1 parent 1ba00d4 commit 0cbd535
Show file tree
Hide file tree
Showing 78 changed files with 336 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class UtSymbolicExecution(
val staticFields: Set<FieldId>
get() = stateBefore.statics.keys

var containsMocking: Boolean = false

override fun toString(): String = buildString {
append("UtSymbolicExecution(")
appendLine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class CorrectBracketSequencesTest : UtValueTestCaseChecker(
testClass = CorrectBracketSequences::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration) // TODO generics in lists
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration) // TODO generics in lists
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class SortTest : UtValueTestCaseChecker(
testClass = Sort::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class ArrayOfObjectsTest : UtValueTestCaseChecker(
testClass = ArrayOfObjects::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import org.utbot.tests.infrastructure.isException

class ArrayStoreExceptionExamplesTest : UtValueTestCaseChecker(
testClass = ArrayStoreExceptionExamples::class,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
// Type inference errors in generated Kotlin code
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
class ArraysOverwriteValueTest : UtValueTestCaseChecker(
testClass = ArraysOverwriteValue::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class IntArrayBasicsTest : UtValueTestCaseChecker(
testClass = IntArrayBasics::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class PrimitiveArraysTest : UtValueTestCaseChecker(
testClass = PrimitiveArrays::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class ArrayCastExampleTest : UtValueTestCaseChecker(
testClass = ArrayCastExample::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class CastClassTest : UtValueTestCaseChecker(
testClass = CastClass::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class CastExampleTest : UtValueTestCaseChecker(
testClass = CastExample::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class GenericCastExampleTest : UtValueTestCaseChecker(
testClass = GenericCastExample::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class InstanceOfExampleTest : UtValueTestCaseChecker(
testClass = InstanceOfExample::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ package org.utbot.examples.codegen
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.junit.jupiter.api.Test
import org.utbot.framework.plugin.api.CodegenLanguage
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.Compilation
import org.utbot.tests.infrastructure.TestExecution

@Suppress("INACCESSIBLE_TYPE")
internal class ClassWithStaticAndInnerClassesTest : UtValueTestCaseChecker(testClass = ClassWithStaticAndInnerClasses::class) {
internal class ClassWithStaticAndInnerClassesTest : UtValueTestCaseChecker(
testClass = ClassWithStaticAndInnerClasses::class,
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA, lastStage = TestExecution, parameterizedModeLastStage = Compilation),
TestLastStage(CodegenLanguage.KOTLIN, lastStage = TestExecution)
)
) {
@Test
fun testUsePrivateStaticClassWithPrivateField() {
check(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package org.utbot.examples.codegen
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.junit.jupiter.api.Test
import org.utbot.framework.plugin.api.CodegenLanguage
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.Compilation

class VoidStaticMethodsTest : UtValueTestCaseChecker(testClass = VoidStaticMethodsTestingClass::class) {
class VoidStaticMethodsTest : UtValueTestCaseChecker(
testClass = VoidStaticMethodsTestingClass::class) {
@Test
fun testInvokeChangeStaticFieldMethod() {
check(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import org.utbot.tests.infrastructure.UtValueTestCaseChecker
class ClassWithCrossReferenceRelationshipTest : UtValueTestCaseChecker(
testClass = ClassWithCrossReferenceRelationship::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
class ClassWithNullableFieldTest : UtValueTestCaseChecker(
testClass = ClassWithNullableField::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
class DeepEqualsTest : UtValueTestCaseChecker(
testClass = DeepEqualsTestingClass::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import org.utbot.framework.plugin.api.UtConcreteValue
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.tests.infrastructure.Compilation
import org.utbot.tests.infrastructure.TestExecution

internal class CustomerExamplesTest: UtValueTestCaseChecker(
testClass = CustomerExamples::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA, lastStage = TestExecution, parameterizedModeLastStage = Compilation),
TestLastStage(CodegenLanguage.KOTLIN, lastStage = CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class GenericListsExampleTest : UtValueTestCaseChecker(
testClass = GenericListsExample::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class LinkedListsTest : UtValueTestCaseChecker(
testClass = LinkedLists::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
class ListAlgorithmsTest : UtValueTestCaseChecker(
testClass = ListAlgorithms::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class ListIteratorsTest : UtValueTestCaseChecker(
testClass = ListIterators::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class ListWrapperReturnsVoidTest : UtValueTestCaseChecker(
testClass = ListWrapperReturnsVoidExample::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class ListsPart1Test : UtValueTestCaseChecker(
testClass = Lists::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import org.utbot.tests.infrastructure.ignoreExecutionsNumber
internal class ListsPart2Test : UtValueTestCaseChecker(
testClass = Lists::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
internal class ListsPart3Test : UtValueTestCaseChecker(
testClass = Lists::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
class MapEntrySetTest : UtValueTestCaseChecker(
testClass = MapEntrySet::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import org.utbot.tests.infrastructure.CodeGeneration
class MapKeySetTest : UtValueTestCaseChecker(
testClass = MapKeySet::class,
testCodeGeneration = true,
languagePipelines = listOf(
CodeGenerationLanguageLastStage(CodegenLanguage.JAVA),
CodeGenerationLanguageLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
pipelines = listOf(
TestLastStage(CodegenLanguage.JAVA),
TestLastStage(CodegenLanguage.KOTLIN, CodeGeneration)
)
) {
@Test
Expand Down
Loading

0 comments on commit 0cbd535

Please sign in to comment.