AgentSkillsCN

run-tests

在本项目中运行后端(Java/Spring Boot)测试。在运行测试、验证测试结果,或执行Maven命令时使用此功能。避免因寻找正确的Maven可执行文件而浪费时间。

SKILL.md
--- frontmatter
name: run-tests
description: Run backend (Java/Spring Boot) tests in this project. Use when running tests, verifying test results, or executing Maven commands. Prevents wasting time looking for the correct Maven executable.

Running Tests

This project uses the Maven wrapper (./mvnw) located in the backend/ directory. There is no global mvn on PATH.

Commands

Always run from the backend/ working directory.

Run all tests:

bash
./mvnw test -Dsurefire.useFile=false

Run a single test class:

bash
./mvnw test -Dtest="CategoryIntegrationTest" -Dsurefire.useFile=false

Run a single test method:

bash
./mvnw test -Dtest="CategoryIntegrationTest#category_invite_and_members" -Dsurefire.useFile=false

Run tests matching a pattern:

bash
./mvnw test -Dtest="*IntegrationTest" -Dsurefire.useFile=false

Notes

  • Always use ./mvnw, never mvn.
  • Always pass -Dsurefire.useFile=false so test output goes to stdout.
  • Working directory must be backend/ (where mvnw lives).
  • Pipe through | tail -30 for quick pass/fail summary when output is long.