advpr
Gera scripts de automação de testes ADVPR (Advanced Protheus Robot) - TestSuite, TestGroup, TestCase para rotinas MVC, ExecAuto, relatórios, processamento,…
Generate ProBat unit tests for TLPP classes and functions
> /plugin marketplace add thalysjuvenal/advpl-specialist > /plugin install advpl-specialist@advpl-specialist-marketplace
How it fires
How this command gets triggered: by you, by Claude, or both.
/testContext preview
What this command does when you run it.
Generate ProBat unit tests for TLPP classes and functions
description: Generate ProBat unit tests for TLPP classes and functions allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Agent, WebSearch, WebFetch argument-hint: "<file.tlpp|function> [--type unit|api] [--output path]"
**IMPORTANT:** Always respond in the same language the user is writing in. If the user writes in Portuguese, respond in Portuguese. If in English, respond in English. Adapt all explanations and suggestions to the user's language. Code comments may remain in English or match the user's language.
Generate ProBat unit tests for TLPP classes and functions on TOTVS Protheus.
/advpl-specialist:test <target> [options]
Where `<target>` is a `.tlpp` file path or a function/class name.
| Type | Description | Output | |------|------------|--------| | `unit` | Unit test for functions or class methods | `.tlpp` file with `@TestFixture` and assertions | | `api` | REST API endpoint test | `.tlpp` file using `tlpp.rest.runTestSimple` |
| Flag | Description | Default | |------|------------|---------| | `--type` | Test type: `unit` or `api` | `unit` | | `--output` | Output file path | `test/unit/test_<name>.tlpp` | | `--suite` | Suite name for grouped execution | None | | `--owner` | Team/author identifier for `@TestFixture` | Ask user |
ProBat only works with TLPP (`.tlpp` files). If a `.prw` file is passed:
1. Inform the user that ProBat requires TLPP 2. Suggest using `/advpl-specialist:migrate` first to convert the source to TLPP 3. The test file itself is always `.tlpp`, even when testing ADVPL functions
1. **Parse arguments** - Extract target file/function, type, and flags 2. **Read target source** - Analyze the file or function to understand what to test 3. **Load reference** - Read `skills/probat-testing/reference.md` 4. **Load patterns** - Read `patterns-unit-tests.md` for the appropriate template 5. **Identify test cases** - Determine:
6. **Present plan** - Show the user:
7. **Wait for approval** - The user must approve before generating code 8. **Generate test code** - Create the `.tlpp` test file following ProBat conventions:
9. **Write file** - Save with `.tlpp` extension 10. **Report** - Show what was created and how to run the tests
# Generate unit tests for a TLPP file /advpl-specialist:test src/calculadora.tlpp # Generate API tests for a REST endpoint /advpl-specialist:test src/customer_api.tlpp --type api # Generate tests with a specific output path /advpl-specialist:test src/pedido_service.tlpp --output test/unit/test_pedido.tlpp # Generate tests for a specific function /advpl-specialist:test U_calculateTotal --type unit # Generate tests grouped in a suite /advpl-specialist:test src/financeiro/ --suite financeiro
A complete, compilable `.tlpp` test file saved to the project with:
Plugin para Claude Code especializado em ADVPL e TLPP para desenvolvimento no ecossistema TOTVS Protheus — para desenvolvedores e consultores funcionais. Documentacao completa:
Gera scripts de automação de testes ADVPR (Advanced Protheus Robot) - TestSuite, TestGroup, TestCase para rotinas MVC, ExecAuto, relatórios, processamento,…
Diagnose errors and problems in ADVPL/TLPP code - compilation errors, runtime errors, performance issues, and log analysis
Look up Protheus documentation - native functions, SX data dictionary, REST APIs, MV parameters, and framework reference
Generate technical documentation from ADVPL/TLPP source code - Protheus.doc headers, routine docs, API docs
Explain ADVPL/TLPP code in plain language for developers and functional consultants
Generate ADVPL/TLPP code - functions, classes, MVC structures, REST APIs, Web Services, and entry points for TOTVS Protheus