测试管理
manage-tests
暂无简介
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-12
- Stars
- ★ 178
- Forks
- 222
02 资源文件 1
- 脚本scripts/perf.sh6.0 KB
03 SKILL.md 正文
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
name: manage-tests description:
- Defining automated test suites in
testdef/. - Implementing JUnit or Groovy tests.
- Running tests via
./gradlew testor./gradlew "ofbiz --test".
Skill: manage-tests
Goal
Define and maintain automated test suites within the OFBiz framework to ensure code quality and regression safety.
Triggers
ALWAYS read this skill when:
- Creating or modifying XML files in
testdef/directory (e.g.,tests.xml). - Writing new integration tests for services or entities.
Use when
- Adding specialized test cases for new business logic.
- Debugging failing automation suites.
- Verifying data integrity via entity tests.
Procedure
- Identify Test Type:
entity-test: For verifying entity operations and data model constraints.service-test: For testing service execution and result maps.junit-test-suite: For running complex Java-based JUnit tests.
- Define Test Suite:
- Use
<test-suite>as the root element.
- Use
- Registration: Ensure the test suite is registered in
ofbiz-component.xml:<test-suite loader="main" location="testdef/MyTestSuite.xml"/> - Data Isolation:
- Use
<entity-xml>in test defs to load specific test data. - Prefer using
SeedorDemodata foundations.
- Use
- Assertions: Use standard JUnit assertions (
assertEquals,assertNotNull) orServiceUtil.isSuccess(result). - Execution:
- Run tests using Gradle:
./gradlew "ofbiz --test component=[component-name] --test suitename=tests".
- Run tests using Gradle:
Guardrails
- Isolation: Ensure tests do not depend on external data states. Use seed or demo data provided within the component.
- Naming: Test case names should be descriptive of the scenario (e.g.,
testCreateExample). - Paths: Use
component://paths for all resource locations.
Examples
Example: Simple XML Service Test
<test-suite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<service-test service-name="createExample"/>
<entity-test entity-name="Example"/>
</test-suite>