Run tests kit

From microsoft/skills-for-copilot-studio · View interactive version

Run tests kit is an AI agent skill from the GitHub repository microsoft/skills-for-copilot-studio. Run a batch test suite via the Copilot Studio Kit (Dataverse API). Uses the Power CAT Copilot Studio Kit to execute test cases against a published agent and produces pass/fail results with latencies. Requires the Kit installed in the environment, an App Registration with Dataverse permissions, and a

How to use this skill

Skill file

Run Tests via Copilot Studio Kit

Run a batch test suite against a published Copilot Studio agent using the Power CAT Copilot Studio Kit.

Prerequisites

The user must have:

  1. The Copilot Studio Kit installed in their Power Platform environment
  2. Published their agent in the Copilot Studio UI
  3. Created a test set in the Copilot Studio Kit
  4. An Azure App Registration with Dataverse permissions

Phase 1: Configure Settings

  1. Read tests/settings.json (relative to the user's project CWD) and check for missing or placeholder values (containing YOUR_).
  1. If the file doesn't exist, create it from the template:

```bash

cp ${CLAUDE_SKILL_DIR}/../../tests/settings-example.json ./tests/settings.json

```

  1. If values are missing, ask the user for each missing value. Explain where to find each one:

Ask for ALL missing values at once (don't ask one at a time).

  1. Write tests/settings.json with the collected values:

```json

{

"dataverse": {

"environmentUrl": "<value>",

"tenantId": "<value>",

"clientId": "<value>"

},

"testRun": {

"agentConfigurationId": "<value>",

"agentTestSetId": "<value>"

}

}

```

  1. If all values are already configured and valid, proceed to Phase 2.

Phase 2: Run Tests

  1. Ensure tests/package.json exists in the user's project. If not, copy it:

```bash

cp ${CLAUDE_SKILL_DIR}/../../tests/package.json ./tests/package.json

```

  1. Install dependencies if tests/node_modules/ doesn't exist:

```bash

npm install --prefix tests

```

  1. Run the test script in the background with a 100-minute timeout (6000000ms):

```bash

node ${CLAUDE_SKILL_DIR}/../../tests/run-tests.js --config-dir ./tests

```

Use run_in_background: true for this command. Save the returned task ID.

  1. Wait 10 seconds, then check the background task output (non-blocking check).
  1. Detect the authentication state from the output:

> Authentication Required

>

> Open your browser to: https://microsoft.com/devicelogin

> Enter the code: XXXXXXXXX (extract the actual code from the output)

>

> After signing in, the tests will continue automatically.

  1. Wait for the background task to complete (blocking). The script polls every 20 seconds until all tests finish and downloads results as a CSV.
  1. Read the final output to get the success rate and CSV filename.
  1. Proceed to Phase 3.

Phase 3: Analyze Results

  1. Get the results: Glob: tests/test-results-*.csv — read the most recent CSV file (newest by modification time).
  1. Parse the CSV columns:

| Column | Meaning |

|--------|---------|

| Test Utterance | The user message that was tested |

| Expected Response | What the test expected |

| Response | What the agent actually responded |

| Latency (ms) | Response time |

| Result | Success, Failed, Unknown, Error, or Pending |

| Test Type | Response Match, Topic Match, Generative Answers, Multi-turn, Plan Validation, or Attachments |

| Result Reason | Why the test passed or failed |

  1. Focus on failed tests (Result = Failed or Error). For each failure, analyze:
  1. Proceed to Phase 4 (Propose Fixes).

Phase 4: Propose Fixes

  1. For each failure, identify the relevant YAML file(s):
  1. Propose specific YAML changes to fix each failure. Present them to the user as a summary:
  1. Wait for user decision. The user can:
  1. Apply accepted changes using the Edit tool. After applying, remind the user to push and publish again before re-running tests.

Test Result Codes Reference

Result: 1=Success, 2=Failed, 3=Unknown, 4=Error, 5=Pending
Test Type: 1=Response Match, 2=Topic Match, 3=Attachments, 4=Generative Answers, 5=Multi-turn, 6=Plan Validation
Run Status: 1=Not Run, 2=Running, 3=Complete, 4=Not Available, 5=Pending, 6=Error
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.