https://kotlinlang.org logo
#kotest
Title
# kotest
m

Matthew Wright

06/17/2022, 3:56 PM
👋 I was half expecting kotest to play nice with Junit5 extensions (such as Selenium-Jupiter) with at least
AnnotationSpec
but it doesn't appear kotest supports
ParameterResolver
(Junit docs). Am I understanding this correctly?
s

sam

06/17/2022, 4:25 PM
No it's not compatible with junit rules. What are you trying to do as there might be a kotest way
m

Matthew Wright

06/17/2022, 5:18 PM
I was trying to figure out if I could convert a JUnit annotation style test to use kotest and still use the Selenium-Jupiter extension with
@ExtendWith
(not old style JUnit4 rules). Here's the test in question. I assumed that if I used kotest's JUnit5 engine/runner that the extension would work with
AnnotationSpec
. I was able to get the engine/runner working and convert the test to look like so:
Copy code
@ExtendWith(SeleniumJupiter::class)
class EmailAndPasswordRegistrationWorkflowSpec : AnnotationSpec() {

  @Test
  fun happyPath(driver: WebDriver) {
      ...
  }
}
But the
driver: WebDriver
parameter is not supplied and the runner/engine fails when trying to execute the test.
I know I could use
testcontainers
to manage webdriver containers, but browsers in containers aren't easy to work with when you want to run tests against something on
localhost
😛
s

sam

06/17/2022, 5:32 PM
Yeah the ExtendWith isn't supported I'm afraid.
m

Matthew Wright

06/17/2022, 5:34 PM
Gotcha. I figured as much but wanted to confirm.
I stumbled onto JunitExtensionAdapter. Any thoughts on if it could support the ParameterResolver extension?
s

sam

06/17/2022, 5:49 PM
Yes in theory it should work, but it's not really tested fully yet.
1
a

abendt

06/23/2022, 6:55 AM
@Matthew Wright Looks like you’re wanting to write a webdriver based test? did you consider FluentLenium? it provides a kotest integration • https://fluentlenium.com/docs/test-runners/#kotestexample test
m

Matthew Wright

06/24/2022, 12:02 AM
No! Hadn't seen this before. I'll check it out
43 Views