diff --git a/build.gradle b/build.gradle index 2734601..86ee167 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,13 @@ -apply from: 'dependencies.gradle' +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { - // Gradle will not find vars defined in an external file when referring to them - // in the buildscript block, unless you link it from the buildscript block, too. - apply from: 'dependencies.gradle' - repositories { jcenter() } dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin" - classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0' - classpath "org.junit.platform:junit-platform-gradle-plugin:$versions.junitPlatform" - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.40" + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' } } @@ -21,8 +15,11 @@ allprojects { repositories { jcenter() } - - apply plugin: 'com.github.ben-manes.versions' + tasks.withType(KotlinCompile).all { + kotlinOptions { + freeCompilerArgs += '-XXLanguage:+NewInference' + } + } } def gitTag() { @@ -35,9 +32,7 @@ def gitTag() { return tag } -def projectVersion() { - def tag = gitTag() - +def projectVersion(tag) { if (tag.startsWith('v')) { return tag.substring(1) } else if (tag.isEmpty()) { @@ -48,11 +43,18 @@ def projectVersion() { } def validateTagAndVersion() { - if (gitTag().isEmpty()) { + def gitTag = gitTag() + def tagVersion = projectVersion(gitTag) + + if (gitTag.isEmpty()) { throw new IllegalStateException('Publishing is not allowed because current commit has no tag') } - if (projectVersion().isEmpty()) { + if (tagVersion.isEmpty()) { throw new IllegalStateException('Publishing is not allowed because current projectVersion is empty') } + + if (tagVersion != project.version) { + throw new IllegalStateException('Publishing not allowed because current tag version does not match version declared in gradle.properties') + } } diff --git a/composer/build.gradle b/composer/build.gradle index d03471f..f7c2d95 100644 --- a/composer/build.gradle +++ b/composer/build.gradle @@ -1,29 +1,23 @@ apply plugin: 'kotlin' apply plugin: 'application' -apply plugin: 'org.junit.platform.gradle.plugin' -apply plugin: 'maven' apply plugin: 'maven-publish' apply plugin: 'com.jfrog.bintray' mainClassName = 'com.gojuno.composer.MainKt' dependencies { - compile libraries.kotlinStd - compile libraries.rxJava - compile libraries.jCommander - compile libraries.commanderOs - compile libraries.commanderAndroid - compile libraries.apacheCommonsIo - compile libraries.apacheCommonsLang - compile libraries.gson - compile libraries.dexParser -} - -dependencies { - testCompile libraries.spek - testCompile libraries.junitPlatformRunner - testCompile libraries.spekJunitPlatformEngine - testCompile libraries.assertJ + api "org.jetbrains.kotlin:kotlin-stdlib-jdk8" + api "com.gojuno.commander:android:0.2.0" + api "com.beust:jcommander:1.71" + api "commons-io:commons-io:2.6" + api "org.apache.commons:commons-text:1.6" + api "com.google.code.gson:gson:2.8.5" + api "com.linkedin.dextestparser:parser:1.1.0" + + testImplementation "org.assertj:assertj-core:3.11.1" + testImplementation "org.spekframework.spek2:spek-dsl-jvm:2.0.5" + testRuntimeOnly "org.spekframework.spek2:spek-runner-junit5:2.0.5" + testRuntimeOnly "org.jetbrains.kotlin:kotlin-reflect" } jar { @@ -39,23 +33,19 @@ jar { } } -junitPlatform { - platformVersion = versions.junitPlatform - - filters { - engines { - include 'spek' - } +test { + useJUnitPlatform { + includeEngines 'spek2' } } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } @@ -67,23 +57,6 @@ task validatePublishing { bintrayUpload.dependsOn validatePublishing -def pomConfig = { - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - developers { - developer { - id 'gojuno' - name 'Juno Inc.' - email 'opensource@gojuno.com' - } - } -} - publishing { publications { ComposerPublication(MavenPublication) { @@ -92,16 +65,23 @@ publishing { artifact sourcesJar artifact javadocJar - groupId 'com.gojuno.composer' - artifactId 'composer' - version projectVersion() - - pom.withXml { - def root = asNode() - root.appendNode('description', 'Reactive Android Instrumentation Test Runner.') - root.appendNode('name', 'Composer') - root.appendNode('url', 'https://github.com/gojuno/composer') - root.children().last() + pomConfig + pom { + description ='Reactive Android Instrumentation Test Runner.' + url ='https://github.com/gojuno/composer' + licenses { + license { + name = 'The Apache Software License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + distribution = 'repo' + } + } + developers { + developer { + id = 'gojuno' + name = 'Juno Inc.' + email = 'opensource@gojuno.com' + } + } } } } @@ -121,7 +101,7 @@ bintray { publications = ['ComposerPublication'] version { - name = projectVersion() + name = project.version vcsTag = gitTag() gpg { diff --git a/composer/src/main/kotlin/com/gojuno/composer/Apk.kt b/composer/src/main/kotlin/com/gojuno/composer/Apk.kt index 664cb8b..2b3481e 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/Apk.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/Apk.kt @@ -36,9 +36,8 @@ fun parseTestPackage(testApkPath: String): TestPackage = ?.let(TestPackage::Valid) ?: TestPackage.ParseError("Cannot parse test package from `aapt dump badging \$APK` output.") } - .toSingle() - .toBlocking() - .value() + .singleOrError() + .blockingGet() fun parseTestRunner(testApkPath: String): TestRunner = process( @@ -60,9 +59,8 @@ fun parseTestRunner(testApkPath: String): TestRunner = ?.let(TestRunner::Valid) ?: TestRunner.ParseError("Cannot parse test runner from `aapt dump xmltree \$TEST_APK AndroidManifest.xml` output.") } - .toSingle() - .toBlocking() - .value() + .singleOrError() + .blockingGet() fun parseTests(testApkPath: String): List = DexParser.findTestMethods(testApkPath).map { TestMethod(it.testName, it.annotationNames) } diff --git a/composer/src/main/kotlin/com/gojuno/composer/Files.kt b/composer/src/main/kotlin/com/gojuno/composer/Files.kt index 5f5915e..416404a 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/Files.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/Files.kt @@ -1,22 +1,17 @@ package com.gojuno.composer +import io.reactivex.Observable import org.apache.commons.io.input.Tailer import org.apache.commons.io.input.TailerListener -import rx.Emitter.BackpressureMode -import rx.Observable import java.io.File import java.io.FileNotFoundException -import java.lang.Exception -fun tail(file: File): Observable = Observable.create( - { emitter -> - Tailer.create(file, object : TailerListener { - override fun init(tailer: Tailer) = emitter.setCancellation { tailer.stop() } - override fun handle(line: String) = emitter.onNext(line) - override fun handle(e: Exception) = emitter.onError(e) - override fun fileRotated() = emitter.onError(IllegalStateException("Output rotation detected $file")) - override fun fileNotFound() = emitter.onError(FileNotFoundException("$file file was not found")) - }) - }, - BackpressureMode.BUFFER -) +fun tail(file: File): Observable = Observable.create { emitter -> + Tailer.create(file, object : TailerListener { + override fun init(tailer: Tailer) = emitter.setCancellable { tailer.stop() } + override fun handle(line: String) = emitter.onNext(line) + override fun handle(e: Exception) = emitter.onError(e) + override fun fileRotated() = emitter.onError(IllegalStateException("Output rotation detected $file")) + override fun fileNotFound() = emitter.onError(FileNotFoundException("$file file was not found")) + }) +} diff --git a/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt b/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt index 7809806..3616f74 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt @@ -3,7 +3,7 @@ package com.gojuno.composer import com.gojuno.composer.InstrumentationTest.Status.Failed import com.gojuno.composer.InstrumentationTest.Status.Ignored import com.gojuno.composer.InstrumentationTest.Status.Passed -import rx.Observable +import io.reactivex.Observable import java.io.File data class InstrumentationTest( @@ -186,5 +186,5 @@ fun Observable.asTests(): Observable } } .filter { it.tests.isNotEmpty() } - .flatMap { Observable.from(it.tests) } + .flatMap { Observable.fromIterable(it.tests) } } diff --git a/composer/src/main/kotlin/com/gojuno/composer/JUnitReport.kt b/composer/src/main/kotlin/com/gojuno/composer/JUnitReport.kt index 175ee37..0ff810d 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/JUnitReport.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/JUnitReport.kt @@ -1,9 +1,9 @@ package com.gojuno.composer import com.gojuno.composer.AdbDeviceTest.Status.* -import org.apache.commons.lang3.StringEscapeUtils -import rx.Completable -import rx.Single +import io.reactivex.Completable +import io.reactivex.Single +import org.apache.commons.text.StringEscapeUtils import java.io.File import java.text.SimpleDateFormat import java.util.* @@ -73,4 +73,4 @@ fun writeJunit4Report(suite: Suite, outputFile: File): Completable = Single } } .map { xml -> outputFile.writeText(xml) } - .toCompletable() + .ignoreElement() diff --git a/composer/src/main/kotlin/com/gojuno/composer/Main.kt b/composer/src/main/kotlin/com/gojuno/composer/Main.kt index 6e97899..e73d072 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/Main.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/Main.kt @@ -6,8 +6,9 @@ import com.gojuno.commander.os.log import com.gojuno.commander.os.nanosToHumanReadableTime import com.gojuno.composer.html.writeHtmlReport import com.google.gson.Gson -import rx.Observable -import rx.schedulers.Schedulers +import io.reactivex.Observable +import io.reactivex.Single +import io.reactivex.schedulers.Schedulers import java.io.File import java.util.* import java.util.concurrent.TimeUnit @@ -105,9 +106,9 @@ private fun runAllTests(args: Args, testPackage: TestPackage.Valid, testRunner: } } } - .doOnNext { log("${it.size} connected adb device(s): $it") } + .doOnSuccess { log("${it.size} connected adb device(s): $it") } .flatMap { connectedAdbDevices -> - val runTestsOnDevices: List> = connectedAdbDevices.mapIndexed { index, device -> + val runTestsOnDevices: List> = connectedAdbDevices.mapIndexed { index, device -> val installTimeout = Pair(args.installTimeoutSeconds, TimeUnit.SECONDS) val installAppApk = device.installApk(pathToApk = args.appApkPath, timeout = installTimeout) val installTestApk = device.installApk(pathToApk = args.testApkPath, timeout = installTimeout) @@ -160,10 +161,9 @@ private fun runAllTests(args: Args, testPackage: TestPackage.Valid, testRunner: ).toSingleDefault(adbDeviceTestRun) } .subscribeOn(Schedulers.io()) - .toObservable() } } - Observable.zip(runTestsOnDevices, { results -> results.map { it as AdbDeviceTestRun } }) + Single.zip(runTestsOnDevices, { results: Array -> results.map { it as AdbDeviceTestRun } }) } .map { adbDeviceTestRuns -> when (args.shard) { @@ -199,11 +199,10 @@ private fun runAllTests(args: Args, testPackage: TestPackage.Valid, testRunner: log("Generating HTML report...") val htmlReportStartTime = System.nanoTime() writeHtmlReport(gson, suites, File(args.outputDirectory, "html-report"), Date()) - .doOnCompleted { log("HTML report generated, took ${(System.nanoTime() - htmlReportStartTime).nanosToHumanReadableTime()}.") } - .andThen(Observable.just(suites)) + .doOnComplete { log("HTML report generated, took ${(System.nanoTime() - htmlReportStartTime).nanosToHumanReadableTime()}.") } + .andThen(Single.just(suites)) } - .toBlocking() - .first() + .blockingGet() } private fun List.pairArguments(): List> = diff --git a/composer/src/main/kotlin/com/gojuno/composer/TestRun.kt b/composer/src/main/kotlin/com/gojuno/composer/TestRun.kt index 4648b25..f8d9bfc 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/TestRun.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/TestRun.kt @@ -4,9 +4,9 @@ import com.gojuno.commander.android.* import com.gojuno.commander.os.Notification import com.gojuno.commander.os.nanosToHumanReadableTime import com.gojuno.commander.os.process -import rx.Observable -import rx.Single -import rx.schedulers.Schedulers +import io.reactivex.Observable +import io.reactivex.Single +import io.reactivex.schedulers.Schedulers import java.io.File data class AdbDeviceTestRun( @@ -80,8 +80,8 @@ fun AdbDevice.runTests( adbDevice.log( "Test ${test.index}/${test.total} $status in " + - "${test.durationNanos.nanosToHumanReadableTime()}: " + - "${test.className}.${test.testName}" + "${test.durationNanos.nanosToHumanReadableTime()}: " + + "${test.className}.${test.testName}" ) } .flatMap { test -> @@ -92,12 +92,8 @@ fun AdbDevice.runTests( } .toList() - val adbDeviceTestRun = Observable - .zip( - Observable.fromCallable { System.nanoTime() }, - runningTests, - { time, tests -> time to tests } - ) + val adbDeviceTestRun = Single + .zip(Single.fromCallable { System.nanoTime() }, runningTests, { time, tests -> time to tests }) .map { (startTimeNanos, testsWithPulledFiles) -> val tests = testsWithPulledFiles.map { it.first } @@ -136,12 +132,12 @@ fun AdbDevice.runTests( // TODO: Stop when all expected tests were parsed from logcat and not when instrumentation finishes. // Logcat may be delivered with delay and that may result in missing logcat for last (n) tests (it's just a theory though). .takeUntil(testRunFinish) - .startWith(Unit) // To allow zip finish normally even if no tests were run. + .last(Unit) // Default value to allow zip finish normally even if no tests were run. - return Observable - .zip(adbDeviceTestRun, saveLogcat, testRunFinish) { suite, _, _ -> suite } + return Single + .zip(adbDeviceTestRun, saveLogcat, testRunFinish.singleOrError()) { suite, _, _ -> suite } .doOnSubscribe { adbDevice.log("Starting tests...") } - .doOnNext { testRun -> + .doOnSuccess { testRun -> adbDevice.log( "Test run finished, " + "${testRun.passedCount} passed, " + @@ -150,7 +146,6 @@ fun AdbDevice.runTests( ) } .doOnError { adbDevice.log("Error during tests run: $it") } - .toSingle() } data class PulledFiles( @@ -164,24 +159,27 @@ private fun pullTestFiles(adbDevice: AdbDevice, test: InstrumentationTest, outpu File(File(File(outputDir, "screenshots"), adbDevice.id), test.className).apply { mkdirs() } } .flatMap { screenshotsFolderOnHostMachine -> - adbDevice - .pullFolder( - // TODO: Add support for internal storage and external storage strategies. - folderOnDevice = "/storage/emulated/0/app_spoon-screenshots/${test.className}/${test.testName}", + // TODO: Add support for internal storage and external storage strategies. + val folderOnDevice = "/storage/emulated/0/app_spoon-screenshots/${test.className}/${test.testName}" + Single.concat( + adbDevice.pullFolder( + folderOnDevice = folderOnDevice, folderOnHostMachine = screenshotsFolderOnHostMachine, logErrors = verboseOutput + ), + adbDevice.deleteFolder( + folderOnDevice = folderOnDevice, + logErrors = verboseOutput ) + ) + .lastOrError() .map { File(screenshotsFolderOnHostMachine, test.testName) } } .map { screenshotsFolderOnHostMachine -> PulledFiles( files = emptyList(), // TODO: Pull test files. - screenshots = screenshotsFolderOnHostMachine.let { - when (it.exists()) { - true -> it.listFiles().toList() - else -> emptyList() - } - } + screenshots = screenshotsFolderOnHostMachine + .takeIf { it.exists() }?.listFiles()?.toList() ?: emptyList() ) } @@ -199,14 +197,18 @@ internal fun String.parseTestClassAndName(): Pair? { return null } -private fun saveLogcat(adbDevice: AdbDevice, logsDir: File): Observable> = Observable +private fun saveLogcat(adbDevice: AdbDevice, logsDir: File): Observable> = Single .just(logsDir to logcatFileForDevice(logsDir)) - .flatMap { (logsDir, fullLogcatFile) -> adbDevice.redirectLogcatToFile(fullLogcatFile).toObservable().map { logsDir to fullLogcatFile } } - .flatMap { (logsDir, fullLogcatFile) -> - data class result(val logcat: String = "", val startedTestClassAndName: Pair? = null, val finishedTestClassAndName: Pair? = null) + .flatMap { (logsDir, fullLogcatFile) -> adbDevice.redirectLogcatToFile(fullLogcatFile).map { logsDir to fullLogcatFile } } + .flatMapObservable { (logsDir, fullLogcatFile) -> + data class CaptureState( + val logcat: String = "", + val startedTestClassAndName: Pair? = null, + val finishedTestClassAndName: Pair? = null + ) tail(fullLogcatFile) - .scan(result()) { previous, newline -> + .scan(CaptureState()) { previous, newline -> val logcat = when (previous.startedTestClassAndName != null && previous.finishedTestClassAndName != null) { true -> newline false -> "${previous.logcat}\n$newline" @@ -217,7 +219,7 @@ private fun saveLogcat(adbDevice: AdbDevice, logsDir: File): Observable? = newline.parseTestClassAndName() val finishedTest: Pair? = newline.parseTestClassAndName() - result( + CaptureState( logcat = logcat, startedTestClassAndName = startedTest ?: previous.startedTestClassAndName, finishedTestClassAndName = finishedTest // Actual finished test should always overwrite previous. diff --git a/composer/src/main/kotlin/com/gojuno/composer/html/HtmlReport.kt b/composer/src/main/kotlin/com/gojuno/composer/html/HtmlReport.kt index ce69edc..5afb9ff 100644 --- a/composer/src/main/kotlin/com/gojuno/composer/html/HtmlReport.kt +++ b/composer/src/main/kotlin/com/gojuno/composer/html/HtmlReport.kt @@ -3,7 +3,7 @@ package com.gojuno.composer.html import com.gojuno.composer.Suite import com.google.gson.Gson import org.apache.commons.lang3.StringEscapeUtils -import rx.Completable +import io.reactivex.Completable import java.io.File import java.io.InputStream import java.text.SimpleDateFormat diff --git a/composer/src/test/kotlin/com/gojuno/composer/ApkSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/ApkSpec.kt index 9675148..1c6dff6 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/ApkSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/ApkSpec.kt @@ -1,13 +1,12 @@ package com.gojuno.composer import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe class ApkSpec : Spek({ - context("parse package from apk") { + describe("parse package from apk") { val testApkPath by memoized { fileFromJarResources("instrumentation-test.apk").absolutePath } diff --git a/composer/src/test/kotlin/com/gojuno/composer/ArgsSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/ArgsSpec.kt index f6740e1..a0ee482 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/ArgsSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/ArgsSpec.kt @@ -2,9 +2,8 @@ package com.gojuno.composer import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThatThrownBy -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe class ArgsSpec : Spek({ @@ -13,7 +12,7 @@ class ArgsSpec : Spek({ "--test-apk", "test_apk_path" ) - context("parse args with only required params") { + describe("parse args with only required params") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields) } @@ -37,7 +36,7 @@ class ArgsSpec : Spek({ } } - context("parse args with test runner specified") { + describe("parse args with test runner specified") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--test-runner", "test_runner")) @@ -48,7 +47,7 @@ class ArgsSpec : Spek({ } } - context("parse args with instrumentation arguments") { + describe("parse args with instrumentation arguments") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--instrumentation-arguments", "key1", "value1", "key2", "value2")) @@ -59,7 +58,7 @@ class ArgsSpec : Spek({ } } - context("parse args with instrumentation arguments with values with commas") { + describe("parse args with instrumentation arguments with values with commas") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--instrumentation-arguments", "key1", "value1,value2", "key2", "value3,value4")) @@ -70,7 +69,7 @@ class ArgsSpec : Spek({ } } - context("parse args with explicitly passed --shard") { + describe("parse args with explicitly passed --shard") { listOf(true, false).forEach { shard -> @@ -87,7 +86,7 @@ class ArgsSpec : Spek({ } } - context("parse args with explicitly passed --verbose-output") { + describe("parse args with explicitly passed --verbose-output") { listOf(true, false).forEach { verboseOutput -> @@ -104,7 +103,7 @@ class ArgsSpec : Spek({ } } - context("parse args with passed --devices") { + describe("parse args with passed --devices") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--devices", "emulator-5554")) @@ -115,7 +114,7 @@ class ArgsSpec : Spek({ } } - context("parse args with passed two --devices") { + describe("parse args with passed two --devices") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--devices", "emulator-5554", "emulator-5556")) @@ -126,7 +125,7 @@ class ArgsSpec : Spek({ } } - context("parse args with passed --device-pattern") { + describe("parse args with passed --device-pattern") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--device-pattern", "[abc|def]")) @@ -137,7 +136,7 @@ class ArgsSpec : Spek({ } } - context("parse args with passed --devices and --device-pattern") { + describe("parse args with passed --devices and --device-pattern") { it("raises argument error") { assertThatThrownBy { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--device-pattern", "[abc|def]") + arrayOf("--devices", "emulator-5554")) } @@ -146,7 +145,7 @@ class ArgsSpec : Spek({ } } - context("parse args with --keep-output-on-exit") { + describe("parse args with --keep-output-on-exit") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + "--keep-output-on-exit") @@ -157,7 +156,7 @@ class ArgsSpec : Spek({ } } - context("parse args with passed --install-timeout") { + describe("parse args with passed --install-timeout") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--install-timeout", "600")) @@ -168,7 +167,7 @@ class ArgsSpec : Spek({ } } - context("parse args with passed --fail-if-no-tests") { + describe("parse args with passed --fail-if-no-tests") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--fail-if-no-tests", "false")) @@ -179,7 +178,7 @@ class ArgsSpec : Spek({ } } - context("parse args with explicitly passed --fail-if-no-tests") { + describe("parse args with explicitly passed --fail-if-no-tests") { listOf(true, false).forEach { failIfNoTests -> @@ -196,7 +195,7 @@ class ArgsSpec : Spek({ } } - context("parse args with --with-orchestrator") { + describe("parse args with --with-orchestrator") { val args by memoized { parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--with-orchestrator", "true")) @@ -207,15 +206,15 @@ class ArgsSpec : Spek({ } } - context("parse args with passed --extra-apks") { + describe("parse args with passed --extra-apks") { - val args by memoized { - parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--extra-apks", "apk1.apk", "apk2.apk")) - } + val args by memoized { + parseArgs(rawArgsWithOnlyRequiredFields + arrayOf("--extra-apks", "apk1.apk", "apk2.apk")) + } - it("parses correctly two extra apks") { - assertThat(args.extraApks).isEqualTo(listOf("apk1.apk", "apk2.apk")) + it("parses correctly two extra apks") { + assertThat(args.extraApks).isEqualTo(listOf("apk1.apk", "apk2.apk")) + } } - } }) diff --git a/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt index 430cbc4..6ec491d 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/InstrumentationSpec.kt @@ -3,19 +3,18 @@ package com.gojuno.composer import com.gojuno.composer.InstrumentationTest.Status.Failed import com.gojuno.composer.InstrumentationTest.Status.Ignored import com.gojuno.composer.InstrumentationTest.Status.Passed +import io.reactivex.observers.TestObserver import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it -import rx.observers.TestSubscriber +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe import java.util.concurrent.TimeUnit.SECONDS class InstrumentationSpec : Spek({ - context("read output with failed test") { + describe("read output with failed test") { val entries by memoized { readInstrumentationOutput(fileFromJarResources("instrumentation-output-failed-test.txt")) } - val entriesSubscriber by memoized { TestSubscriber() } + val entriesSubscriber by memoized { TestObserver() } perform { entries.subscribe(entriesSubscriber) @@ -105,7 +104,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 stream = normalizeLinefeed(stream) // We have no control over system time in tests. - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( + assertThat(entriesSubscriber.values().map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( InstrumentationEntry( numTests = 4, stream = "com.example.test.TestClass:", @@ -198,7 +197,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("completes stream") { - entriesSubscriber.assertCompleted() + entriesSubscriber.assertComplete() } it("does not emit error") { @@ -207,7 +206,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 context("as tests") { - val testsSubscriber by memoized { TestSubscriber() } + val testsSubscriber by memoized { TestObserver() } perform { entries.asTests().subscribe(testsSubscriber) @@ -256,7 +255,7 @@ at android.support.test.runner.JunoAndroidRunner.onStart(JunoAndroidRunner.kt:10 at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:1932)""" stacktrace = normalizeLinefeed(stacktrace) - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( + assertThat(testsSubscriber.values().map { it.copy(durationNanos = 0) }).isEqualTo(listOf( InstrumentationTest( index = 1, total = 4, @@ -293,7 +292,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("completes stream") { - testsSubscriber.assertCompleted() + testsSubscriber.assertComplete() } it("does not emit error") { @@ -302,10 +301,10 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } } - context("read output with 0 tests") { + describe("read output with 0 tests") { val entries by memoized { readInstrumentationOutput(fileFromJarResources("instrumentation-output-0-tests.txt")) } - val entriesSubscriber by memoized { TestSubscriber() } + val entriesSubscriber by memoized { TestObserver() } perform { entries.subscribe(entriesSubscriber) @@ -317,7 +316,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("completes stream") { - entriesSubscriber.assertCompleted() + entriesSubscriber.assertComplete() } it("does not emit error") { @@ -326,7 +325,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 context("as tests") { - val testsSubscriber by memoized { TestSubscriber() } + val testsSubscriber by memoized { TestObserver() } perform { entries.asTests().subscribe(testsSubscriber) @@ -338,7 +337,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("completes stream") { - testsSubscriber.assertCompleted() + testsSubscriber.assertComplete() } it("does not emit error") { @@ -347,10 +346,10 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } } - context("read unordered output") { + describe("read unordered output") { val entries by memoized { readInstrumentationOutput(fileFromJarResources("instrumentation-unordered-output.txt")) } - val entriesSubscriber by memoized { TestSubscriber() } + val entriesSubscriber by memoized { TestObserver() } perform { entries.subscribe(entriesSubscriber) @@ -359,7 +358,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 it("emits expected entries") { // We have no control over system time in tests. - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( + assertThat(entriesSubscriber.values().map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( InstrumentationEntry( numTests = 3, stream = "com.example.test.TestClass:", @@ -430,7 +429,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("completes stream") { - entriesSubscriber.assertCompleted() + entriesSubscriber.assertComplete() } it("does not emit error") { @@ -439,7 +438,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 context("as tests") { - val testsSubscriber by memoized { TestSubscriber() } + val testsSubscriber by memoized { TestObserver() } perform { entries.asTests().subscribe(testsSubscriber) @@ -447,7 +446,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("emits expected tests") { - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( + assertThat(testsSubscriber.values().map { it.copy(durationNanos = 0) }).isEqualTo(listOf( InstrumentationTest( index = 1, total = 3, @@ -476,7 +475,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("completes stream") { - testsSubscriber.assertCompleted() + testsSubscriber.assertComplete() } it("does not emit error") { @@ -485,10 +484,10 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } } - context("read output with ignored test") { + describe("read output with ignored test") { val entries by memoized { readInstrumentationOutput(fileFromJarResources("instrumentation-output-ignored-test.txt")) } - val entriesSubscriber by memoized { TestSubscriber() } + val entriesSubscriber by memoized { TestObserver() } perform { entries.subscribe(entriesSubscriber) @@ -497,7 +496,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 it("emits expected entries") { // We have no control over system time in tests. - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( + assertThat(entriesSubscriber.values().map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( InstrumentationEntry( numTests = 2, stream = "com.example.test.TestClass:", @@ -546,7 +545,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("completes stream") { - entriesSubscriber.assertCompleted() + entriesSubscriber.assertComplete() } it("does not emit error") { @@ -555,7 +554,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 context("as tests") { - val testsSubscriber by memoized { TestSubscriber() } + val testsSubscriber by memoized { TestObserver() } perform { entries.asTests().subscribe(testsSubscriber) @@ -563,7 +562,7 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } it("emits expected tests") { - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( + assertThat(testsSubscriber.values().map { it.copy(durationNanos = 0) }).isEqualTo(listOf( InstrumentationTest( index = 1, total = 2, @@ -585,10 +584,10 @@ at android.app.Instrumentation.InstrumentationThread.run(Instrumentation.java:19 } } - context("read output containing test with assumption violation") { + describe("read output containing test with assumption violation") { val entries by memoized { readInstrumentationOutput(fileFromJarResources("instrumentation-output-assumption-violation.txt")) } - val entriesSubscriber by memoized { TestSubscriber() } + val entriesSubscriber by memoized { TestObserver() } perform { entries.subscribe(entriesSubscriber) @@ -629,7 +628,7 @@ at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.jav at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.java:2074)""" stacktrace = normalizeLinefeed(stacktrace) - assertThat(entriesSubscriber.onNextEvents.map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( + assertThat(entriesSubscriber.values().map { it.copy(timestampNanos = 0) }).isEqualTo(listOf( InstrumentationEntry( numTests = 1, stream = "com.example.test.TestClass:", @@ -656,7 +655,7 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja } it("completes stream") { - entriesSubscriber.assertCompleted() + entriesSubscriber.assertComplete() } it("does not emit error") { @@ -665,7 +664,7 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja context("as tests") { - val testsSubscriber by memoized { TestSubscriber() } + val testsSubscriber by memoized { TestObserver() } perform { entries.asTests().subscribe(testsSubscriber) @@ -704,7 +703,7 @@ at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:5 at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:375) at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.java:2074)""" stacktrace = normalizeLinefeed(stacktrace) - assertThat(testsSubscriber.onNextEvents.map { it.copy(durationNanos = 0) }).isEqualTo(listOf( + assertThat(testsSubscriber.values().map { it.copy(durationNanos = 0) }).isEqualTo(listOf( InstrumentationTest( index = 1, total = 1, @@ -718,11 +717,11 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja } } - context("read output with unable to find instrumentation info error") { + describe("read output with unable to find instrumentation info error") { val outputFile = fileFromJarResources("instrumentation-output-unable-to-find-instrumentation-info.txt") val entries by memoized { readInstrumentationOutput(outputFile) } - val entriesSubscriber by memoized { TestSubscriber() } + val entriesSubscriber by memoized { TestObserver() } perform { entries.subscribe(entriesSubscriber) @@ -730,7 +729,7 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja } it("emits exception with human readable message") { - assertThat(entriesSubscriber.onErrorEvents.first()).hasMessage( + assertThat(entriesSubscriber.errors().first()).hasMessage( "Instrumentation was unable to run tests using runner com.composer.example.ExampleAndroidJUnitRunner.\n" + "Most likely you forgot to declare test runner in AndroidManifest.xml or build.gradle.\n" + "Detailed log can be found in ${outputFile.path} or Logcat output.\n" + @@ -739,11 +738,11 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja } } - context("read output with crash") { + describe("read output with crash") { val outputFile = fileFromJarResources("instrumentation-output-app-crash.txt") val entries by memoized { readInstrumentationOutput(outputFile) } - val entriesSubscriber by memoized { TestSubscriber() } + val entriesSubscriber by memoized { TestObserver() } perform { entries.subscribe(entriesSubscriber) @@ -751,7 +750,7 @@ at android.app.Instrumentation${'$'}InstrumentationThread.run(Instrumentation.ja } it("emits exception describing issue") { - assertThat(entriesSubscriber.onErrorEvents.first()).hasMessage( + assertThat(entriesSubscriber.errors().first()).hasMessage( "Application process crashed. Check Logcat output for more details." ) } diff --git a/composer/src/test/kotlin/com/gojuno/composer/JUnitReportSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/JUnitReportSpec.kt index 824ae2f..72d92f7 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/JUnitReportSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/JUnitReportSpec.kt @@ -2,11 +2,11 @@ package com.gojuno.composer import com.gojuno.commander.android.AdbDevice import com.gojuno.composer.AdbDeviceTest.Status.* +import io.reactivex.observers.TestObserver +import io.reactivex.subscribers.TestSubscriber import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it -import rx.observers.TestSubscriber +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe import java.util.concurrent.TimeUnit.MILLISECONDS import java.util.concurrent.TimeUnit.SECONDS @@ -14,10 +14,10 @@ class JUnitReportSpec : Spek({ val LF = System.getProperty("line.separator") - context("write test run result as junit4 report to file") { + describe("write test run result as junit4 report to file") { val adbDevice by memoized { AdbDevice(id = "testDevice", online = true) } - val subscriber by memoized { TestSubscriber() } + val subscriber by memoized { TestObserver() } val outputFile by memoized { testFile() } perform { @@ -124,7 +124,7 @@ class JUnitReportSpec : Spek({ } it("emits completion") { - subscriber.assertCompleted() + subscriber.assertComplete() } it("does not emit values") { diff --git a/composer/src/test/kotlin/com/gojuno/composer/LogLineParserSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/LogLineParserSpec.kt index 575142e..ae88416 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/LogLineParserSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/LogLineParserSpec.kt @@ -1,13 +1,12 @@ package com.gojuno.composer import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe class LogLineParserSpec : Spek({ - context("parse TestRunner log line with long prefix") { + describe("parse TestRunner log line with long prefix") { context("parse started log") { val args by memoized { @@ -30,7 +29,7 @@ class LogLineParserSpec : Spek({ } } - context("parse TestRunner log line with short prefix") { + describe("parse TestRunner log line with short prefix") { context("parse started log") { @@ -55,7 +54,7 @@ class LogLineParserSpec : Spek({ } } - context("parse non TestRunner started/finished logs") { + describe("parse non TestRunner started/finished logs") { it("does not parse empty log") { assertThat("".parseTestClassAndName()).isNull() diff --git a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlDeviceSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlDeviceSpec.kt index 341e9f1..80f87d9 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlDeviceSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlDeviceSpec.kt @@ -3,13 +3,12 @@ package com.gojuno.composer.html import com.gojuno.composer.Device import com.gojuno.composer.testFile import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe class HtmlDeviceSpec : Spek({ - context("Device.toHtmlDevice") { + describe("Device.toHtmlDevice") { val device = Device(id = "testDevice1", logcat = testFile(), instrumentationOutput = testFile(), model = "testModel1") diff --git a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullSuiteSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullSuiteSpec.kt index 141c724..ef6a246 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullSuiteSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullSuiteSpec.kt @@ -6,14 +6,13 @@ import com.gojuno.composer.Device import com.gojuno.composer.Suite import com.gojuno.composer.testFile import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe import java.util.concurrent.TimeUnit.NANOSECONDS class HtmlFullSuiteSpec : Spek({ - context("Suite.toHtmlFullSuite") { + describe("Suite.toHtmlFullSuite") { val suite = Suite( testPackage = "p", devices = listOf( diff --git a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullTestSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullTestSpec.kt index 7a58c09..892da00 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullTestSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlFullTestSpec.kt @@ -4,14 +4,13 @@ import com.gojuno.commander.android.AdbDevice import com.gojuno.composer.AdbDeviceTest import com.gojuno.composer.testFile import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe import java.util.concurrent.TimeUnit.NANOSECONDS class HtmlFullTestSpec : Spek({ - context("AdbDeviceTest.toHtmlTest") { + describe("AdbDeviceTest.toHtmlTest") { val adbDeviceTest = AdbDeviceTest( adbDevice = AdbDevice(id = "testDevice", online = true, model = "testModel"), diff --git a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlReportSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlReportSpec.kt index 3c0dc4d..d8fd3e3 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlReportSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlReportSpec.kt @@ -8,10 +8,8 @@ import com.gojuno.composer.perform import com.google.gson.Gson import org.assertj.core.api.Assertions.assertThat import org.assertj.core.util.Files -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it -import rx.observers.TestSubscriber +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe import java.io.File import java.util.* import java.util.concurrent.TimeUnit.MILLISECONDS @@ -19,7 +17,7 @@ import java.util.concurrent.TimeUnit.SECONDS class HtmlReportSpec : Spek({ - context("writeHtmlReport") { + describe("writeHtmlReport") { val outputDir by memoized { Files.newTemporaryFolder() } @@ -71,8 +69,6 @@ class HtmlReportSpec : Spek({ ) } - val subscriber by memoized { TestSubscriber() } - fun File.deleteOnExitRecursively() { when (isDirectory) { false -> deleteOnExit() @@ -82,14 +78,17 @@ class HtmlReportSpec : Spek({ val date by memoized { Date(1496848677000) } + val subscriber by memoized { + writeHtmlReport(Gson(), suites, outputDir, date).test() + } + perform { - writeHtmlReport(Gson(), suites, outputDir, date).subscribe(subscriber) subscriber.awaitTerminalEvent(5, SECONDS) outputDir.deleteOnExitRecursively() } it("completes") { - subscriber.assertCompleted() + subscriber.assertComplete() } it("does not emit error") { @@ -202,7 +201,7 @@ class HtmlReportSpec : Spek({ } } - context("cssClassForLogcatLine") { + describe("cssClassForLogcatLine") { context("verbose") { diff --git a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortSuiteSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortSuiteSpec.kt index 0d15bec..bdacaac 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortSuiteSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortSuiteSpec.kt @@ -6,14 +6,13 @@ import com.gojuno.composer.Device import com.gojuno.composer.Suite import com.gojuno.composer.testFile import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe import java.util.concurrent.TimeUnit.NANOSECONDS class HtmlShortSuiteSpec : Spek({ - context("Suite.toHtmlShortSuite") { + describe("Suite.toHtmlShortSuite") { val suite by memoized { Suite( testPackage = "p", diff --git a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortTestSpec.kt b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortTestSpec.kt index 0afcf41..b68bcfd 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortTestSpec.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/html/HtmlShortTestSpec.kt @@ -1,13 +1,12 @@ package com.gojuno.composer.html import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.Spek -import org.jetbrains.spek.api.dsl.context -import org.jetbrains.spek.api.dsl.it +import org.spekframework.spek2.Spek +import org.spekframework.spek2.style.specification.describe class HtmlShortTestSpec : Spek({ - context("HtmlFullTest.toHtmlShortTest") { + describe("HtmlFullTest.toHtmlShortTest") { val htmlFullTest by memoized { HtmlFullTest( diff --git a/composer/src/test/kotlin/com/gojuno/composer/test.kt b/composer/src/test/kotlin/com/gojuno/composer/test.kt index 99ae482..8cfc2ee 100644 --- a/composer/src/test/kotlin/com/gojuno/composer/test.kt +++ b/composer/src/test/kotlin/com/gojuno/composer/test.kt @@ -1,15 +1,15 @@ package com.gojuno.composer -import org.jetbrains.spek.api.dsl.SpecBody +import org.spekframework.spek2.style.specification.Suite import java.io.File inline fun fileFromJarResources(name: String) = File(C::class.java.classLoader.getResource(name).file) fun testFile(): File = createTempFile().apply { deleteOnExit() } -fun SpecBody.perform(body: () -> Unit) = beforeEachTest(body) +fun Suite.perform(body: () -> Unit) = beforeEachTest(body) -fun SpecBody.cleanup(body: () -> Unit) = afterEachTest(body) +fun Suite.cleanup(body: () -> Unit) = afterEachTest(body) /** Make a Unix-formatted String compliant with current operating system's newline format */ fun normalizeLinefeed(str: String): String = str.replace("\n", System.getProperty("line.separator")); diff --git a/dependencies.gradle b/dependencies.gradle deleted file mode 100644 index 6808688..0000000 --- a/dependencies.gradle +++ /dev/null @@ -1,37 +0,0 @@ -ext.versions = [ - kotlin : '1.1.1', - - rxJava : '1.3.0', - jCommander : '1.71', - commander : '0.1.7', - apacheCommonsIo : '2.5', - apacheCommonsLang: '3.5', - gson : '2.8.0', - dexParser : '1.1.0', - - junit : '4.12', - junitPlatform : '1.0.0-M4', - spek : '1.1.2', - assertJ : '3.5.2', -] - -ext.libraries = [ - kotlinStd : "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin", - kotlinRuntime : "org.jetbrains.kotlin:kotlin-runtime:$versions.kotlin", - kotlinReflect : "org.jetbrains.kotlin:kotlin-reflect:$versions.kotlin", - - rxJava : "io.reactivex:rxjava:$versions.rxJava", - jCommander : "com.beust:jcommander:$versions.jCommander", - commanderOs : "com.gojuno.commander:os:$versions.commander", - commanderAndroid : "com.gojuno.commander:android:$versions.commander", - apacheCommonsIo : "commons-io:commons-io:$versions.apacheCommonsIo", - apacheCommonsLang : "org.apache.commons:commons-lang3:$versions.apacheCommonsLang", - gson : "com.google.code.gson:gson:$versions.gson", - dexParser : "com.linkedin.dextestparser:parser:$versions.dexParser", - - junit : "junit:junit:$versions.junit", - spek : "org.jetbrains.spek:spek-api:$versions.spek", - junitPlatformRunner : "org.junit.platform:junit-platform-launcher:$versions.junitPlatform", - spekJunitPlatformEngine: "org.jetbrains.spek:spek-junit-platform-engine:$versions.spek", - assertJ : "org.assertj:assertj-core:$versions.assertJ", -] diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..4cf9446 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +group=com.gojuno.composer +version=0.7.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 11d62cc..91ca28c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f5e055a..e0c4de3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Apr 23 00:56:17 PDT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip diff --git a/gradlew b/gradlew index 4453cce..cccdd3d 100755 --- a/gradlew +++ b/gradlew @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -155,7 +155,7 @@ if $cygwin ; then fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " }