JUnit enhetstestning
Enhetstestning (unit testing) är idag en förutsättning för att upprätthålla hög programkods-kvalitet. Du får lära dig om JUnit version 5, AssertJ assertions, hur man använder mock-objects och mycket mera under denna fullmatade kursdag. Denna kurs vänder sig till Java utvecklare som ska börja eller precis börjat i ett Java projekt som använder sig av enhetstestning med JUnit och önskar snabbt bli produktiv.
- Java JDK
- MS Visual Code || JetBrains IntelliJ IDEA
Du sitter bekvämt framför datorn och deltar i kursen via internet. Vi använder programvaran Zoom för alla våra fjärrkurser.
I priset ingår kursmaterial som PDF.
Pris: 5 000 kr + MOMS/VAT (25%)
Du sitter bekvämt i ett av våra klassrum, vilka finns centralt placerade i Stockholms innerstad (Östermalmstorg).
I priset ingår tryckt kursmaterial (och som PDF), samt kaffe/te med smörgås på förmiddagen och kaffe/te med bulle på eftermiddagen.
Pris: 12 000 kr + MOMS/VAT (25%)
Om ni är tre eller fler personer från samma företags, kan ni beställa en företagsanpassad kurs. Då håller vi kursen på ett datum som passar er. Antingen på plats i era lokaler eller som en fjärrkurs. Vi kan även mixa fjärr- och klassrumskurs, om några av er önskar delta på distans medan resten föredrar att ses på plats.
Här är ett sammandrag av vad du får lära dig på kursen.
- The principles of device testing
- The principles of test-driven-development (TDD)
- JUnit version 5
- Test method annotations
- Assertions and matches
- Use of AssertJ assertions
- Repeated tests
- Parameterized tests
- Parallel execution of test
- Dynamically generated tests Conditionally performed tests
- The principle of mock objects and the use of Mockito
- JUnit with construction tools such as Maven and Gradle
- Other frameworks based on JUnit
Unit Testing and Test-Driven Development
- Background of JUnit
- What is a unit test
- What is an integration test
- What other form of tests are there
- What is TDD (Test-Driven Development)
- Installation of JUnit
Basic JUnit Usage
- Installation of JUnit
- Test methods
- Test method annotations
- Using test assertions
- Using display names
- Running inside IntelliJ (or your favorite IDE)
- Compiling and running tests from the command-line
Assertions
- Assertions overview
- Optional messages
- Checking for equality of primitive types
- Checking for equality of objects
- Checking for equality of iterables
- Checking for matching lines
- Checking for thrown exceptions
- Checking for time-limited execution
- Grouped assertions
- Assertion guards
- Direct failure
Life-Cycle Methods
- Loading test data files
- @BeforeEach / @AfterEach annotations
- @BeforeAll / @AfterAll annotations
- Nested test classes
Conditonal Test Execution
- Assumptions
- Enable/disable test based on OS
- Enable/disable test based on JRE version
- Enable/disable test based on JVM system property value
- Enable/disable test based on OS environment variable value
- Enable/disable test based on result of JavaScript expression
Build Tool Support
- Application builds
- Build tool evolution
- What is a dependency
- What is an artefact repository
- How to find 3rd party libraries
- What is transitive dependency
- Source code organization of a project directory
- What is Maven
- Sample POM
- Maven commands
- Maven build phases
- How to run tests in Maven
- Maven test results report
- What is Gradle
- Dependencies in Gradle
- Sample Gradle build file
- The Gradle wrapper
- Gradle test support
- How to run tests in Gradle
- Gradle test results report
Using Assertion Libraries
- What is an assertion library
- What is Hamcrest
- What is AssertJ
- Installation of AssertJ
- Usage of AssertJ
Mock Objects
- What is a mock object and why you want to use it
- Overview of some mock-objects libraries
- Using Mockito
- Creating mock objects
- Setting up the expected behaviour of the test’s surrounding
- Verifying the outcome
- Argument matchers
- Mock annotation
Test Variants
- JUnit 5 configuration
- Parallel test method execution
- Repeated tests
- Parameterized tests
- Parameterized based on simple values
- Parameterized based on enum values
- Parameterized based on values factory method
- Parameterized based on CSV values
- Dynamically generated tests
Other Testing Frameworks
- TestNG
- Spock