测试编写、冒烟测试与 CI 流水线
Test authoring, smoke tests & CI pipelines
Write reproduction and smoke tests (including checks that tools and integrations work end to end) and fix CI workflows until the pipeline is green.
20 条本项目编写的提案 · 分类 v1.1 · 新增基准运行 0 次。下方验证方式与部分得分规则是设计,不是执行结果。
- 典型应用
- pytest · GitHub Actions · GitLab CI
- 小类 GUI 需求标签
CL· CLI 足够
数字员工关联
本项目的小类归属,不代表员工能力实证或已导入基准覆盖。验收与价值指标均为建议,未测量 ROI。
关联岗位
- IT 与软件交付 · 分别对应服务工单、恢复的配置、身份记录、仓库修复、通过的 CI 和发布包。
任务提案 · 20
展开查看完整原文与建议检查方式;两种界面均保留提案英文原文。
R02.02.01.02-T01 Write a pytest that reproduces a reported bug before any fix exists
原始指令
Repo `/work/invoicekit` (Python) at the buggy commit. Issue #88: credit notes with a negative discount produce a positive total. Write a test in `tests/test_issue_88.py` that fails on the current code for this reason and will pass once the bug is fixed. Do not change source files.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- pytest · git
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 2 / 5
建议验证方式
Test fails on the buggy commit with an assertion (not an error/import failure) and passes on the hidden gold patch; it also fails on 3 hidden plausible-but-wrong patches; src/ unchanged.
建议部分得分
40% fails on buggy; 40% passes on gold; 20% rejects wrong patches
R02.02.01.02-T02 Fix a failing GitHub Actions workflow until the pipeline is green
原始指令
In the sandbox Gitea/Act-compatible runner for repo `/work/webapp`, the `ci.yml` workflow fails: wrong Node version for the lockfile, a cache key that never hits, and a test job that runs before the build artifact is uploaded. Fix the workflow (not the app) so it goes green and the cache hits on the second run.
- 平台
lin· Linux- 应用
- GitHub Actions · act
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Grader runs the workflow twice with act: both runs succeed; second run logs a cache hit; job graph has test needs build with artifact download; only .github/ files changed.
建议部分得分
40% pipeline green; 25% cache hit on rerun; 25% job dependencies correct; 10% scope of change
R02.02.01.02-T03 Author a GitLab CI pipeline with stages, artifacts and rules
原始指令
Write `.gitlab-ci.yml` for `/work/geo-service` (Go) with stages lint, test, build, package: test produces JUnit and coverage reports, build produces a binary artifact consumed by package (Docker image to the sandbox registry), package runs only on tags, and MR pipelines skip package.
- 平台
lin· Linux- 应用
- GitLab CI · gitlab-runner
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Sandbox GitLab: pipelines for an MR and a tag both succeed; MR pipeline has no package job; tag pipeline pushes image tag = git tag; JUnit report and coverage % visible via API; `gitlab-ci-lint` clean.
建议部分得分
25% stages/lint; 25% test reports; 25% artifacts flow; 25% rules for MR vs tag
R02.02.01.02-T04 Raise a module's mutation score to at least 80%
原始指令
In `/work/pricing-engine` (Python), mutmut reports a 41% mutation score for `pricing/discounts.py`. Add tests (do not change source) until the mutation score for that module is at least 80%, with tests that are deterministic and run under 30 s total.
- 平台
lin· Linuxmac· macOS- 应用
- pytest · mutmut
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Grader reruns mutmut on the module: score >= 80% (partial credit linear from 41%); tests pass 5 times in random order; runtime < 30 s; source unchanged (hash).
建议部分得分
80% mutation score (linear credit from 0.41 to 0.80); 20% determinism + runtime
R02.02.01.02-T05 Find a seeded bug with Hypothesis property-based tests
原始指令
Library `/work/intervalset` (Python) has a subtle bug in `union` for adjacent half-open intervals. Without reading the git history, write Hypothesis property tests (invariants such as idempotence, commutativity, membership agreement with a naive model) that find it, and save the minimal failing example in `FOUND.md`.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- pytest · Hypothesis
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Property tests fail on the buggy version within 200 examples (fixed seed) and pass on the gold fix; FOUND.md example reproduces the bug; also fail on 2 other hidden mutants.
建议部分得分
40% detects seeded bug; 30% passes on gold; 20% catches extra mutants; 10% minimal example
R02.02.01.02-T06 Write Playwright end-to-end tests for login and checkout journeys
原始指令
For the sandbox shop at `/work/shop` (runs via docker compose), write Playwright tests covering: login with valid/invalid credentials, adding items to cart, coupon application, and checkout with the test card, using page objects and no fixed sleeps. Tests must be stable across 5 runs.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- Playwright · Docker
- 交互表面
term· 终端brow· 浏览器- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Suite passes 5/5 runs headless; no waitForTimeout calls; tests fail on 4 hidden seeded app bugs (one per journey); traces enabled on failure in config.
建议部分得分
30% stable passing suite; 50% catches seeded bugs (scaled); 20% no sleeps + page objects
R02.02.01.02-T07 Make a cross-OS CI matrix pass, including a Windows-only path bug
原始指令
Repo `/work/fsync-tool` (Python) has a GitHub Actions matrix over ubuntu/macos/windows × Python 3.10-3.13. The Windows jobs fail on path separators and file locking in tests and code; macOS fails on a case-insensitive filesystem assumption. Fix code and tests so all 12 jobs pass.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- GitHub Actions · pytest
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 5 / 5
建议验证方式
Grader runs the suite on three real VMs (Linux, macOS, Windows) for 4 Python versions: all green; no tests skipped or xfailed that weren't before; hidden Windows-path tests pass.
建议部分得分
40% Windows green; 25% macOS green; 20% no new skips; 15% hidden path tests
R02.02.01.02-T08 Stabilise a flaky time-dependent test suite
原始指令
In `/work/subscriptions` (TypeScript, Jest), 9 tests fail intermittently around midnight UTC, month ends and DST. Make the suite deterministic by controlling time (fake timers / injected clock) without weakening assertions or changing production behavior.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- Jest · Node
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Grader runs the suite 50 times with libfaketime at 12 adversarial wall-clock instants: all pass; assertion count not reduced (AST count); production code changes limited to clock injection; hidden behavior tests pass.
建议部分得分
60% deterministic across instants; 25% assertions preserved; 15% minimal prod changes
R02.02.01.02-T09 Add a coverage gate and write tests to reach it
原始指令
Add a CI coverage gate of 85% line and 75% branch coverage for `/work/csvtools` (Python) in `ci.yml` and `pyproject.toml`, then write tests until the gate passes. Current coverage is 58%/40%. Exclusions are only allowed for the `__main__` block.
- 平台
lin· Linuxmac· macOS- 应用
- pytest-cov · GitHub Actions
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Grader measures coverage: line >= 85%, branch >= 75%; fail_under configured; no new `pragma: no cover` beyond __main__; tests kill >= 60% of a hidden mutant set (prevents assertion-free tests).
建议部分得分
40% coverage targets; 20% gate configured; 40% mutant kill threshold
R02.02.01.02-T10 Add consumer-driven contract tests between two services
原始指令
Services `/work/orders` (consumer, TypeScript) and `/work/inventory` (provider, Java Spring) talk over REST. Add Pact consumer tests for the 4 interactions the consumer uses, publish pacts to the sandbox Pact Broker, and add provider verification in the provider's build with provider states.
- 平台
lin· Linux- 应用
- Pact · Jest · JUnit
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Broker shows a pact with 4 interactions and a successful verification; a hidden breaking change to the provider (renamed field) makes verification fail; can-i-deploy returns true for current versions.
建议部分得分
30% consumer pacts; 30% provider verification; 25% catches breaking change; 15% broker integration
R02.02.01.02-T11 Write JUnit 5 tests with mocks reaching 90% branch coverage
原始指令
Class `RefundService` in `/work/payments-java` has complex branching and depends on a gateway client and a clock. Write JUnit 5 + Mockito tests that reach >= 90% branch coverage for that class (JaCoCo), using parameterized tests where appropriate, without modifying the class.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- Maven · JUnit 5 · Mockito · JaCoCo
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
JaCoCo branch coverage for RefundService >= 90%; PIT mutation score for the class >= 70%; tests pass; class source unchanged.
建议部分得分
50% branch coverage; 40% mutation score; 10% unchanged source
R02.02.01.02-T12 Build a release workflow that publishes with OIDC instead of stored secrets
原始指令
In the sandbox GitHub-compatible environment, write a release workflow for `/work/cli-tool` that, on a version tag, builds artifacts for 3 OSes, signs them with keyless signing, and pushes a container image to the sandbox registry using OIDC token federation (no long-lived secrets in the repo).
- 平台
lin· Linux- 应用
- GitHub Actions · cosign · Docker
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Tag push triggers the workflow successfully; registry has image with tag; cosign verify with the expected OIDC identity passes; repo secrets list empty; permissions block minimal (id-token: write only where needed).
建议部分得分
30% multi-OS build; 30% OIDC push; 25% signatures verify; 15% least-privilege permissions
R02.02.01.02-T13 Convert a Jenkins pipeline to GitHub Actions with equivalent behavior
原始指令
Repo `/work/legacy-api` has a declarative Jenkinsfile with parallel stages, a matrix over JDK 17/21, stash/unstash, a manual approval before deploy, and post-failure notifications. Write equivalent GitHub Actions workflows (environments for approval) and remove the Jenkinsfile.
- 平台
lin· Linux- 应用
- GitHub Actions · Jenkins
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
act/sandbox runner executes the workflow: matrix jobs green; artifacts passed between jobs; deploy job gated by environment with required reviewer; failure notification step present with if: failure(); Jenkinsfile deleted.
建议部分得分
30% matrix + parallel; 25% artifacts; 25% approval gate; 20% notifications + cleanup
R02.02.01.02-T14 Add a libFuzzer harness to CI that finds a crash in a C parser
原始指令
Library `/work/libini` (C) has no fuzzing. Write a libFuzzer harness and seed corpus for `ini_parse`, add a CI job that runs it for 5 minutes with ASan/UBSan, and keep the job green by fixing any bugs the fuzzer finds (at least one is seeded).
- 平台
lin· Linux- 应用
- clang · libFuzzer · GitHub Actions
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Harness builds with -fsanitize=fuzzer,address,undefined; grader's 10-minute run on fixed code finds no crash; on the original code the harness finds the seeded crash within 5 min; CI job defined with corpus caching.
建议部分得分
30% harness finds seeded bug; 30% bug fixed; 25% clean 10-min run; 15% CI job
R02.02.01.02-T15 Add golden snapshot tests for a CLI's output
原始指令
Add snapshot tests for `/work/tablefmt` CLI (Rust) using insta: cover all 6 output formats, Unicode width cases and error messages, with a review workflow documented in `CONTRIBUTING.md`. Snapshots must not include machine-specific paths or timestamps.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- cargo · insta
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 2 / 5
建议验证方式
cargo test passes on Linux, macOS, Windows; >= 25 snapshots across 6 formats; snapshots free of absolute paths/timestamps (regex); a hidden output change in one format fails the suite.
建议部分得分
40% snapshots cover formats; 25% cross-OS stable; 25% detects change; 10% docs
R02.02.01.02-T16 Write table-driven Go tests and enable the race detector in CI
原始指令
Package `/work/ratelimit-go` has two ad hoc tests. Write table-driven tests with subtests covering the limiter's documented behaviors, a concurrency test exercised under `-race`, a benchmark, and a CI job running `go test -race -count=3 ./...` plus `go vet`.
- 平台
lin· Linuxmac· macOS- 应用
- go · GitHub Actions
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Tests pass with -race -count=3; hidden mutants (6) killed >= 5; t.Run subtests present; benchmark compiles and runs; CI job config valid (actionlint).
建议部分得分
50% mutants killed; 20% race test; 15% benchmark; 15% CI job
R02.02.01.02-T17 Set up pre-commit hooks so linters and type checks pass
原始指令
Add a `.pre-commit-config.yaml` to `/work/datatools` (Python) running ruff (lint + format), mypy and a secrets scanner, pinned to specific versions, then fix the codebase so `pre-commit run --all-files` passes without disabling rules globally.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- pre-commit · ruff · mypy
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 2 / 5
建议验证方式
`pre-commit run --all-files` exits 0; hooks pinned (rev tags); no global ignore lists added beyond 3 inline noqa; tests still pass; a hidden commit with a fake secret is blocked by the hook.
建议部分得分
30% config; 40% codebase passes; 15% minimal suppressions; 15% secret detection
R02.02.01.02-T18 Configure branch protection and required checks in a sandbox Git forge UI
原始指令
In the sandbox GitHub Enterprise-like forge web UI, configure branch protection for `main` of repo `acme/api`: require PRs with 2 approvals including a CODEOWNERS review, require status checks `ci/test` and `ci/lint` to pass on up-to-date branches, block force-push and deletion, and require signed commits.
- 平台
web· 任意系统(网页)- 应用
- Git forge web UI
- 交互表面
brow· 浏览器- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
G2· GUI 必要- 交互原语
click· 指向与点击type· 文字与表单nav· 平移 / 缩放 / 滚动- 工作产物
WP08· 应用 / 系统状态- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Forge API branch protection for main: required_approving_review_count 2, require_code_owner_reviews, required checks exactly the two contexts with strict true, allow_force_pushes false, allow_deletions false, required_signatures true.
建议部分得分
30% reviews; 30% status checks strict; 20% force-push/deletion; 20% signed commits
R02.02.01.02-T19 Cut a 40-minute CI test stage to under 12 minutes without dropping tests
原始指令
CI for `/work/bigapp` (Python + Postgres) runs 6,800 tests serially in 40 min. Reduce wall time below 12 minutes on the grader's 8-core runner: parallelise safely (per-worker DB schemas), shard across jobs with timing-based balancing, and fix the order-dependent tests that break when parallelised. No test may be skipped or deleted.
- 平台
lin· Linux- 应用
- pytest-xdist · GitHub Actions · Postgres
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
long· 长流程- 提案难度
- 5 / 5
建议验证方式
Grader runs CI 3 times: wall time < 12 min each, all 6,800 tests collected and passing (count check), no new skip markers; order-dependence fixed (random-order run passes).
建议部分得分
40% time target (linear 40->12 min); 30% all tests run and pass; 30% order-independence
R02.02.01.02-T20 Fix a test failure that only happens in CI
原始指令
`/work/reporting` passes locally but fails in CI with assertion diffs in currency formatting and file ordering. The CI container differs in locale, timezone, filesystem ordering and available fonts. Reproduce the CI environment locally with Docker, find each cause, and fix code/tests so results are environment-independent.
- 平台
lin· Linux- 应用
- Docker · pytest · GitHub Actions
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
hidden· 隐藏 / 过期状态- 提案难度
- 4 / 5
建议验证方式
Grader runs the suite under 6 environment variants (LANG, TZ, overlay vs ext4 ordering, missing fonts): all pass; no environment pinning hacks in tests (e.g., forcing TZ only in CI); hidden tests pass.
建议部分得分
Per-variant credit: 6 variants scaled to 80%; 20% no environment-pinning hacks
已有研究映射
以下沿用研究目录中的基准与小类映射,不是逐题标注、执行记录或产品背书。