# How to Run Tests in the IPED Project

> Learn to run tests in the IPED project with a simple command. Execute JUnit 4 unit tests for all modules or target specific classes using Maven.

- Repository: [Serviço de Perícias em Informática/IPED](https://github.com/sepinf-inc/IPED)
- Tags: how-to-guide
- Published: 2026-03-11

---

**Execute `mvn clean test` from the repository root to run all JUnit 4 unit tests across every Maven module, or use the `-Dtest` parameter to target specific classes and methods.**

According to the sepinf-inc/IPED source code, this digital forensics platform is built with Maven and Java 11, organizing its validation suite as standard JUnit 4 tests within `src/test/java` directories. Whether you are verifying parser logic or contributing new features, knowing how to run tests in the IPED project ensures your code integrates correctly with the existing architecture. The parent [`pom.xml`](https://github.com/sepinf-inc/IPED/blob/main/pom.xml) automatically configures the Maven Surefire plugin, requiring no additional test runners or manual environment setup.

## Running the Complete Test Suite

The most reliable way to validate your changes is to execute the entire test suite from the repository root. This approach compiles all Java 11 sources and runs every unit test defined across the multi-module project.

Run all tests using the standard Maven lifecycle:

```bash
mvn clean test

```

To build the final release artifacts while running tests, use the `install` phase:

```bash
mvn clean install

```

Both commands trigger the **Surefire** plugin defined in the parent [`pom.xml`](https://github.com/sepinf-inc/IPED/blob/main/pom.xml), which automatically discovers and executes JUnit 4 tests located in `src/test/java` folders. The JUnit 4 dependency is declared with `test` scope in the central build descriptor, ensuring Maven downloads the required libraries without polluting runtime dependencies.

## Running Specific Test Classes or Methods

When debugging a specific component, targeting individual tests reduces feedback time. The IPED project supports Maven’s standard test selection syntax via the `-Dtest` parameter.

**Run a single test class** by specifying its simple name:

```bash
mvn -Dtest=WinXTimelineParserTest test

```

**Run a specific test method** using the hash delimiter:

```bash
mvn -Dtest=WinXTimelineParserTest#testParseTimeline test

```

This approach is particularly useful when iterating on parser logic in modules like `iped-parsers-impl`, where tests such as [`WinXTimelineParserTest.java`](https://github.com/sepinf-inc/IPED/blob/main/WinXTimelineParserTest.java) validate specific file format handling. The `-Dtest` flag accepts wildcards and comma-separated lists for broader selection patterns.

## Skipping Tests During Development Builds

For rapid compilation checks or when you need to build artifacts without waiting for the full test suite, Maven allows test suppression.

Add the `-DskipTests` flag to any build command:

```bash
mvn clean install -DskipTests

```

Use this option sparingly; the IPED test suite includes regression tests for digital forensics parsers that catch format-specific edge cases. Skipping validation may allow subtle bugs to reach production builds.

## Test Structure and Organization

Understanding the physical layout of the test suite helps locate relevant examples and resources. The IPED project follows standard Maven directory conventions with clear separation between source and test code.

Key locations include:

- **[`pom.xml`](https://github.com/sepinf-inc/IPED/blob/main/pom.xml)** — The parent Maven descriptor at the repository root declares JUnit 4 dependencies and Surefire plugin configuration, centralizing build definitions for all modules.
- **[`iped-parsers/iped-parsers-impl/src/test/java/iped/parsers/winx/WinXTimelineParserTest.java`](https://github.com/sepinf-inc/IPED/blob/main/iped-parsers/iped-parsers-impl/src/test/java/iped/parsers/winx/WinXTimelineParserTest.java)** — Exemplifies the typical JUnit 4 test structure used throughout the project, demonstrating how parser classes are instantiated and validated against expected outputs.
- **`iped-parsers/iped-parsers-impl/src/test/resources`** — Contains sample files (evidence images, chat databases, registry hives) used as input data for parser tests, allowing integration-style validation without external dependencies.

Test classes reside in packages mirroring their corresponding source code locations, making it intuitive to find `WinXTimelineParserTest` adjacent to the `WinXTimelineParser` implementation it validates.

## Summary

- **Full suite execution**: Run `mvn clean test` from the repository root to compile Java 11 sources and execute all JUnit 4 tests via the Surefire plugin.
- **Targeted testing**: Use `-Dtest=ClassName` for single classes or `-Dtest=ClassName#methodName` for individual methods to speed up debugging cycles.
- **Build integration**: The `mvn clean install` command compiles, tests, and packages the application without requiring additional configuration.
- **Test locations**: Unit tests live in `src/test/java` within each Maven module, with resources in `src/test/resources` providing sample forensic data for validation.

## Frequently Asked Questions

### How do I run only the WhatsApp parser tests?

Use the `-Dtest` parameter with the specific class name: `mvn -Dtest=WhatsAppParserTest test`. This executes only the test methods defined in [`WhatsAppParserTest.java`](https://github.com/sepinf-inc/IPED/blob/main/WhatsAppParserTest.java) without running the broader suite, significantly reducing execution time when iterating on chat parsing logic.

### Can I run tests if I only have Java 8 installed?

No. The IPED project requires **Java 11** for compilation and test execution. Attempting to run `mvn test` with Java 8 will result in compilation errors due to language level requirements specified in the parent [`pom.xml`](https://github.com/sepinf-inc/IPED/blob/main/pom.xml).

### Where are the test data files stored?

Sample forensic files and test inputs are stored in `src/test/resources` directories within each module. For example, the `iped-parsers-impl` module maintains parser-specific test data at `iped-parsers/iped-parsers-impl/src/test/resources`, allowing tests like `WinXTimelineParserTest` to load evidence samples from the classpath during execution.

### Is it possible to run tests in a specific Maven module only?

Yes. Navigate to the specific module directory (e.g., `cd iped-parsers/iped-parsers-impl`) and run `mvn test` from that location. Maven executes only the tests within that module and its dependencies, which is useful when working on isolated components without triggering the entire multi-module build.