AGENT SKILL

E2E 端到端测试运行

run-e2e-tests

运行 E2E 测试以验证完整的用户工作流(如环境的发现、创建和选择)。在发布前或进行重大变更后使用此技能。

适用职业测试工程师
License 许可
MIT
最近更新
2026-11-14
Stars
★ 147
Forks
83

01 前言 Front Matter

name
run-e2e-tests
description
Run E2E tests to verify complete user workflows like environment discovery, creation, and selection. Use this before releases or after major changes.

02 资源文件 5

03 SKILL.md 正文

Run E2E (end-to-end) tests to verify complete user workflows work correctly.

When to Use This Skill

  • Before submitting a PR with significant changes
  • After modifying environment discovery, creation, or selection logic
  • Before a release to validate full workflows
  • When user reports a workflow is broken

Note: Run smoke tests first. If smoke tests fail, E2E tests will also fail.

Quick Reference

Action Command
Run all E2E tests npm run compile && npm run compile-tests && npm run e2e-test
Run specific test npm run e2e-test -- --grep "discovers"
Debug in VS Code Debug panel → "E2E Tests" → F5

How E2E Tests Work

Unlike unit tests (mocked) and smoke tests (quick checks), E2E tests:

  1. Launch a real VS Code instance with the extension
  2. Exercise complete user workflows via the real API
  3. Verify end-to-end behavior (discovery → selection → execution)

They take longer (1-3 minutes) but catch integration issues.

Workflow

Step 1: Compile and Run

npm run compile && npm run compile-tests && npm run e2e-test

Step 2: Interpret Results

Pass:

  E2E: Environment Discovery
    ✓ Can trigger environment refresh
    ✓ Discovers at least one environment
    ✓ Environments have required properties
    ✓ Can get global environments

  4 passing (45s)

Fail: Check error message and see Debugging section.

Debugging Failures

Error Cause Fix
No environments discovered Python not installed Install Python, verify it's on PATH
Extension not found Build failed Run npm run compile
API not available Activation error Debug with F5, check Debug Console
Timeout exceeded Slow operation or hang Increase timeout or check for blocking code

For detailed debugging: Debug panel → "E2E Tests" → F5

Prerequisites

E2E tests have system requirements:

  • Python installed - At least one Python interpreter must be discoverable
  • Extension builds - Run npm run compile before tests
  • CI needs webpack build - Run npm run compile (webpack) before tests, not just npm run compile-tests (tsc)

Adding New E2E Tests

Create files in src/test/e2e/ with pattern *.e2e.test.ts:

import * as assert from 'assert';
import * as vscode from 'vscode';
import { waitForCondition } from '../testUtils';
import { ENVS_EXTENSION_ID } from '../constants';

suite('E2E: [Workflow Name]', function () {
    this.timeout(120_000); // 2 minutes

    let api: ExtensionApi;

    suiteSetup(async function () {
        const extension = vscode.extensions.getExtension(ENVS_EXTENSION_ID);
        assert.ok(extension, 'Extension not found');
        if (!extension.isActive) await extension.activate();
        api = extension.exports;
    });

    test('[Test description]', async function () {
        // Use real API (flat structure, not nested!)
        // api.getEnvironments(), not api.environments.getEnvironments()
        await waitForCondition(
            async () => (await api.getEnvironments('all')).length > 0,
            60_000,
            'No environments found',
        );
    });
});

Test Files

File Purpose
src/test/e2e/environmentDiscovery.e2e.test.ts Discovery workflow tests
src/test/e2e/index.ts Test runner entry point
src/test/testUtils.ts Utilities (waitForCondition, etc.)

Notes

  • E2E tests are slower than smoke tests (expect 1-3 minutes)
  • They may create/modify files - cleanup happens in suiteTeardown
  • First run downloads VS Code (~100MB, cached in .vscode-test/)
  • For more details on E2E tests and how they compare to other test types, refer to the project's testing documentation.

04 同仓库更多 Skills

microsoft
microsoft/vscode-python-environments

VS Code 设置优先级规则

settings-precedence

VS Code 设置优先级规则及常见陷阱。适用于任何读取或写入设置的代码。涵盖 getConfiguration 作用域、inspect() 与 get() 的区别,以及多工作区处理。

软件开发工程师开发环境与工具链管理
★ 147
microsoft
microsoft/vscode-python-environments

VS Code 扩展冒烟测试

run-smoke-tests

运行冒烟测试,在真实 VS Code 环境中验证扩展功能。在更改后检查基本功能是否正常工作时使用。

测试工程师测试与质量保障
★ 147
microsoft
microsoft/vscode-python-environments

代码提交前(pre-commit)检查

run-pre-commit-checks

在提交代码前运行强制性的 pre-commit 检查,包括 lint(代码规范检查)、类型检查和单元测试。每次提交前都必须运行。

软件开发工程师代码仓库协作管理
★ 147
microsoft
microsoft/vscode-python-environments

扩展组件集成测试运行

run-integration-tests

运行集成测试以验证扩展的各个组件能否正确协同工作。在修改组件交互或事件处理后使用此技能。

测试工程师测试与质量保障
★ 147
microsoft
microsoft/vscode-python-environments

Python 环境管理器探测

python-manager-discovery

针对特定环境管理器的探测模式及已知问题。在编写或审查 conda、poetry、pipenv、pyenv 或 venv 的环境探测代码时使用。

软件开发工程师开发环境与工具链管理
★ 147
microsoft
microsoft/vscode-python-environments

代码库健康快照生成

generate-snapshot

生成代码库健康快照,用于技术债务追踪与规划。分析 git 历史、代码复杂度、债务标记和依赖项,以识别热点区域和重构优先级。

软件开发工程师代码仓库协作管理
★ 147