Skip to content

Commit 9a1073a

Browse files
authored
test(fixtures): add test project with SVCs, tests, and reqstool status validation (#143)
1 parent 39e95af commit 9a1073a

6 files changed

Lines changed: 186 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# mypackage
2+
3+
Minimal test project for manual validation of `reqstool-java-maven-plugin`.
4+
5+
## Prerequisites
6+
7+
- Java 21+
8+
- Maven 3.9+
9+
- `reqstool` CLI: `pip install reqstool`
10+
11+
## Validation
12+
13+
Run all commands from `tests/fixtures/test_project/`.
14+
15+
### 1 — Build
16+
17+
```bash
18+
mvn verify
19+
```
20+
21+
This compiles (triggering the APT annotation processor), runs tests, and assembles the reqstool zip.
22+
23+
Expected output (key lines):
24+
```
25+
[INFO] Processing annotations: [io.github.reqstool.annotations.Requirements]
26+
[INFO] Writing Requirements Annotations data to: target/generated-sources/annotations/resources/annotations.yml
27+
28+
[INFO] Processing annotations: [io.github.reqstool.annotations.SVCs]
29+
[INFO] Writing Requirements Annotations data to: target/generated-test-sources/test-annotations/resources/annotations.yml
30+
31+
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
32+
33+
[INFO] Assembling zip file: target/reqstool/mypackage-0.1.0-reqstool.zip
34+
[INFO] BUILD SUCCESS
35+
```
36+
37+
### 2 — Check artefacts
38+
39+
```bash
40+
# zip must exist
41+
ls target/reqstool/mypackage-0.1.0-reqstool.zip
42+
43+
# zip must contain all reqstool files + test results
44+
unzip -l target/reqstool/mypackage-0.1.0-reqstool.zip
45+
```
46+
47+
Expected entries in the zip:
48+
- `mypackage-0.1.0-reqstool/requirements.yml`
49+
- `mypackage-0.1.0-reqstool/software_verification_cases.yml`
50+
- `mypackage-0.1.0-reqstool/annotations.yml`
51+
- `mypackage-0.1.0-reqstool/test_results/TEST-io.github.reqstool.example.HelloTest.xml`
52+
- `mypackage-0.1.0-reqstool/reqstool_config.yml`
53+
54+
### 3 — Run reqstool status
55+
56+
The zip is self-contained (test results included), so just extract and run:
57+
58+
```bash
59+
unzip -o target/reqstool/mypackage-0.1.0-reqstool.zip -d /tmp/mypackage-reqstool
60+
reqstool status local -p /tmp/mypackage-reqstool/mypackage-0.1.0-reqstool
61+
```
62+
63+
Expected: all green — `REQ_001` implemented, `T1 P1`, no missing tests or SVCs.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/requirements.schema.json
2+
3+
metadata:
4+
urn: mypackage
5+
variant: microservice
6+
title: Mypackage Requirements
7+
url: https://github.com/reqstool/reqstool-java-maven-plugin
8+
9+
requirements:
10+
- id: REQ_001
11+
title: Hello function
12+
significance: shall
13+
description: The hello method shall return "hello".
14+
categories: ["functional-suitability"]
15+
revision: "0.1.0"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/reqstool/reqstool-client/main/src/reqstool/resources/schemas/v1/software_verification_cases.schema.json
2+
3+
cases:
4+
- id: SVC_001
5+
requirement_ids: ["REQ_001"]
6+
title: "Hello method returns hello"
7+
verification: automated-test
8+
revision: "0.1.0"
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>io.github.reqstool.example</groupId>
7+
<artifactId>mypackage</artifactId>
8+
<version>0.1.0</version>
9+
<name>mypackage</name>
10+
<description>Minimal test project for reqstool-java-maven-plugin</description>
11+
12+
<properties>
13+
<java.version>21</java.version>
14+
<maven.compiler.source>21</maven.compiler.source>
15+
<maven.compiler.target>21</maven.compiler.target>
16+
<maven.test.failure.ignore>true</maven.test.failure.ignore>
17+
</properties>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>io.github.reqstool</groupId>
22+
<artifactId>reqstool-java-annotations</artifactId>
23+
<version>1.0.0</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.junit.jupiter</groupId>
27+
<artifactId>junit-jupiter-api</artifactId>
28+
<version>6.0.3</version>
29+
<scope>test</scope>
30+
</dependency>
31+
</dependencies>
32+
33+
<build>
34+
<plugins>
35+
<plugin>
36+
<artifactId>maven-compiler-plugin</artifactId>
37+
<version>3.15.0</version>
38+
<configuration>
39+
<annotationProcessorPaths>
40+
<path>
41+
<groupId>io.github.reqstool</groupId>
42+
<artifactId>reqstool-java-annotations</artifactId>
43+
<version>1.0.0</version>
44+
</path>
45+
</annotationProcessorPaths>
46+
</configuration>
47+
</plugin>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-surefire-plugin</artifactId>
51+
<version>3.5.5</version>
52+
</plugin>
53+
<plugin>
54+
<groupId>io.github.reqstool</groupId>
55+
<artifactId>reqstool-maven-plugin</artifactId>
56+
<version>1.0.4</version>
57+
<executions>
58+
<execution>
59+
<goals>
60+
<goal>assemble-and-attach-zip-artifact</goal>
61+
</goals>
62+
</execution>
63+
</executions>
64+
<configuration>
65+
<datasetPath>${project.basedir}/docs/reqstool</datasetPath>
66+
<testResults>
67+
<testResult>target/surefire-reports/*.xml</testResult>
68+
</testResults>
69+
</configuration>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
</project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package io.github.reqstool.example;
2+
3+
import io.github.reqstool.annotations.Requirements;
4+
5+
public class Hello {
6+
7+
@Requirements("REQ_001")
8+
public String hello() {
9+
return "hello";
10+
}
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.github.reqstool.example;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
import io.github.reqstool.annotations.SVCs;
8+
9+
class HelloTest {
10+
11+
@Test
12+
@SVCs("SVC_001")
13+
void testHello() {
14+
assertEquals("hello", new Hello().hello());
15+
}
16+
}

0 commit comments

Comments
 (0)