Unit Testing in Scala 3
ScalaTest is a well-known choice for testing Scala projects. Write tests to provide evidence that the project works as expected. These tests also serve as a communication and learning tool for other developers and stakeholders in your organization.
What you'll learn
ScalaTest is a popular choice to test Scala projects. It has been used by well-known open-source projects such as Akka. In this course, Unit Testing in Scala, you will learn how to test a Scala project using ScalaTest. First, you will test your codebase using Assertions and Matchers. Next, you will discover how to create Fixtures for your testing using various methods, and how to test for asynchronous code. Then, you will see how to mock complex object creation and test for behaviors, while also learning to create tags and apply them selectively to your tests so that you can run tests based on the tags. Finally, you will explore different ways of running a test written using ScalaTest library. When you are finished with this course, you will have all the required knowledge to plug ScalaTest into your projects and start testing with confidence.
Table of contents
- Agenda 1m
- What Is a Test? 1m
- Writing the First Test 3m
- Running the Test Using IntelliJ IDEA 2m
- Running the Tests Using Scala Command Line 2m
- Running the Test Using Sbt Command Line 2m
- Running the Test Using Sbt Console 3m
- Understanding Testing Styles 4m
- Understanding FlatSpec Style 3m
- Understanding the Test Lifecycle 1m
- Summary 1m
- Agenda 1m
- Understanding Matchers 2m
- Using Matchers to Test Equality 6m
- Using Matchers to Test Strings 4m
- Using Matchers to greaterThan or lessThan 3m
- Creating a Base Test for Unit Tests 2m
- Using Matchers to Test for Length and Size 3m
- Using Matchers to Test Container Elements 5m
- Using Matchers to Test Emptiness Property 3m
- Using Matchers to Test Exceptions 3m
- Using Matchers to Test Logical Operations 1m
- Using Matchers to Test Negative Statement Structure 4m
- Using Matchers to Test Object Identity 3m
- Using Matchers to Test Pattern Matching 3m
- Summary 1m