Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Chạy kiểm thử đo lường từ các tệp APK hiện có
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Hướng dẫn này giả định rằng bạn có gói Trade Federation trên máy; nếu không, hãy làm theo hướng dẫn tải xuống để tải gói này xuống.
Sau đó, hãy sử dụng lệnh sau để cài đặt APK của kiểm thử đo lường, thực thi các kiểm thử và hiển thị các kiểm thử đang chạy:
./tradefed.sh run instrumentations --apk-path <path of your apk>
Với kết quả tương tự như:
07-17 10:55:32 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testOfArgb
07-17 10:55:33 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testIsRunning
07-17 10:55:34 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testGetCurrentPlayTime
07-17 10:55:35 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testStartDelay
07-17 10:55:35 I/InvocationToJUnitResultForwarder: Run ended in 2m 20s
Bạn có thể tuỳ ý chỉ định --serial <device serial number>
để chạy trên một thiết bị nhất định. Bạn có thể lấy số sê-ri của thiết bị bằng cách sử dụng adb devices
.
Hãy xem phần Kiểm thử thông qua Tradefed để biết thêm thông tin chi tiết về các lần thực thi Tradefed.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Run instrumentation tests from existing APKs\n\nThese instructions assume you have the Trade Federation package available\nlocally; if not,\n[follow the download instructions](/docs/core/tests/tradefed/fundamentals/machine_setup#download-tradefed)\nto obtain it.\n\nThen use the following command to install the APK of instrumentation tests,\nexecute the tests, and display the tests that are running: \n\n ./tradefed.sh run instrumentations --apk-path \u003cpath of your apk\u003e\n\nWith output resembling: \n\n 07-17 10:55:32 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testOfArgb\n 07-17 10:55:33 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testIsRunning\n 07-17 10:55:34 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testGetCurrentPlayTime\n 07-17 10:55:35 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testStartDelay\n 07-17 10:55:35 I/InvocationToJUnitResultForwarder: Run ended in 2m 20s\n\nYou can optionally specify `--serial \u003cdevice serial number\u003e` to run\nagainst a given device. The serial number of your device can be obtained\nusing `adb devices`.\n\nSee the\n[Testing through Tradefed section](/docs/core/tests/tradefed/testing/through-tf)\nfor more details about Tradefed executions."]]