JUnit and Mockito Unit Testing for Java Developers
What you'll learn
- Be able to write unit tests confidently using JUnit
- Appreciate mocking and mock objects and understand how to test interactions with Mockito
- Be able to use Mockito to create test fixtures, stub methods by programmatic and annotation-driven test setup
- Understand how to analyse production code to guide writing unit tests
- Gain an appreciation of the JUnit Assertions API and be able to write assertions using that and Hamcrest, the popular assertions library shipped with JUnit
- Understand modern unit testing concepts and best practices
Requirements
- Have some knowledge of coding in Java to at least a basic level
- An awareness and excitement to learn all about unit testing with Junit, Mockito and Hamcrest!
- Have an interest in understanding unit testing from the ground up through theory and practical examples
Description
Do you want to get hands on demonstrations of JUnit and Mockito in action, want a simple no-fluff guide to how unit testing works including getting an understanding of best practices along the way?
Are you struggling to understand unit testing and would like a friendly guide to help you understand it all completely from the ground up?
Maybe you're a junior Java developer who is just starting out and you need a hands-on guide to JUnit and Mockito unit testing to get up and running quickly?
Or you might be an old hand at Java who has been out of practice and needs to level up your unit testing and JUnit and Mockito knowledge ready for a new project?
Then this course is for you!
We cover the following themes:
Foundations - this is all the good stuff that's been distilled down through the years - it's best practices and gets you up and running with knowing the stuff the APIs don't tell you
Installation and Set Up / Project Creation - we get you creating a project which uses JUnit and introduce you to the project structure and conventions you need to know
Writing Tests with JUnit - we cover exactly how to write unit tests with JUnit in this section and get a feel for the API together, covering best practices and how JUnit works along the way
Writing mock objects based unit tests with Mockito - we cover a quick start on getting up and running with Mockito to test a simple layered architecture you might find in a webapp (also coding the presentation, business and data layers in preparation to demonstrate this too!) then we demonstrate using Mockito to write tests for it
Using the Hamcrest assertions library - we cover how you can do more powerful assertions in your unit tests by harnessing the power of the Hamcrest assertions library that comes shipped with JUnit.
And the following topics:
Arrange/Act/Assert
Assertions
Testing Conventions
Good test characteristics
Java project structure
Creating a JUnit project with Maven
Running unit tests in the IDE
Test failures
JUnit's fail fast mechanism
JUnit's annotations
Test fixtures
Mock objects and their use in unit testing
Mockito basics
Layered architecture principles
Testing a simple layered architecture with Mockito and JUnit
Understanding the different types of assertions
Using the JUnit Assertions API and Hamcrest
Using Hamcrest matchers
Composing Hamcrest matchers and creating complex, yet readable assertions
Reading Hamcrest test failures
Analysing the production code to guide you to writing unit tests
and much, much more!
This course takes you straight from the beginning and gets you up and running to be fully proficient at writing unit tests using JUnit, Mockito and Hamcrest in quick time. Maybe you've started a new job where they use it to test their applications, or you're learning industry-standard tools to better place you ahead of the competition or you just want to ramp up your unit testing knowledge quickly in a no-fuss guide - then this course is for you!
Ultimately, by unlocking the mechanics of how JUnit and Mockito work in front of your eyes, you should be able to better test your Java projects with the frameworks and have fun doing so!
I look forward to teaching you all about JUnit, Mockito and unit testing inside! ;)
Who this course is for:
- Developers who want to know how to write unit tests using JUnit, Mockito and Hamcrest
- Testers who want to better understand testing theory and be able to write their own unit tests out of interest
- Anyone who is hungry to learn all about the craft of writing better unit tests and understanding this from the ground up!
Featured review
Instructors
Do you want to take your Java skills to the next level?
I started JavaEasily in 2018 so I could produce courses focused on teaching Java technology to students all around the world.
Since then I've been busy creating the Java Easily website and publishing courses and articles on different aspects of Java.
Feel free to check out the JavaEasily YouTube channel and follow us on Facebook and Twitter.
Here's to your success with Java! ;)
JavaEasily helps you become a better Java developer by teaching you the core skills you need to succeed in Java today.
We create courses for beginner and intermediate Java developers to help them deepen their knowledge and accelerate their developer career!