[ 
https://issues.apache.org/jira/browse/BEAM-3415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17293053#comment-17293053
 ] 

Emīls Šolmanis commented on BEAM-3415:
--------------------------------------

Hi all,

There's definitely interest from my (and my org's) side as well, especially as 
we're largely using Kotlin and Beam is the only reason we have Junit4 lying 
around. I've done a basic PoC and it _seems_ a trivial fix by means of Junit5's 
`BeforeTestExecutionCallback` and `AfterTestExecutionCallback` extension hooks. 
The translated code ends up being
{code:java}
override fun beforeTestExecution(context: ExtensionContext) {
    options.`as`(ApplicationNameOptions::class.java).appName = 
context.displayName
    setDeducedEnforcementLevel()
}

override fun afterTestExecution(context: ExtensionContext) {
    enforcement.get().afterUserCodeFinished()
}
{code}
in Kotlin, and that gets me a working Junit5 pipeline. I had to fudge it 
significantly because a ton of things used in `TestPipeline` are 
package-private, but it seems to work. Caveat we don't use remote-runner 
testing.

I'm curious to hear from someone more familiar with the test harness, am I 
overlooking something, or is it simply the fact that Junit5 has evolved to make 
this simple now? If it's the latter I'm happy to put together a PR, should be 
easy to support both 4 and 5.

> JUnit5 support
> --------------
>
>                 Key: BEAM-3415
>                 URL: https://issues.apache.org/jira/browse/BEAM-3415
>             Project: Beam
>          Issue Type: New Feature
>          Components: testing
>            Reporter: Romain Manni-Bucau
>            Priority: P3
>          Time Spent: 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to