test-writing

Guide writing, executing, and debugging Shopsys Platform tests across five layers.

349|98|Updated Feb 1, 2018
One-click install
npx skills add https://github.com/shopsys/shopsys --skill test-writing-shopsys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-writing
Source: https://github.com/shopsys/shopsys/tree/main/.agents/skills/test-writing
Command: npx skills add https://github.com/shopsys/shopsys --skill test-writing-shopsys

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of writing, running, and debugging tests within the Shopsys Platform, ensuring code quality and maintainability.

Core Features & Use Cases

  • Test Layer Selection: Guides you to choose the appropriate base class (Unit, Functional, GraphQL, Smoke, Acceptance) for your test.
  • Behavioral Testing: Enforces writing tests that assert observable state or output, not just method calls.
  • Code Style & Structure: Provides clear guidelines on naming conventions, AAA pattern, and service injection.
  • Use Case: When you need to add a new test for a product-related service, this Skill will help you select the correct FunctionalTestCase and structure your test to assert that the product name is updated correctly after an edit operation.

Quick Start

Use the test-writing skill to create a new unit test for the ProductService class.

Frequently Asked Questions about test-writing

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

FAQPage Schema
How do I write PHPUnit tests for the Shopsys Platform?

To write PHPUnit tests for Shopsys, select the appropriate base class like UnitTestCase or FunctionalTestCase, then structure your assertions using the AAA pattern and proper service injection to ensure code quality.

What's the best way to test a GraphQL API in Shopsys?

Testing a GraphQL API in Shopsys involves using the GraphQL test layer base class to execute queries and assert observable state or output, enforcing behavioral testing rather than just checking method calls.

How do I choose between unit, functional, and acceptance tests in Shopsys?

Choose between unit, functional, and acceptance tests by matching the test layer to your scope: unit for isolated logic, functional for services like ProductService, and smoke or acceptance for broader application behaviors.

Can I debug Shopsys test failures using behavioral testing patterns?

Yes, debugging Shopsys test failures is streamlined by behavioral testing patterns that assert observable state changes, such as verifying a product name updates correctly after an edit operation.

Why does my Shopsys test need proper service injection?

Proper service injection is needed in Shopsys tests to maintain code quality and ensure functional and unit tests can accurately isolate dependencies and assert expected behavioral outcomes.