Oe Junit
Testing & Qualityoe-junitOe Junit is an Agent Skill for testing & quality published in the OpenEMS/openems repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Use when writing or fixing Java tests in the FEMS/OpenEMS OSGi/bnd workspace, including JUnit 4 and JUnit Jupiter tests.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/OpenEMS/openems/blob/HEAD/.github/skills/oe-junit/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/oe-junit, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
FEMS/OpenEMS Java Test Skill
Use this skill when writing or fixing Java Edge/Backend tests.
Framework Choice
- Inspect nearby tests in the same class, bundle, or feature first.
- Match the existing framework and style when editing a test class.
- Many existing tests use JUnit 4 (
org.junit.Test,org.junit.Assert.*); keep that style in those files. - Use JUnit Jupiter (
org.junit.jupiter.api.*) for brand-new test classes when it fits the surrounding bundle. - Do not mix JUnit 4 and Jupiter imports in the same test class.
- Do not add unnecessary test dependencies.
Project Patterns
- Prefer existing FEMS/OpenEMS helpers over custom fixtures.
- Use
ComponentTestpatterns for Edge components where nearby tests do so. - Build configs through existing
MyConfig.create().setId("id0").build()style builders. - Preserve intentional trailing
//in fluent test chains such as.next(new TestCase() //. - Keep tests small, deterministic, and close to the changed behavior.
- Avoid starting a full OSGi runtime unless the existing test style requires it.
Controller Test Focus
For controller tests, check:
- scheduler/order side effects
- ESS/grid/PV/load sign conventions
- channel values and invalid/optional channel states
- min/max power edge cases
- config activation/update behavior
Validation
Use the Gradle wrapper and the narrowest relevant task. On Windows PowerShell, prefer:
.\gradlew.bat :bundle.name:test
.\gradlew.bat :bundle.name:checkstyleMain