An advanced guide to mastering unit testing using Mockito and JUnitAbout This BookCreate meaningful and maintainable automated unit tests using advanced JUnit features and the Mockito frameworkBuild an automated continuous integration environment to get real-time feedback on broken code, code coverage, code quality, and integration issuesCovers best practices and presents insights on architecture and designs to create faster and reliable unit testing environmentsWho This Book Is ForThis book is for you if you are a developer with some experience in Java application development as well as a basic knowledge of JUnit testing. But for those whose skill set is void of any prior experience with JUnit testing, the book also covers basic fundamentals to get you acquainted with the concepts before putting them into practise.
What You Will LearnWrite advanced JUnit test cases using advanced JUnit 4 featuresAutomate JUnit test cases using Gradle, Maven, and Ant scriptingPractice continuous integration with Jenkins and Ant, Maven, and Gradle scriptingMonitor code quality with the SonarQube dashboardAnalyze static code using PMD, Checkstyle, and FindBugsMaster code coverage with Clover, Cobertura, EclEmma, and JaCoCoDesign for testability and refactor legacy codePractice test-driven development with MockitoIn DetailIt is insanity to keep doing things the same way and expect them to improve. Any program is useful only when it is functional; hence, before applying complex tools, patterns, or APIs to your production code, checking software functionality is must. Automated JUnit tests help you verify your assumptions continuously, detect side effects quickly, and also help you save time.
This book will provide the skills you need to successfully build and maintain meaningful JUnit test cases. You will begin with how to use advanced JUnit 4 features, improve code coverage, automate JUnit tests, monitor code quality, write JUnit tests for the database and web tier refactor legacy code, mock external dependencies using Mockito, and write testable code using test-driven development. By sequentially working through the steps in each chapter, you will quickly master the advanced JUnit features.