Skip to content

ccoalm/ccl-skills / skills/test-artifact-management

test-artifact-management

Verified

Create and maintain structured test cases from requirements or code, including initializing or reusing the Feishu Bitable, canonical fields, import, update, status sync, and deprecation. Use for 写测试用例, 写测试用例文档, test-case documents, TC, source-to-TC generation, 初始化测试用例多维表格, 测试用例放飞书, and 导入/更新/同步/废弃测试用例. Skip executable test code, coverage, CI gates, mocks, and regression verification → testing-strategy; broader feature delivery → product-rd-workflow.

references/ci_templates/jenkins.Jenkinsfile

View on GitHub
// Jenkins declarative pipeline — run tests, publish Feishu report, comment on PR.
//
// Replace <unit> placeholders with your deployable-unit directory.
//
// Required Jenkins credentials (Manage Jenkins → Credentials):
//   lark-bot-app-id        (Secret Text)
//   lark-bot-app-secret    (Secret Text)
//   github-token           (Secret Text, repo:status + pull_requests:write)
//
// Committed in <unit>/test/.report-config.json: base_token, table_id, report_doc_url
//
// Requires plugins: github-pullrequest (or similar for PR detection),
// Pipeline: Stage View, Credentials Binding.

pipeline {
  agent any

  environment {
    UNIT = '<unit>'
    LAST_RUN_FILE = "${WORKSPACE}/${UNIT}/test/results/last-run.json"
  }

  stages {
    stage('Setup') {
      steps {
        dir("${UNIT}") {
          // Install lark-cli
          withCredentials([
            string(credentialsId: 'lark-bot-app-id', variable: 'LARK_BOT_APP_ID'),
            string(credentialsId: 'lark-bot-app-secret', variable: 'LARK_BOT_APP_SECRET'),
          ]) {
            sh '''
              npm i -g @larksuiteoapi/lark-cli
              # Pipe secret via stdin so it never appears in ps/argv.
              printf '%s' "$LARK_BOT_APP_SECRET" | \
                lark-cli config init \
                  --app-id "$LARK_BOT_APP_ID" \
                  --app-secret-stdin \
                  --brand feishu
            '''
          }
        }
      }
    }

    stage('Restore last-run snapshot') {
      steps {
        // Use Jenkins Artifact Manager or external storage to persist last-run.json
        // across builds. Simplest: copyArtifacts from the last successful build.
        script {
          try {
            copyArtifacts(
              projectName: env.JOB_NAME,
              filter: "${UNIT}/test/results/last-run.json",
              selector: lastSuccessful(),
              optional: true
            )
          } catch (Exception e) {
            echo "No prior snapshot — first run for this branch."
          }
        }
      }
    }

    stage('Test + Report') {
      steps {
        dir("${UNIT}") {
          // TC_SIDECAR_STRICT=1 makes sidecar write failures fail tests
          // (no silent Bitable staleness when CI passes).
          sh '''
            export TC_SIDECAR_STRICT=1
            npm ci
            make report-run
          '''
        }
      }
    }
    // Note: PR comment is moved to post{always{}} below — it MUST land even
    // on red builds, which is when the regression summary is most useful.
  }

  post {
    // Runs on every build (success or failure). PR comment FIRST — that's
    // the most useful signal for devs when the build is red.
    always {
      script {
        if (env.CHANGE_ID) {
          dir("${UNIT}") {
            withCredentials([string(credentialsId: 'github-token', variable: 'GH_TOKEN')]) {
              sh '''
                python test/scripts/gen_report.py \
                  --config test/.report-config.json --pr-summary --fail-on=never > /tmp/pr-summary.md || true
                if [ -s /tmp/pr-summary.md ]; then
                  gh pr comment "${CHANGE_ID}" --body-file /tmp/pr-summary.md \
                    --repo "${CHANGE_URL%/pull/*}" || true
                fi
              '''
            }
          }
        }
      }
      archiveArtifacts artifacts: "${UNIT}/test/results/**", allowEmptyArchive: true
      junit testResults: "${UNIT}/test/results/*.xml", allowEmptyResults: true
    }
  }
}
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 323kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 323kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 323kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall