- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
spek
尝试查找测试时我遇到了崩溃。我尝试了许多不同的版本和示例配置。我从命令行运行。 Gradle 4.0,mac osx。任何帮助将不胜感激!
这里是错误:
WARNING: TestEngine with ID 'spek' failed to discover tests
java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.findAllClassesInClasspathRoot(Ljava/nio/file/Path;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/List;
at org.jetbrains.spek.engine.SpekTestEngine.resolveSpecs(SpekTestEngine.kt:66)
at org.jetbrains.spek.engine.SpekTestEngine.discover(SpekTestEngine.kt:50)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
at org.junit.platform.launcher.Launcher.execute(Launcher.java:96)
at org.junit.platform.console.tasks.ConsoleTestExecutor.executeTests(ConsoleTestExecutor.java:65)
at org.junit.platform.console.tasks.ConsoleTestExecutor.lambda$execute$0(ConsoleTestExecutor.java:57)
at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33)
at org.junit.platform.console.tasks.ConsoleTestExecutor.execute(ConsoleTestExecutor.java:57)
at org.junit.platform.console.ConsoleLauncher.executeTests(ConsoleLauncher.java:85)
at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:75)
at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:48)
at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:40)
这是我当前的 build.gradle:
buildscript {
repositories {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$project.ext.kotlinVersion"
}
}
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'idea'
apply plugin: 'kotlin'
apply plugin: 'java'
junitPlatform {
filters {
engines {
include 'spek', 'junit-jupiter', 'junit-vintage'
}
}
}
dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib-jre8:$project.ext.kotlinVersion")
// testCompile 'junit:junit:4.12'
testCompile 'org.jetbrains.spek:spek-api:1.1.2'
testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.2'
testCompile 'org.junit.platform:junit-platform-runner:1.0.0-M5'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-M5'
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testRuntime "org.junit.vintage:junit-vintage-engine:4.12.0-M5"
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-M5"
testRuntime "org.junit.platform:junit-platform-console:1.0.0-M5"
testCompile "com.google.code.gson:gson:$project.ext.gsonVersion"
}
repositories {
mavenCentral()
}
最佳答案
对于 Spek 1.1.2,您必须使用 JUnit 平台版本 1.0.0-M4,因为 M5 具有破坏性的 API 更改,这使得它们不兼容。
关于unit-testing - Kotlin Spek Framework 崩溃 w/Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45020938/
Spek 文档引用 As a best practice you typically want test values to be unique for each test this can be d
我检查了文档: https://spekframework.org/migration/#maven-coordinates 我想试用版本 2.x.x,所以我添加了 build.gradle : te
这是我的测试: object MySpek : Spek({ val myMock1: MyMock1 = mock() val myMock2: MyMock2 = mock()
有些测试需要运行数据库,例如,使用测试容器库。启动它显然需要时间。 有没有办法对跨越多个文件的整个 Spek 套件只执行一次此操作?文档对此没有任何说明。 有人知道为什么这还没有实现吗? 最佳答案 这
我正在努力了解 Spek 中的固定装置。 The Calculator example in the docs很容易理解,但我不确定当一些固定装置是有状态的时候如何进行结构化设置/拆卸。例如,如果我正
我正在尝试使用 Spek 测试 Retrofit api 它在 on{...} block 上抛出 nullPointerException 相关堆栈跟踪:https://pastebin.com/g
我正在使用 Kotlin、Spring 和 Spek 实现简单的微服务。我想测试我的存储库,但我想知道如何将 repo 注入(inject) spek 测试用例。每个示例或教程都基于创建这样的新引用:
我写了一个失败的 Spek 测试,因为我对涉及多个协程和 it 的执行顺序做出了错误的假设。职能: given("a test") { runBlocking { print("a") }
我有一个现有的 Java 项目,我希望在其中引入一些规范测试(在 kotlin ofc 中) class CalcSpec: Spek({ given("A calculator") {
我试图将我的测试区分为单元测试和集成测试。我的想法是使用新的 JUnit5 注释 @Tag("unit"),它非常适合我的 JUnit 测试,但我无法让它与 Spek 一起工作。 我目前拥有的是我的类
我正在尝试将 Spek 测试框架添加到我的 Android Studio 项目中。按照说明Here ,我最终将以下内容添加到我的模块 build.gradle: testCompile 'org.je
我想为我的测试使用一个通用的夹具: @RunWith(JUnitPlatform::class) abstract class BaseSpek: Spek({ beforeGroup {pr
对 Kotlin 有点熟悉,我想给它介绍另一个 Android-Java 项目,作为测试的第一步。我决定直接从 Spek 开始. 我在待测模块的build.gradle中添加了如下依赖: testCo
我有一个基于 Gradle 的 Kotlin 项目,其中包含一些 Spek测试,基于 JUnit 并且应该与 Idea 兼容。 但我在上下文菜单中没有看到“运行”菜单项。 为什么?为了能够像其他 JU
严格重现我的问题的 repo :https://github.com/paul-hammant/kotlin-webdriver-snafu 规范,再简单不过了: class WebDriverSpe
spek 尝试查找测试时我遇到了崩溃。我尝试了许多不同的版本和示例配置。我从命令行运行。 Gradle 4.0,mac osx。任何帮助将不胜感激! 这里是错误: WARNING: TestEngin
如何使用 kotlin 启动 spek 测试以测试是否已调用 HTTP 方法 post?让我失望的是我在模拟上下文时遇到了麻烦。我想传入 HttpMethod.POST 以外的方法来触发 else b
我很难配置基于 JUnit Jupiter 的测试环境 (5)。我在那里有两个不同的错误: WARNING: TestEngine with ID 'spek' failed to discover
我是在 kotlin 测试中使用 spek 的新手。使用 spek 时,在 logcat 上出现以下错误。我不明白我为什么得到这个 java.lang.ClassNotFoundException:
我是一名优秀的程序员,十分优秀!