unit-testing

Standardize JUnit 5 unit tests for gotemplate4j with coverage thresholds.

18|3|Updated Jun 14, 2021
One-click install
npx skills add https://github.com/verils/gotemplate4j --skill unit-testing-verils
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unit-testing
Source: https://github.com/verils/gotemplate4j/tree/main/.agents/unit-testing
Command: npx skills add https://github.com/verils/gotemplate4j --skill unit-testing-verils

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents regressions and inconsistent coverage by standardizing how gotemplate4j tests are written, organized, and verified in the Java 8/JUnit 5/Maven codebase.

Core Features & Use Cases

  • Test workflow guardrails: Enforces the use of ./mvnw, Java 8 compatibility, and focused behavior-driven tests for Template, Lexer, Parser, Executor, AST, built-in functions, coverage, and TestSupport-related changes.
  • Test quality and coverage targets: Requires instruction coverage >= 90% and branch coverage >= 85% while avoiding low-signal duplicate tests and coverage-only test classes.
  • Consistent TestSupport usage: Defines how to use TemplateTestSupport, LexerTestSupport, and ParserTestSupport safely via static helpers, with rules preventing misuse like inheritance.

Quick Start

Use $unit-testing to update or add the minimal set of focused JUnit 5 tests that validate the exact behavior change you made, keeping coverage thresholds and TestSupport usage rules intact.

Frequently Asked Questions about unit-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce code coverage thresholds for JUnit 5 tests in a Java 8 Maven project?

Enforce code coverage thresholds in your Java 8 Maven project by configuring checks for instruction coverage at 90% and branch coverage at 85%. This ensures JUnit 5 tests meet strict quality targets and prevents low-signal duplicate tests from passing.

What is the best way to write focused unit tests for a template engine parser and lexer?

Write focused behavior-driven unit tests for template engine components like Lexer and Parser by validating specific behavior changes. Avoid coverage-only test classes and use dedicated TestSupport utility classes via static helpers to maintain consistent quality.

Can I use inheritance with TestSupport classes when unit testing Java code?

No, you cannot use inheritance with TestSupport classes when unit testing. You must access TemplateTestSupport, LexerTestSupport, and ParserTestSupport safely via static helpers to prevent misuse and maintain strict testing guardrails.

How do I run unit tests for a Java 8 project using Maven wrapper?

Run unit tests for your Java 8 project using the Maven wrapper by executing ./mvnw. This enforces consistent build tool usage across Template, Parser, and Executor components while validating Java 8 compatibility.

Why should I avoid duplicate tests when adding JUnit 5 tests to a Maven codebase?

Avoid duplicate JUnit 5 tests in a Maven codebase because they provide low signal and inflate coverage without validating new behavior. Standardizing on focused tests prevents regressions and maintains meaningful 90% instruction coverage.

Does this unit testing approach work with Java 8 and JUnit 5 out of the box?

Yes, this unit testing approach works with Java 8 and JUnit 5 out of the box. It standardizes testing for template engine components like AST and built-in functions while enforcing Java 8 compatibility and Maven wrapper usage.