에이전트 명령어

프로젝트의 airbuild.yaml에 있는 이름 붙은 테스트 스크립트 하나를 실행하고 그 출력물을 가져옵니다.

runtest는 프로젝트 airbuild.yaml의 test: 아래에 있는 이름 붙은 항목을 실행하고, 그 항목이 출력물로 나열한 파일을 모읍니다. 팀의 환경 안에서 실행됩니다.

팀 테스트가 실행되는 곳
클라우드 팀 ios: 선택한 소스가 새 macOS 빌더로 업로드됩니다. android_beta: Linux 빌더. pocketjs_beta: 팀 자체 호스트.
Mac 팀 팀의 Mac에서 실행됩니다. --environment와 --list-environments는 클라우드 팀 전용입니다.

runtest는 아무것도 서명하지 않고 앱 미리보기를 요청하지도 않습니다.

개요

터미널 창
runtest <project-id> [--platform <platform>] [--source <directory>] [--script <name>] [--additional-options '<flags>'] [--environment ID] [--no-cache]
runtest <project-id> --follow [--run ID]    # reattach; starts nothing
runtest --cancel [--run ID]
runtest --list-environments
runtest --help

옵션

옵션 값 기본값 하는 일
<project-id> UUID 필수 테스트할 프로젝트.
--script 테스트 이름 항목이 하나뿐이면 그 항목 test: 아래 어느 항목을 실행할지. 여러 개면 필수입니다.
--additional-options 한 줄의 플래그 비어 있음 스크립트에 additional_options 환경 변수로 그대로 전달됩니다. 공백으로 구분한 플래그를 쓰세요. 셸 표현식이나 중첩된 따옴표는 안 됩니다.
--platform ios, pocketjs_beta, android_beta 기본 매니페스트 기본 airbuild.yaml 대신 .airbuild/airbuild.<platform>.yaml을 읽습니다.
--source 디렉터리 프로젝트 디렉터리 그 디렉터리(예: git worktree)를 테스트합니다. 그 디렉터리에 airbuild.yaml이 있으면 그것을, 없으면 프로젝트의 것을 씁니다. 현재 디렉터리 기준입니다.
--environment --list-environments의 ID 기본값 클라우드 팀: 다른 빌더 환경(macOS와 Xcode 버전)에서 실행합니다.
--no-cache — 캐시 사용 빌더 캐시(airbuild-cache, DerivedData, android_beta의 Gradle 빌드 캐시) 없이 실행하고 아무것도 저장하지 않습니다.
--follow — — 진행 중인 실행에 다시 연결합니다. 끝난 실행이면 그렇다고 알리고 저장된 출력을 다시 보여 줍니다. 실행을 시작하지는 않습니다.
--run 실행 ID 실행 중인 실행, 없으면 가장 최근 것 --follow나 --cancel과 함께 씁니다. 여러 실행이 진행 중일 때 필요합니다.
--cancel — — 실행에 중지를 요청하고 확인을 최대 30초 기다립니다.
--list-environments — — 클라우드 팀: 빌더 환경을 나열합니다.

runtest는 --sign, --unsigned, --command, --output을 거부합니다. 매니페스트 없이 인라인 스크립트를 실행하려면 runmacos나 runlinux를 쓰세요.

runtest가 airbuild.yaml에서 읽는 내용

runtest에는 version: 3 또는 4가 필요합니다. build: 섹션은 필요 없습니다. 매니페스트는 runbuild와 같은 방식으로 찾습니다.

airbuild.yamlYML
version: 3
test:
  app:
    script: |
      airbuild-xcode test -project App.xcodeproj -scheme App \
        -resultBundlePath .airbuild/artifacts/Tests.xcresult $additional_options
    outputs:
      - .airbuild/artifacts/Tests.xcresult
  unit:
    script: swift test
키 설명
test.<name> 테스트 항목 하나. 이름에는 ASCII 영문자, 숫자, 점, 밑줄, 하이픈만 씁니다. 각 항목은 script와 outputs만 받습니다.
test.<name>.script Bash 스크립트. 소스 루트에서 -e -o pipefail로 실행됩니다.
test.<name>.outputs 선택 사항. 스크립트가 쓰는 파일이나 디렉터리로, 소스 루트 기준입니다.

출력 경로는 구체적인 상대 경로여야 합니다. 절대 경로, .., 와일드카드, 심볼릭 링크, 특수 파일은 안 되며, 다른 경로 안에 들어 있는 경로도 안 됩니다. 출력물은 하나의 수집 디렉터리 안에서 상대 경로를 그대로 유지합니다.

스크립트의 PATH에는 node_modules 같은 파일을 실행 사이에 보관하는 airbuild-cache도 있으며, Mac에서는 처음 실행하는 airbuild-xcode install이나 test가 프로젝트의 DerivedData를 되살립니다. android_beta에서는 runtest가 Gradle 빌드 캐시를 직접 복원하고 저장합니다.

출력

• Build started in the Environment. Run: <run-id>
• It runs to completion even if this command is interrupted (reattach with: runtest <project-id> --follow --run <run-id>).
Airbuild remote execution
… the test script's output …
✓ Command succeeded in <time>.

✓ Test finished.
  Build: <build-id>
  Artifact: <path to the collected outputs>

실행이 실패해도 존재하는 출력물은 가져오며, runtest는 스크립트의 종료 코드로 종료합니다.

✗ Test failed.
  Reason: <why>
  Artifact: <path to the collected outputs>

출력물이 없으면 No outputs requested; skipping artifact download.를 출력합니다.

여러 개 실행하기

runtest에는 runbuild, runmacos, runlinux와 별개인 자기 슬롯이 있습니다. 클라우드 팀은 여러 runtest 실행을 동시에, 각각 새 빌더에서 실행하고, Mac 팀은 한 번에 하나씩 실행합니다. 실행을 시작하면 실행 ID가 출력되며, 여러 개가 실행 중이면 --follow와 --cancel에 --run ID가 필요합니다. Ctrl-C는 연결만 끊습니다.

종료 코드

코드 의미
0 스크립트가 통과했고 선언한 모든 출력물이 쓰였습니다.
1 실행을 시작할 수 없었거나 잃어버렸습니다.
2 잘못된 옵션이나 인수로 아무것도 실행되지 않았습니다.
65 스크립트는 통과했지만 선언한 출력물이 없거나 내보낼 수 없습니다.
130 취소되었거나 Ctrl-C로 연결을 끊었습니다.
기타 테스트 스크립트 자체의 종료 코드.

오류

메시지 해야 할 일
runtest requires airbuild.yaml with version: 3 or 4 and named test scripts. test: 섹션이 있는 매니페스트를 추가하세요.
runtest requires airbuild.yaml version: 3 or 4. 매니페스트에 version: 3 또는 version: 4를 설정하세요.
test must contain named scripts; names use only ASCII letters, digits, dots, underscores and hyphens. test: 섹션을 고치세요.
Select a test with --script. Available scripts: … 나열된 이름 중 하나로 --script를 넘기세요.
--additional-options must be a single line. 줄바꿈을 없애세요.
Outputs must be concrete relative paths inside the project, without parent traversal or glob patterns. outputs를 고치세요.
Output paths must not repeat or contain another declared output. 겹치는 부분을 없애세요.
Declared output was not produced: <path> 스크립트가 그 파일을 쓰게 하거나 outputs에서 빼세요.
Cannot export a symbolic link: <path> / Output contains a symbolic link or special file: <path> 일반 파일과 디렉터리만 내보내세요.
runtest does not accept build or signing options. --sign / --unsigned를 빼세요.
A runtest execution is already running in this Team's Environment. 그 실행을 follow하거나 취소하세요.
N runtest executions are running; choose one with --run. 나열된 실행 ID 중 하나를 넘기세요.

예시

터미널 창
# The only test entry
runtest 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10
터미널 창
# One XCTest class from the "app" entry
runtest 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --script app \
  --additional-options '-only-testing:AppTests/ExampleTests'
터미널 창
# Android tests
runtest 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --platform android_beta