caught the attention of smalltalkers!) Kent Beck and Erich Gamma ports SUnit to Java - JUnit Was Born (and the world was changed!) JUnit4.12 was released (and stayed there forever!) JUnit Lambda crowdfunding on Indiegogo (and the evolution begins!) 2016 2014 1997 1994
coupled to JUnit internals by using internal classes or reflection • The execution mode • All test cases need to be known before run • Ambiguous Evolution • Runner vs Rule : conflicting conceptions for test execution
4 had to offer with extensibility in mind • Modular, Extensible and Modern • Support for any TestEngine imaginable • Forward and backward compatible • JUnit Platform supports JUnit 3.8, JUnit 4, and JUnit Jupiter What is JUnit5?
in pure-Java projects only (As Android uses it’s own plug-in) • For Android JUnit5 support third party plug-in written by Marcel Schnelle • Full support for Unit tests with experimental support for Instrumentation tests
in JUnit 5 • Programming Model • How you write tests • Annotations • Assertions • Assumptions • Types of tests • Extension Model • How you and third parties extend the framework • Spring, Mockito, Selenium, …
fun onlyRunThisOnMac() { assertTrue(System.getProperty("user.home").startsWith("/ Users")) } @Test @DisabledOnOs(MAC) fun neverRunThisOnMac() { val osName = System.getProperty("os.name").toLowerCase(Locale.ROOT) assertFalse("darwin" in osName) assertFalse("mac" in osName) }
value = 5, name = "I am at {currentRepetition} of {totalRepetitions}" ) fun repeatedTest(repetitionInfo: RepetitionInfo ) { assertEquals(5, repetitionInfo.totalRepetitions) } }