Skip to main content

Unit & Behaviour driven tests

In this workshop, you will learn the basics of unit testing with Java & python.

Workshop's material

Unit test workshop [part 1]

junit

JUnit is a popular open-source testing framework for Java programs. It provides a set of annotations, assertions, and test runners that enable developers to write and execute unit tests for their code. JUnit allows you to define test cases and assert expected results, helping to ensure that individual units of code (such as methods or classes) function correctly. It supports test automation and provides features like test fixtures, parameterized tests, and test suites to enhance test organization and execution. JUnit is widely used in Java development for its simplicity and integration with build tools and IDEs.

Unit test workshop [part 2]

python

Unittest is a testing framework in Python that is part of the standard library. It provides a set of tools and classes for writing and executing unit tests for Python code. Unittest allows developers to define test cases as subclasses of the unittest.TestCase class and provides various assertion methods to verify expected results.

With unittest, you can create test methods within a test case class and use the provided assertions to check if the actual output matches the expected output. It supports test discovery, test fixtures, test suites, and test runners, allowing you to organize and execute tests efficiently. Unittest also integrates well with other testing tools and frameworks.