• English
  • Midscene Test overview

    Midscene Test (@midscene/test) is a natural-language E2E testing framework designed for the AI era. It combines AI’s flexibility with the determinism of code in each test case: natural language expresses actions and expectations, while code handles business logic that requires precise control. Test flows have a clear, readable structure that both people and AI agents can understand, write, and maintain, allowing test intent and its underlying implementation to evolve independently. Get started with Midscene Test

    AI and business operations in one YAML file

    Each YAML step calls a Node: an AI operation, a platform operation, or a custom business operation. Compose these Nodes into test cases that people and AI agents can read, write, and review.

    cases/refund.yaml
    beforeEach:  - order.prepare: { status: paid }Business  - gotoUrl: ${shopUrl}/orders/latestBusinesscases:  - name: A paid order supports a full refund    steps:      - aiAct: Apply for a full refund and submitAI      - aiAssert: The page shows that the refund was submittedAI      - order.checkRefund: { status: refunding }BusinessafterEach:  - clearCookies: {}Business

    Test cases maintained by people and AI

    As your product evolves, your test project can grow a library of reusable business operations while keeping test intent clear in each case. People and AI agents can use the same capability reference to understand, write, and update cases, while the implementation of business operations is maintained independently.

    Midscene Test provides custom Nodes for these business capabilities and generates a Markdown Node Spec from the operations registered in the project, giving people and AI agents a shared reference for authoring test cases. Explore custom Nodes

    1. nodes/order.ts
      defineNode({
        name: 'order.prepare',
        description: "Create a test order",
        inputSchema: z.strictObject({
          status: z.literal('paid'),
        }),
        async execute({ input }) {
          await orders.create(input);
        },
      });
    2. midscene-node-spec.md
      ### order.prepare
      Create a test order
      - status: "paid"
    3. case.yaml
      steps:
        - order.prepare:
            status: paid

    Next steps

    Migrating from the legacy YAML runner

    The legacy tasks/flow YAML runner is in maintenance mode, receiving compatibility updates and necessary fixes. Use Midscene Test for new projects and cases. Existing projects can continue using the midscene command; see Migrate to Midscene Test when switching to midscene-test.