Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions tests/fixtures/test_project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# mypackage

Minimal test project for manual validation of `reqstool-java-maven-plugin`.

## Prerequisites

- Java 21+
- Maven 3.9+
- `reqstool` CLI: `pip install reqstool`

## Validation

Run all commands from `tests/fixtures/test_project/`.

### 1 — Build

```bash
mvn verify
```

This compiles (triggering the APT annotation processor), runs tests, and assembles the reqstool zip.

Expected output (key lines):
```
[INFO] Processing annotations: [io.github.reqstool.annotations.Requirements]
[INFO] Writing Requirements Annotations data to: target/generated-sources/annotations/resources/annotations.yml

[INFO] Processing annotations: [io.github.reqstool.annotations.SVCs]
[INFO] Writing Requirements Annotations data to: target/generated-test-sources/test-annotations/resources/annotations.yml

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] Assembling zip file: target/reqstool/mypackage-0.1.0-reqstool.zip
[INFO] BUILD SUCCESS
```

### 2 — Check artefacts

```bash
# zip must exist
ls target/reqstool/mypackage-0.1.0-reqstool.zip

# zip must contain all reqstool files + test results
unzip -l target/reqstool/mypackage-0.1.0-reqstool.zip
```

Expected entries in the zip:
- `mypackage-0.1.0-reqstool/requirements.yml`
- `mypackage-0.1.0-reqstool/software_verification_cases.yml`
- `mypackage-0.1.0-reqstool/annotations.yml`
- `mypackage-0.1.0-reqstool/test_results/TEST-io.github.reqstool.example.HelloTest.xml`
- `mypackage-0.1.0-reqstool/reqstool_config.yml`

### 3 — Run reqstool status

The zip is self-contained (test results included), so just extract and run:

```bash
unzip -o target/reqstool/mypackage-0.1.0-reqstool.zip -d /tmp/mypackage-reqstool
reqstool status local -p /tmp/mypackage-reqstool/mypackage-0.1.0-reqstool
```

Expected: all green — `REQ_001` implemented, `T1 P1`, no missing tests or SVCs.
15 changes: 15 additions & 0 deletions tests/fixtures/test_project/docs/reqstool/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/requirements.schema.json

metadata:
urn: mypackage
variant: microservice
title: Mypackage Requirements
url: https://github.com/reqstool/reqstool-java-maven-plugin

requirements:
- id: REQ_001
title: Hello function
significance: shall
description: The hello method shall return "hello".
categories: ["functional-suitability"]
revision: "0.1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/software_verification_cases.schema.json

cases:
- id: SVC_001
requirement_ids: ["REQ_001"]
title: "Hello method returns hello"
verification: automated-test
revision: "0.1.0"
73 changes: 73 additions & 0 deletions tests/fixtures/test_project/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.reqstool.example</groupId>
<artifactId>mypackage</artifactId>
<version>0.1.0</version>
<name>mypackage</name>
<description>Minimal test project for reqstool-java-maven-plugin</description>

<properties>
<java.version>21</java.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
</properties>

<dependencies>
<dependency>
<groupId>io.github.reqstool</groupId>
<artifactId>reqstool-java-annotations</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>6.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.15.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.github.reqstool</groupId>
<artifactId>reqstool-java-annotations</artifactId>
<version>1.0.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.5</version>
</plugin>
<plugin>
<groupId>io.github.reqstool</groupId>
<artifactId>reqstool-maven-plugin</artifactId>
<version>1.0.4</version>
<executions>
<execution>
<goals>
<goal>assemble-and-attach-zip-artifact</goal>
</goals>
</execution>
</executions>
<configuration>
<datasetPath>${project.basedir}/docs/reqstool</datasetPath>
<testResults>
<testResult>target/surefire-reports/*.xml</testResult>
</testResults>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.github.reqstool.example;

import io.github.reqstool.annotations.Requirements;

public class Hello {

@Requirements("REQ_001")
public String hello() {
return "hello";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.reqstool.example;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

import io.github.reqstool.annotations.SVCs;

class HelloTest {

@Test
@SVCs("SVC_001")
void testHello() {
assertEquals("hello", new Hello().hello());
}
}