ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
เรียกใช้การทดสอบการใช้เครื่องมือจาก APK ที่มีอยู่
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
วิธีการเหล่านี้จะถือว่าคุณมีแพ็กเกจของ Trade Federation อยู่ในเครื่อง หากไม่มี ให้ทำตามวิธีการดาวน์โหลดเพื่อรับแพ็กเกจ
จากนั้นใช้คําสั่งต่อไปนี้เพื่อติดตั้ง APK ของการทดสอบเครื่องมือวัด เรียกใช้การทดสอบ และแสดงการทดสอบที่ทํางานอยู่
./tradefed.sh run instrumentations --apk-path <path of your apk>
โดยมีเอาต์พุตคล้ายกับ
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
คุณระบุ --serial <device serial number>
เพื่อเรียกใช้กับอุปกรณ์หนึ่งๆ ก็ได้ คุณดูหมายเลขซีเรียลของอุปกรณ์ได้โดยใช้ adb devices
ดูรายละเอียดเพิ่มเติมเกี่ยวกับการเรียกใช้ Tradefed ได้ที่ส่วนการทดสอบผ่าน Tradefed
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 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."]]