项目作者: wakingrufus

项目描述 :
Kotlin extensions for TornadoFX and TestFX
高级语言: Kotlin
项目地址: git://github.com/wakingrufus/tornadofx-test.git
创建时间: 2018-07-19T15:58:10Z
项目社区:https://github.com/wakingrufus/tornadofx-test

开源协议:GNU Lesser General Public License v3.0

下载


tornadofx-test

Kotlin extensions for TornadoFX and TestFX

Testing a View or Fragment

You can test a View or Fragment in isolation.
Suppose you have the following Fragment:

  1. class TestFragment : Fragment() {
  2. companion object : KLogging()
  3. val string: String by param()
  4. override val root = vbox {
  5. label(string){
  6. id = "label"
  7. }
  8. }
  9. }

JUnit

Use the tornadofx-test-junit library to test your Views and Fragments with JUnit4

  1. class TestFragmentTest : TornadoFxTest() {
  2. @Test
  3. fun test() {
  4. showViewWithParams<TestFragment>(mapOf("string" to "string"))
  5. verifyThat("#label", hasText("string"))
  6. }
  7. }

Use the tornadofx-test-junit5 library to test your Views and Fragments with JUnit5

  1. @ExtendWith(ApplicationExtension::class)
  2. class TestFragmentTest : TornadoFxTest() {
  3. @Test
  4. fun test() {
  5. showViewWithParams<TestFragment>(mapOf("string" to "string"))
  6. verifyThat("#label", hasText("string"))
  7. }
  8. }