https://github.com/wakingrufus/tornadofx-test
Kotlin extensions for TornadoFX and TestFX
https://github.com/wakingrufus/tornadofx-test
kotlin testing tornadofx
Last synced: 2 months ago
JSON representation
Kotlin extensions for TornadoFX and TestFX
- Host: GitHub
- URL: https://github.com/wakingrufus/tornadofx-test
- Owner: wakingrufus
- License: lgpl-3.0
- Created: 2018-07-19T15:58:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-19T21:12:43.000Z (about 7 years ago)
- Last Synced: 2025-01-15T11:07:30.046Z (9 months ago)
- Topics: kotlin, testing, tornadofx
- Language: Kotlin
- Size: 11.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:```kotlin
class TestFragment : Fragment() {
companion object : KLogging()val string: String by param()
override val root = vbox {
label(string){
id = "label"
}
}
}
```### JUnit
Use the `tornadofx-test-junit` library to test your Views and Fragments with JUnit4```kotlin
class TestFragmentTest : TornadoFxTest() {@Test
fun test() {
showViewWithParams(mapOf("string" to "string"))verifyThat("#label", hasText("string"))
}
}
```Use the `tornadofx-test-junit5` library to test your Views and Fragments with JUnit5
```kotlin
@ExtendWith(ApplicationExtension::class)
class TestFragmentTest : TornadoFxTest() {@Test
fun test() {
showViewWithParams(mapOf("string" to "string"))verifyThat("#label", hasText("string"))
}
}
```