Edit

Share via


Using the Model Context Protocol server with Test Engine

Note

Preview features aren’t meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.

Power Apps Test Engine includes a Model Context Protocol (MCP) server implementation that enhances test creation through deterministic analysis of your applications. This guide explains how to use this capability to generate more accurate, contextually relevant tests.

What is the Model Context Protocol?

The Model Context Protocol (MCP) is a standard for communication between AI tools to provide context and actions. In the context of Test Engine, it can enable:

  • Deterministic analysis: Scanning and analyzing application structure
  • Contextual awareness: Understanding code relationships and dependencies
  • Code generation: Creating code snippets based on context
  • Interactive assistance: Responding to user queries with relevant suggestions
  • Plan integration: Working with Plan Designer for structured test planning

The Test Engine MCP server provides a standard input/output (stdio) implementation that you can use with MCP clients like Visual Studio, GitHub Copilot, or other compatible tools.

How the Test Engine MCP server works

The Test Engine MCP server combines deterministic application scanning with generative recommendations:

  1. Scanning phase: Analyzes your application structure to identify:

    • Control types and hierarchies
    • Navigation paths
    • Data sources and schemas
    • Common interaction patterns
    • Solution component relationships
    • Entity definitions and relationships
    • Form layouts and business rules
    • Custom code components
  2. Analysis phase: Processes the scan results to determine refined prompts that help identify:

    • Testable components and properties
    • Potential test scenarios
    • Coverage opportunities
    • Risk areas
    • Data dependencies
    • Required test data setup
  3. Plan integration phase: Works with Plan Designer to:

    • Organize tests by business requirements
    • Prioritize critical test scenarios
    • Create structured test plans
    • Track test coverage against plan items
    • Generate reports on test coverage
  4. Recommendation phase: Generates contextually relevant prompts to assist with:

    • Test templates and structures
    • Power Fx assertions
    • Navigation sequences
    • Data validation patterns
    • Mock data definitions
    • Error handling scenarios
  5. Integration phase: Communicates with MCP clients through stdio to:

    • Respond to user prompts
    • Provide context-aware suggestions
    • Recommended prompts to assist with generation of complete test cases

Benefits of using the MCP approach

The Model Context Protocol server offers several advantages over pure generative approaches that can be configured to improve:

Benefit Description
Accuracy Deterministic analysis ensures generated tests reference actual controls and properties
Reliability Tests are based on the actual structure of your application rather than assumed patterns
Context awareness The MCP server understands your application's structure and can generate more relevant tests
Integration with Plan Designer Allows tests to be organized according to business requirements and plan items
Solution metadata utilization Uses your solution's entity definitions, relationships, and business rules
Test data generation Creates suggestions to build appropriate test data based on your solution's data model
Complementary to LLMs Works with large language models to enhance their generation capabilities
Standardized approach Follows the MCP specification for consistent interaction with various clients

Setting up the MCP server

To use the Test Engine MCP server:

  1. Install the latest version of Power Apps Test Engine CLI
  2. Set up your application source files in a workspace
  3. Configure the MCP server to analyze your workspace
  4. Connect an MCP client to the server

Prerequisites

  • Power Apps Test Engine CLI (latest version)
  • Source-controlled Power Platform solution
  • An MCP-compatible client such as Visual Studio or GitHub Copilot

Using Plan Designer with MCP

Plan Designer provides a structured approach to organizing and prioritizing your test efforts. When used with the Test Engine MCP server, it enhances the test generation process:

  1. Test plan creation: Define test plans with specific objectives and success criteria
  2. Requirement mapping: Link tests to business requirements and solution components
  3. Test priority: Identify critical paths and high-risk areas for focused testing as you implement your solution
  4. Coverage analysis: Track test coverage against plan items and solution components
  5. Test data definition: Specify test data requirements for each test scenario

How Plan Designer information enhances the MCP server

The MCP server uses Plan Designer information to:

  • Focus test generation on high-priority areas
  • Create test data that covers plan-defined requirements
  • Structure tests to validate specific plan items
  • Generate comprehensive test coverage aligned with business priorities
  • Provide traceability between tests and business requirements

Getting Started

Review the Test Engine MCP for information the MCP Server and getting started.

Combining deterministic analysis with generative AI

The real power of the Test Engine MCP server lies in combining deterministic analysis with generative capabilities:

  • The deterministic analysis ensures accuracy by identifying actual components
  • Generative AI provides natural language understanding and creative test scenarios
  • Together, they produce tests that are both reliable and comprehensive

This hybrid approach helps overcome the limitations of both:

  • Pure deterministic approaches can lack coverage of creative test scenarios
  • Pure generative approaches can reference nonexistent controls or incorrect properties
  • Review process to refine and improve the generated results

Best practices

When working with the Test Engine MCP server:

  • Provide complete source context: Ensure your solution folder contains all relevant files
  • Be specific in prompts: Include specific control names and expected behaviors
  • Iterate incrementally: Start with basic tests and progressively add complexity
  • Verify generated tests: Review and adjust tests before execution
  • Combine with manual expertise: Use the MCP server as a productivity tool, not a replacement for testing knowledge

Troubleshooting

If you encounter issues with the MCP server, try these troubleshooting steps:

Issue Resolution
Server fails to start Verify installation and PATH environment variables
Client can't connect Check stdio configuration and file permissions
Generated tests reference incorrect controls Ensure your solution files are complete and up-to-date
Analysis seems incomplete Use verbose logging to see what the server is scanning

Learn about AI-assisted test authoring
Understand nondeterministic AI testing
Explore Test Engine samples