diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 24f8c24978..09cc5ebf06 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -39,12 +39,12 @@ jobs: gradle-build-module: |- :diktat-api :diktat-common + :diktat-common-test :diktat-ktlint-engine :diktat-gradle-plugin :diktat-maven-plugin :diktat-rules :diktat-ruleset - :diktat-test-framework :diktat-dev-ksp :diktat-cli gradle-build-configuration: |- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e7f8f390f..6fe219df78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ Rules are very simple: Main components are: 1) diktat-rules — number of rules that are supported by diKTat; -2) diktat-test-framework — functional/unit test framework that can be used for running your code fixer on the initial code and compare it with the expected result; +2) diktat-common-test — util methods for functional/unit tests that can be used for running your code fixer on the initial code and compare it with the expected result; 3) also see our demo: diktat-demo in a separate repository. Mainly we wanted to create a common configurable mechanism that @@ -31,7 +31,7 @@ Before you make a pull request, make sure the build is clean as we have lot of t $ mvn clean install ``` -# Hooks +# Hooks We have some hooks to a commit messages: 1) your commit message should have the following format: @@ -40,7 +40,7 @@ Brief Description ### What's done: 1) Long description -2) Long description +2) Long description ``` 2) Please also do not forget to update documentation on Wiki after the merge approval and before merge. diff --git a/diktat-cli/build.gradle.kts b/diktat-cli/build.gradle.kts index bd5ef27792..b7db4f5702 100644 --- a/diktat-cli/build.gradle.kts +++ b/diktat-cli/build.gradle.kts @@ -23,7 +23,7 @@ dependencies { implementation(libs.log4j2.core) implementation(libs.log4j2.slf4j2) - testImplementation(projects.diktatTestFramework) + testImplementation(projects.diktatCommonTest) testImplementation(libs.junit.jupiter) testImplementation(libs.junit.platform.suite) testImplementation(libs.assertj.core) diff --git a/diktat-test-framework/build.gradle.kts b/diktat-common-test/build.gradle.kts similarity index 92% rename from diktat-test-framework/build.gradle.kts rename to diktat-common-test/build.gradle.kts index 03a1157419..a4a9e67891 100644 --- a/diktat-test-framework/build.gradle.kts +++ b/diktat-common-test/build.gradle.kts @@ -4,7 +4,7 @@ plugins { id("com.saveourtool.diktat.buildutils.publishing-default-configuration") } -project.description = "Test framework for diktat" +project.description = "Diktat coommon for tests" dependencies { api(projects.diktatCommon) diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestArgumentsReader.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestArgumentsReader.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestArgumentsReader.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestArgumentsReader.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfig.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfig.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfig.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfig.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfigReader.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfigReader.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfigReader.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestConfigReader.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestFrameworkProperties.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestFrameworkProperties.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestFrameworkProperties.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/config/TestFrameworkProperties.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparator.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparator.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparator.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparator.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparisonResult.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparisonResult.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparisonResult.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/FileComparisonResult.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/ResourceReader.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/ResourceReader.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/ResourceReader.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/ResourceReader.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestComparatorUnit.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestComparatorUnit.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestComparatorUnit.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestComparatorUnit.kt diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/util/TestUtils.kt b/diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/util/TestUtils.kt similarity index 100% rename from diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/util/TestUtils.kt rename to diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/util/TestUtils.kt diff --git a/diktat-rules/build.gradle.kts b/diktat-rules/build.gradle.kts index 9e03d01bb3..c736f90497 100644 --- a/diktat-rules/build.gradle.kts +++ b/diktat-rules/build.gradle.kts @@ -17,7 +17,7 @@ dependencies { // guava is used for string case utils implementation(libs.guava) implementation(libs.kotlin.logging) - testImplementation(projects.diktatTestFramework) + testImplementation(projects.diktatCommonTest) testImplementation(projects.diktatKtlintEngine) testImplementation(libs.log4j2.slf4j2) testImplementation(libs.junit.jupiter) diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/TestEntry.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/TestEntry.kt deleted file mode 100644 index 3b6291ce63..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/TestEntry.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.saveourtool.diktat.test.framework - -import com.saveourtool.diktat.test.framework.config.TestArgumentsReader -import com.saveourtool.diktat.test.framework.config.TestFrameworkProperties -import com.saveourtool.diktat.test.framework.processing.TestProcessingFactory - -/** - * Main entry point for test executions - */ -object TestEntry { - @JvmStatic - fun main(args: Array) { - val properties = TestFrameworkProperties("com/saveourtool/diktat/test/framework/test_framework.properties") - TestProcessingFactory(TestArgumentsReader(args, properties, javaClass.classLoader)).processTests() - } -} diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/ExecutionResult.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/ExecutionResult.kt deleted file mode 100644 index 3131d07746..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/ExecutionResult.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.saveourtool.diktat.test.framework.common - -/** - * Class that keeps the result of executed command - * - * @property stdOut content from stdout stream - * @property stdErr content from stderr stream - */ -data class ExecutionResult(val stdOut: List, val stdErr: List) diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/LocalCommandExecutor.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/LocalCommandExecutor.kt deleted file mode 100644 index de4e611930..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/LocalCommandExecutor.kt +++ /dev/null @@ -1,67 +0,0 @@ -package com.saveourtool.diktat.test.framework.common - -import io.github.oshai.kotlinlogging.KotlinLogging -import java.io.IOException -import java.io.InputStream -import java.nio.charset.Charset -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.flow.flowOn -import kotlinx.coroutines.flow.toList -import kotlinx.coroutines.runBlocking - -/** - * Class that wraps shell [command] and can execute it - * - * @param command - * @param ioDispatcher - */ -class LocalCommandExecutor internal constructor( - private val command: String, - private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO, -) { - /** - * Execute [command] - * - * @return [ExecutionResult] of command execution - */ - fun executeCommand(): ExecutionResult { - try { - log.info { "Executing command: $command" } - val process = Runtime.getRuntime().exec(command) - process.outputStream.close() - return runBlocking { - ExecutionResult( - process.inputStream.readLinesAsync("OUTPUT", ioDispatcher).toList(), - process.errorStream.readLinesAsync("ERROR", ioDispatcher).toList(), - ) - } - } catch (ex: IOException) { - log.error(ex) { "Execution of $command failed" } - } - return ExecutionResult(emptyList(), emptyList()) - } - - companion object { - private val log = KotlinLogging.logger {} - - /** - * @param streamType - * @param ioDispatcher - * @return [Flow] of strings from input stream - */ - fun InputStream.readLinesAsync(streamType: String, ioDispatcher: CoroutineDispatcher): Flow = flow { - try { - val bufferedReader = this@readLinesAsync.bufferedReader(Charset.defaultCharset()) - while (true) { - val line = bufferedReader.readLine() ?: break - emit(line) - } - } catch (ex: IOException) { - log.error(ex) { "Failed to consume and display the input stream of type $streamType." } - } - }.flowOn(ioDispatcher) - } -} diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/TestBase.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/TestBase.kt deleted file mode 100644 index 46b9fe782d..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/common/TestBase.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.saveourtool.diktat.test.framework.common - -import com.saveourtool.diktat.test.framework.config.TestConfig -import com.saveourtool.diktat.test.framework.config.TestFrameworkProperties - -/** - * Base interface for different test runners - */ -interface TestBase { - /** - * simple test runner that depends on the test execution type - * - * @return if test failed or passed - */ - @Suppress("FUNCTION_BOOLEAN_PREFIX") - fun runTest(): Boolean - - /** - * injects test configuration that was read from .json config file - * - * @param testConfig json configuration - * @param properties config from properties - * @return test instance itself - */ - fun initTestProcessor(testConfig: TestConfig, properties: TestFrameworkProperties): TestBase - - /** - * @param command - command to execute in shell - * @return execution result - in default implementation returns inputStream - */ - fun executeCommand(command: String) = LocalCommandExecutor(command).executeCommand() -} diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestCheckWarn.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestCheckWarn.kt deleted file mode 100644 index cba634a92d..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestCheckWarn.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.saveourtool.diktat.test.framework.processing - -import com.saveourtool.diktat.test.framework.config.TestConfig -import io.github.oshai.kotlinlogging.KLogger -import io.github.oshai.kotlinlogging.KotlinLogging - -/** - * [TestCompare] that uses stderr as tests output stream - */ -class TestCheckWarn : TestCompare() { - @Suppress("MISSING_KDOC_CLASS_ELEMENTS") - override val log: KLogger = KotlinLogging.logger {} - - @Suppress( - "UnusedPrivateMember", - "UNUSED", - "VarCouldBeVal" - ) - private var testConfig: TestConfig? = null - - /** - * Get tests execution result - */ - override fun getExecutionResult() = testResult.stdErr -} diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestCompare.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestCompare.kt deleted file mode 100644 index 84b5eaa083..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestCompare.kt +++ /dev/null @@ -1,96 +0,0 @@ -package com.saveourtool.diktat.test.framework.processing - -import com.saveourtool.diktat.test.framework.common.ExecutionResult -import com.saveourtool.diktat.test.framework.common.TestBase -import com.saveourtool.diktat.test.framework.config.TestConfig -import com.saveourtool.diktat.test.framework.config.TestFrameworkProperties -import io.github.oshai.kotlinlogging.KLogger -import io.github.oshai.kotlinlogging.KotlinLogging - -import org.apache.commons.io.FileUtils - -import java.io.File - -/** - * A class that runs tests and compares output with expected result - */ -@Suppress("ForbiddenComment") -open class TestCompare : TestBase { - @Suppress("MISSING_KDOC_CLASS_ELEMENTS") - protected open val log: KLogger = KotlinLogging.logger {} - private lateinit var expectedResult: File - - // testResultFile will be used if and only if --in-place option will be used - private lateinit var testFile: File - private lateinit var testConfig: TestConfig - - /** Result of the test run */ - protected lateinit var testResult: ExecutionResult - - /** - * @return true if test has passed successfully, false otherwise - */ - @Suppress("FUNCTION_BOOLEAN_PREFIX") - override fun runTest(): Boolean { - // FixMe: this is an execution for Windows, should support other OS - val testPassed = if (testConfig.inPlace) processInPlace() else processToStdOut() - - if (testPassed) { - log.info { "Test <${testConfig.testName}> passed" } - } else { - log.error { "Test <${testConfig.testName}> failed" } - } - - return testPassed - } - - /** - * injects test configuration that was read from .json config file - * - * @param testConfig json configuration - * @param properties config from properties - * @return test instance itself - */ - override fun initTestProcessor(testConfig: TestConfig, properties: TestFrameworkProperties): TestCompare { - this.testConfig = testConfig - this.expectedResult = buildFullPathToResource( - testConfig.expectedResultFile, - properties.testFilesRelativePath - ) - this.testFile = buildFullPathToResource(testConfig.testFile, properties.testFilesRelativePath) - - return this - } - - @Suppress("FUNCTION_BOOLEAN_PREFIX") - private fun processInPlace(): Boolean { - val copyTestFile = File("${testFile}_copy") - FileUtils.copyFile(testFile, copyTestFile) - executeCommand("cmd /c ${testConfig.executionCommand} $copyTestFile") - - val testPassed = FileComparator(expectedResult, copyTestFile).compareFilesEqual() - FileUtils.forceDelete(copyTestFile) - - return testPassed - } - - @Suppress("FUNCTION_BOOLEAN_PREFIX") - private fun processToStdOut(): Boolean { - this.testResult = executeCommand("cmd /c ${testConfig.executionCommand} $testFile") - - return FileComparator(expectedResult, getExecutionResult().joinToString("\n")).compareFilesEqual() - } - - private fun buildFullPathToResource(resourceFile: String, resourceAbsolutePath: String): File { - val fileUrl = javaClass.classLoader.getResource("$resourceAbsolutePath/$resourceFile") - requireNotNull(fileUrl) { "Cannot read resource file $$resourceAbsolutePath/$resourceFile - it cannot be found in resources" } - return File(fileUrl.file) - } - - /** - * Get result of the test execution - * - * @return list stdOut - */ - protected open fun getExecutionResult() = testResult.stdOut -} diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestMixed.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestMixed.kt deleted file mode 100644 index 3b1ddf3a96..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestMixed.kt +++ /dev/null @@ -1,29 +0,0 @@ -package com.saveourtool.diktat.test.framework.processing - -import com.saveourtool.diktat.test.framework.common.TestBase -import com.saveourtool.diktat.test.framework.config.TestConfig -import com.saveourtool.diktat.test.framework.config.TestFrameworkProperties - -@Suppress( - "MISSING_KDOC_TOP_LEVEL", - "KDOC_NO_EMPTY_TAGS", - "UNUSED" -) // fixme: add documentation when implementation is done -class TestMixed : TestBase { - private lateinit var testConfig: TestConfig - - /** - * @return - */ - override fun runTest() = true - - /** - * @param testConfig - * @param properties - * @return - */ - override fun initTestProcessor(testConfig: TestConfig, properties: TestFrameworkProperties): TestMixed { - this.testConfig = testConfig - return this - } -} diff --git a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestProcessingFactory.kt b/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestProcessingFactory.kt deleted file mode 100644 index 679771240e..0000000000 --- a/diktat-test-framework/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestProcessingFactory.kt +++ /dev/null @@ -1,99 +0,0 @@ -package com.saveourtool.diktat.test.framework.processing - -import com.saveourtool.diktat.test.framework.common.TestBase -import com.saveourtool.diktat.test.framework.config.TestArgumentsReader -import com.saveourtool.diktat.test.framework.config.TestConfig -import com.saveourtool.diktat.test.framework.config.TestConfig.ExecutionType -import com.saveourtool.diktat.test.framework.config.TestConfigReader -import io.github.oshai.kotlinlogging.KotlinLogging - -import java.io.File -import java.io.IOException -import java.net.URL -import java.util.concurrent.atomic.AtomicInteger -import java.util.stream.Stream - -import kotlin.system.exitProcess - -/** - * A class that runs tests based on configuration - * - * @param argReader - */ -@Suppress("ForbiddenComment") -class TestProcessingFactory(private val argReader: TestArgumentsReader) { - private val allTestsFromResources: List by lazy { - val fileUrl: URL? = javaClass.getResource("/${argReader.properties.testConfigsRelativePath}") - val resource = fileUrl - ?.let { File(it.file) } - ?: run { - log.error { - "Not able to get directory with test configuration files: ${argReader.properties.testConfigsRelativePath}" - } - exitProcess(STATUS_FIVE) - } - try { - resource - .walk() - .filter { file -> file.isFile } - .map { file -> file.name.replace(".json", "") } - .toList() - } catch (e: IOException) { - log.error(e) { "Got -all option, but cannot read config files " } - exitProcess(STATUS_THREE) - } - } - - /** - * Run all tests specified in input parameters and log results - */ - fun processTests() { - val failedTests = AtomicInteger(0) - val passedTests = AtomicInteger(0) - val testList: List = if (argReader.shouldRunAllTests()) { - log.info { "Will run all available test cases" } - allTestsFromResources - } else { - log.info { "Will run specific tests: ${argReader.tests}" } - argReader.tests - } - - val testStream: Stream = - if (argReader.properties.isParallelMode) testList.parallelStream() else testList.stream() - - testStream - .map { test: String -> findTestInResources(test) } - .filter { it != null } - .map { it as TestConfig } - .forEach { test: TestConfig -> - if (processTest(test)) passedTests.incrementAndGet() else failedTests.incrementAndGet() - } - - log.info { "Test processing finished. Passed tests: [$passedTests]. Failed tests: [$failedTests]" } - } - - private fun findTestInResources(test: String): TestConfig? = - TestConfigReader("${argReader.properties.testConfigsRelativePath}/$test.json", javaClass.classLoader) - .config - ?.setTestName(test) - - @Suppress("FUNCTION_BOOLEAN_PREFIX") - private fun processTest(testConfig: TestConfig): Boolean { - val test: TestBase = when (testConfig.executionType) { - ExecutionType.MIXED -> - // FixMe: support Mixed type - TestCompare() - ExecutionType.COMPARE -> TestCompare() - ExecutionType.CHECK_WARN -> TestCheckWarn() - } - - return test.initTestProcessor(testConfig, argReader.properties) - .runTest() - } - - companion object { - private val log = KotlinLogging.logger {} - private const val STATUS_FIVE = 5 - private const val STATUS_THREE = 3 - } -} diff --git a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_arguments.json b/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_arguments.json deleted file mode 100644 index f247db6d85..0000000000 --- a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_arguments.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "shortName": "help", - "longName": "help", - "helpDescr": "Help information", - "isRequired": false, - "hasArgs": false - }, - { - "shortName": "t", - "longName": "tests", - "helpDescr": "This option specifies the test that should be run. Tests can be listed separated with comma", - "isRequired": false, - "hasArgs": true - }, - { - "shortName": "all", - "longName": "all", - "helpDescr": "Run all tests that have configuration json-file", - "isRequired": false, - "hasArgs": false - } -] \ No newline at end of file diff --git a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_3_a_package_naming.json b/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_3_a_package_naming.json deleted file mode 100644 index 017041533b..0000000000 --- a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_3_a_package_naming.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profile": "KT", - "executionCommand": "dir", - "expectedResultFile": "1_3_a_package_naming_correct_.kt", - "inPlace": true, - "testFile": "1_3_a_package_naming_incorrect_.kt", - "executionType": "COMPARE" -} \ No newline at end of file diff --git a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_3_b_package_naming.json b/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_3_b_package_naming.json deleted file mode 100644 index 1e62f5ed74..0000000000 --- a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_3_b_package_naming.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profile": "KT", - "executionCommand": "didfgdr", - "expectedResultFile": "1_3_b_package_naming.warn", - "inPlace": false, - "testFile": "1_3_a_package_naming_correct_.kt", - "executionType": "CHECK_WARN" -} \ No newline at end of file diff --git a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_9_a_special_space_cases.json b/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_9_a_special_space_cases.json deleted file mode 100644 index 5c8ec29834..0000000000 --- a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_configs/functional/1_9_a_special_space_cases.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profile": "PYTHON", - "executionCommand": "dir", - "expectedResultFile": "1_9_a_special_space_cases_correct_.py", - "testFile": "1_9_a_special_space_cases_incorrect_.py", - "inPlace": false, - "executionType": "MIXED" -} \ No newline at end of file diff --git a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_framework.properties b/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_framework.properties deleted file mode 100644 index 1752d60f00..0000000000 --- a/diktat-test-framework/src/main/resources/com/saveourtool/diktat/test/framework/test_framework.properties +++ /dev/null @@ -1,12 +0,0 @@ -# base directory of test framework (relative path in resources) -test.framework.dir=test_framework -# filename of a configuration file where argument description is stored -test.framework.arguments=test_arguments.json -# relative path (from base test.framework.dir) to a directory, where all test configurations are stored -test.configs.dir=test_configs/functional -# relative path (from base test.framework.dir) to a directory, where all test files (that should be run) are stored -test.files.dir=test_files/functional - - -# to setup test run in parallel mode - use this configuration -parallel.mode=false diff --git a/diktat-test-framework/src/main/resources/config.properties b/diktat-test-framework/src/main/resources/config.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/diktat-test-framework/src/main/resources/log4j2.properties b/diktat-test-framework/src/main/resources/log4j2.properties deleted file mode 100644 index 20bfdb44d6..0000000000 --- a/diktat-test-framework/src/main/resources/log4j2.properties +++ /dev/null @@ -1,8 +0,0 @@ -rootLogger.level = info -rootLogger.appenderRef.stdout.ref = STDOUT - -appender.stdout.type = Console -appender.stdout.name = STDOUT -appender.stdout.target = SYSTEM_OUT -appender.stdout.layout.type = PatternLayout -appender.stdout.layout.pattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss} %m%n \ No newline at end of file diff --git a/diktat-test-framework/src/main/resources/options.json b/diktat-test-framework/src/main/resources/options.json deleted file mode 100644 index dfa11b468e..0000000000 --- a/diktat-test-framework/src/main/resources/options.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "shortName": "help", - "longName": "help", - "helpDescr": "Help information", - "isRequired": false, - "hasArgs": false - }, - { - "shortName": "t", - "longName": "test", - "helpDescr": "This option specifies the test that should be run. Tests can be listed separated with comma", - "isRequired": false, - "hasArgs": true - }, - { - "shortName": "all", - "longName": "all", - "helpDescr": "Run all tests that have configuration json-file", - "isRequired": false, - "hasArgs": false - } -] diff --git a/settings.gradle.kts b/settings.gradle.kts index ae97fc2aed..fb5ebee13c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -48,12 +48,12 @@ plugins { includeBuild("gradle/plugins") include("diktat-api") include("diktat-common") +include("diktat-common-test") include("diktat-ktlint-engine") include("diktat-gradle-plugin") include("diktat-maven-plugin") include("diktat-rules") include("diktat-ruleset") -include("diktat-test-framework") include("diktat-dev-ksp") include("diktat-cli")