Testrail 報告器
此報告器會建立 TestRail 報告。您首先需要啟用 TestRail API,以便報告可以與 TestRail 通訊並推送測試結果。若要執行此操作,請登入您的 TestRail 帳戶並前往「管理」>「網站設定」>「API」,並確保您勾選了「啟用 API」旁邊的核取方塊。
將 TestRail 的測試案例 ID 新增至測試描述中。例如:
it("C123456 Page loads correctly", async () => {
這也支援多個案例 ID。例如:
it("C123456 C678910 Page loads correctly", async () => {
安裝
若要使用報告器,請將其新增至您的 package.json
npm i --save-dev @wdio/testrail-reporter
用法
將報告器新增至您的 WDIO 設定檔
export const config = {
// ...
reporters:
[
['testrail', {
projectId: 1,
suiteId: 1,
domain: 'xxxxx.testrail.io',
username: process.env.TESTRAIL_USERNAME,
apiToken: process.env.TESTRAIL_API_TOKEN,
runName: 'name for the test run',
oneReport: true,
includeAll: false
caseIdTagPrefix: '' // used only for multi-platform Cucumber Scenarios
}
]
],
// ...
}
選項
projectId
testrail 專案的 ID。
類型:string
suiteId
套件的 ID,預設為套件 1。
類型:string
domain
您的 testrail 實例的網域,例如 your-domain.testrail.io
。
類型:string
username
您的 testrail 實例的使用者名稱。
類型:string
apiToken
您的 testrail 實例的 API 權杖。
類型:string
runName
測試執行的自訂名稱。
類型:string
oneReport
建立單一測試執行。
類型:boolean
includeAll
在測試執行中包含套件中的所有測試。
類型:boolean
caseIdTagPrfix
用於在 Cucumber 標籤中尋找案例 ID 的前綴,適用於多平台 Cucumber 情境執行
類型:string
有關 WebdriverIO 的更多資訊,請參閱首頁。