Testing Guide
Running Tests
There are two ways to run tests.
-
Method 1: Using IntelliJ JUnit test runner
- To run all tests, right-click on the
src/test/java
folder and chooseRun 'Tests in 'tp.test''
- To run a subset of tests, you can right-click on a test package,
test class, or a test and choose
Run 'ABC'
- To run all tests, right-click on the
-
Method 2: Using Gradle
- To run all tests (including GUI tests and checkstyle), do a
gradlew clean headless check guiTests
on Windows Command Prompt or./gradlew clean headless check guiTests
on a Mac, Linux, or Windows Power Shell - To run all tests except checkstyle, do a
gradlew clean headless test guiTests
on Windows Command Prompt or./gradlew clean headless test guiTests
on a Mac, Linux, or Windows Power Shell - To run all tests except GUI tests, do a
gradlew clean check
on Windows Command Prompt or./gradlew clean check
on a Mac, Linux, or Windows Power Shell - To run all tests except checkstyle and GUI tests, do a
gradlew clean test
on Windows Command Prompt or./gradlew clean test
on a Mac, Linux, or Windows Power Shell
- To run all tests (including GUI tests and checkstyle), do a
Link: Read this Gradle Tutorial from the se-edu/guides to learn more about using Gradle.
Types of Tests
This project has four types of tests:
-
Unit tests targeting the lowest level methods/classes.
e.g.seedu.address.commons.StringUtilTest
-
Integration tests that are checking the integration of multiple code units (those code units are assumed to be working).
e.g.seedu.address.storage.StorageManagerTest
-
Hybrids of unit and integration tests that check multiple code units as well as how they are connected together.
e.g.seedu.address.logic.LogicManagerTest
-
GUI tests that test GUI features by simulating user interactions. These include both unit tests and integration tests.
e.g.seedu/address/ui/MainWindowTest