JUnit 5 Support #55
JUnit 5 Support #55
Comments
Yes, I create a JUnit Jupiter extension at the end of October. I post updates here. |
@stefanbirkner What can you suggest to use with JUnit 5 for stdout capturing? |
Pleased wait for my JUnit Jupiter extension. I start development tomorrow. |
Awesome. Looking forward to it! ... b/c I otherwise might have to put something together myself. |
BTW, I've been meaning to show the Spring Boot team how to migrate their https://twitter.com/sam_brannen/status/919230917129981953 Not that you, @stefanbirkner, plan to do it the same way, but perhaps it serves as inspiration for you. |
Hello Stefan, |
Currently I'm working on two things:
I cannot estimate a release date because it depends very much on the amount of free time that I'm able to spend on System Rules. I started mid October last year and I'm still not finished :-( |
The rewrite of the tests is finished. After fixing #61 I create a library that is independent of JUnit 4. |
I started to create a library called System Lambda that solves the same testing problems like System Rules but without a dependency to a test framework. There may be a JUnit Lambda extension afterwards, but I start with an independent library because it can be used by TestNG users, too. |
https://gist.github.com/syhily/1ae31ba0394668eb040917387a698449 |
The lambda stuff for sftp is really nice, but sometimes the port is needed before at the class initialization level, so that it can be injected into systemproperties for spring-boot to pick it up before initialization. This is not possible when I cannot control the lifecycle myself. |
I think you are talking about Fake SFTP Server Lambda. Can you create an issue here and describe what you are looking for. |
Well - not really the lambda case. I've migrated from junit4 to junit5, see stefanbirkner/fake-sftp-server-rule#11 for the initial issue. WDYT? |
Is there a way already to use System Rules (to set environment variable) in Junit 5? |
Unfortunately not, but I found some time to continue my work on System Lambda. |
+1 for finishing up migrations to JUnit5, particularly for |
In the meantime you can copy code from https://github.com/stefanbirkner/system-lambda/blob/master/src/main/java/com/github/stefanbirkner/systemlambda/SystemLambda.java The replacement for EnvironmentVariables is the method |
Hello! Just wanted to chime in and mention that I've been working on updating our tests to JUnit5 and I tried using your EnvironmentVariables class from SystemLambda and it works very nicely! We're looking forward to a future release :) |
I'm sure I'm being dense. How can I set the environmental variables once, for all tests to share? |
i don't think you're being dense. it's pretty unclear to me what to do because there's a link to something that has a method and inner class |
@stefanbirkner thanks for the very useful library! I am keen for JUnit 5 support too, I like the look of the system-lambda library and would be happy to switch over when it is released, do you require any help in trying to get it ready for release? I would probably take a while to learn enough to provide anything useful but would happily try to help. @deeTEEcee + @maguro just incase it helps I managed to make use of the system lambda code to set environment variables for my Junit 5 tests, these classes should help, but feel free to ask if anything is not clear? I copied (and slightly adjusted) these two classes: https://github.com/michaelruocco/idv/tree/988cdfe45358764e8dc7e11d5efaa2daed5c769c/app/spring-app/src/test/java/uk/co/idv/app/environment. Then my tests that set the environment variables are here: https://github.com/michaelruocco/idv/blob/3f086a6ce2ab7afad5cf2d80d3f85be6e4fd6102/app/spring-app/src/test/java/uk/co/idv/app/config/MongoConnectionStringTest.java. I won't profess to understand all the code inside the WithEnvironmentVariables class does, but I understood enough to get it working! |
Could you please share how you used it.. |
@michaelruocco Your links were 404'ing, found out you switched to junit-pioneer's system-properties for Junit5 support. Thanks https://github.com/junit-pioneer/junit-pioneer Sharing for others, incl. @maguro @Purus @deeTEEcee |
Hi @amit-dd, yeah you are quite right, the reason the links are 404ing is because I decided going with system properties was a simpler solution in the end. In case you are interested, the old links with the code I used for environment properties are below: This was the class copied and tweaked from this library: https://github.com/michaelruocco/idv/blob/988cdfe45358764e8dc7e11d5efaa2daed5c769c/app/spring-app/src/test/java/uk/co/idv/app/environment/WithEnvironmentVariables.java An example of this being used is here: Hope that helps! Additionally I have updated the links on the old comment to the point to the commit references where they used to live. Thanks for pointing out the dead links! |
Jupiter support available in https://github.com/webcompere/system-stubs/tree/master/system-stubs-jupiter - a fork of |
Just seeing if there are any plans to support JUnit 5 right now.
The text was updated successfully, but these errors were encountered: