我能';不要将Kotlin用于Serenity bdd
我尝试使用kotlin进行serenity bed框架的测试,但这不起作用 比如说我能';不要将Kotlin用于Serenity bdd,kotlin,serenity-bdd,Kotlin,Serenity Bdd,我尝试使用kotlin进行serenity bed框架的测试,但这不起作用 比如说 public class EndUserSteps { var dictionaryPage: DictionaryPage = null!! @Step fun enters(keyword: String) { dictionaryPage.enter_keywords(keyword) } @Step fun starts_search(
public class EndUserSteps {
var dictionaryPage: DictionaryPage = null!!
@Step
fun enters(keyword: String) {
dictionaryPage.enter_keywords(keyword)
}
@Step
fun starts_search() {
dictionaryPage.lookup_terms()
}
@Step
fun should_see_definition(definition: String) {
assertThat(dictionaryPage.definitions, hasItem(containsString(definition)))
}
@Step
fun is_the_home_page() {
dictionaryPage.open()
}
@Step
fun looks_for(term: String) {
enters(term)
starts_search()
}
}
其他代码都是用Java编写的
输出:
(net.SerentityBDD.core.exceptions.StepInitializationException:未能为EndUserSteps创建步骤库:无法为最终类ru.tinkoff.atesting.steps.Serentity.EndUserSteps创建子类)
你能帮我吗?
有什么想法吗?在Kotlin类中(相当于Java的final
)。要允许子类化,您需要将它们标记为open
。(开放类X
)
类上的open注释与Java的final相反:它允许其他人从这个类继承。默认情况下,Kotlin中的所有类都是final,对应于有效的Java,第17项:继承的设计和文档,否则禁止。-
在Kotlin类中(相当于Java的final
)。要允许子类化,您需要将它们标记为open
。(开放类X
)
类上的open注释与Java的final相反:它允许其他人从这个类继承。默认情况下,Kotlin中的所有类都是final,对应于有效的Java,第17项:继承的设计和文档,否则禁止。-
你是对的!修饰符在课前打开,真正解决了启动的问题。我也在尝试与科特林一起使用宁静。你能帮忙吗?你能分享一些工作回购的样本吗?你是对的!修饰符在课前打开,真正解决了启动的问题。我也在尝试与科特林一起使用宁静。你能帮忙吗?你能分享一些工作回购的样本吗?