Category Archives: Blog-1

Blog Post #1 JUnit 5 Testing

In class, we have been learning about testing with Junit 5 and doing assignments related to it. After watching the video for the advanced part of the assignment,  I decided that I wanted to research further into the topic for my first blog post. So, what is Junit? In a short answer, JUnit is a Java open sources unit testing framework that is used to write and run repeatable automated tests. JUnit 5 Is the updated version of the highly popular testing library that is Junit 4 which I’m sure you all have heard of it. Junit 5 was released in 2017 that adds good use for Java 8 features. In fact, JUnit 5 requires Java 8 JDK or higher to work.

While researching a few of the key differences between the two versions are Junit 5 is composed of 3 sub-projects JUnit Platform, JUnit Jupiter, and JUnit Vintage. The Assertions and Annotations have been changed, and most importantly Junit 5 adds the support of the lambda expression in which we went over in class. One of the blogs I read recommends doing this example,  which I found quite helpful and easy to understand. The code below is just a conversion between Fahrenheit to Celsius and Junit to test it. The author breaks each part down into subsections which made It easier to follow along. I was also, curious about how Junit 5 worked in the Gradle so I followed tutorials to see how the build systems provide supports to the new feature. I highly recommend watching the video that I have provided; it explains everything you need to know about Junit 5 and the architecture behind It.

 

Resources: 

https://www.youtube.com/watch?v=flpmSXVTqBI 

https://www.parasoft.com/junit-tutorial-setting-up-writing-and-running-java-unit-tests/

From the blog Derin's CS Journey by and used with permission of the author. All other rights reserved by the author.