CheckBox Navigation(十五)Creating a custom Checkbox application for Ubuntu Core testing
阿新 • • 發佈:2021-02-09
技術標籤:Checkbox Ubuntucheckboxubuntu
CheckBox Navigation 15
Creating a custom Checkbox application for Ubuntu Core testing
本指南描述如何建立用於測試新專案的自定義Checkbox 應用程式(專案意味著要使用Checkbox 測試新系統)。
1. Preparing a new Checkbox Project snap
Checkbox-Configure 是為專案生成一個快速框架的工具。它使用autoconf,所以一定要安裝它。
$ sudo apt install autoconf
拿到工具。
$ git clone https://git.launchpad.net/~checkbox-dev/checkbox/+git/checkbox-configure $ cd checkbox-configure $ autoconf
讓我們為專案建立一個名為“myproject”的Checkbox快照。
$ ./configure --with-provider-included project=myproject base=18 && ./cleanup.sh
這將建立使用Snapcraft構建新快照所需的所有檔案。
框架附帶了一些定義的單元,但是您需要新增特定於專案的單元
2. Adding new test jobs
通過新增作業來編輯checkbox-provider-myproject提供程式,特別是列出要執行的所有作業的測試計劃。
按約定單位駐留在.pxu檔案中的units
提供程式的目錄。
$ cd checkbox-provider-myproject
按照約定,單元駐留在提供程式的單元目錄中的.pxu檔案中。
# units/jobs.pxu
id: my-first-job
_summary: Is 10GB available in $HOME
_description:
this test checks if there's at least 10gb of free space in user's home
directory
plugin: shell
estimated_duration: 0.01
command: [ `df -B 1G --output=avail $HOME |tail -n1` -gt 10 ]
您可以在這裡閱讀更多關於如何編寫作業的內容:Checkbox tutorials
3. Reusing existing provider(s)
最好不要重複內容,所以如果您想要執行的測試已經存在於另一個提供程式中,最好在快照中引用該提供程式,並在新的測試專案中包含來自該提供程式的測試或整個測試計劃。
讓我們重新使用我們可以從Checkbox通用快照中使用的“平原-Provider-snappy”提供程式中的磁碟測試。我們所需要做的就是將選定的測試新增到include測試計劃的欄位。
# units/test-plan.pxu
id: myproject-automated
unit: test plan
_name: Automated only QA tests for myproject
_description:
QA test plan for the myproject hardware. This test plan contains
all of the automated tests used to validate the aproject device.
# ''為突出顯示 實際應去除
'include:
com.canonical.certification::disk/encryption/detect
com.canonical.certification::miscellanea/secure_boot_mode_.*
(...)'
你也可以包括整個外部測試計劃。讓我們將CPU測試套件從便攜盒提供者-snappy重用。
# unit/test-plan.pxu 文中
nested_part:
device-connections-tp
2016.com.intel.ipdt::ipdt-plan
com.canonical.certification::usb-automated
# com.canonical.certification::audio-automated # no working auto tests
com.canonical.certification::cpu-automated
com.canonical.certification::disk-automated
com.canonical.certification::ethernet-automated
com.canonical.certification::kernel-snap-automated
com.canonical.certification::memory-automated
com.canonical.certification::networking-automated
com.canonical.certification::rtc-automated
com.canonical.certification::snappy-snap-automated
# ''為突出顯示 實際應去除
'com.canonical.certification::cpu-full'
4. Snapping the new checkbox-myproject snap
剩下的就是把它合在一起!
$ snapcraft