Suite
Suite
是一組測試。Playwright Test 中的所有測試形成以下層次結構
- 根 Suite 為每個 FullProject 都有一個子 Suite。
- 專案 Suite #1。為專案中的每個測試檔案都有一個子 Suite。
- 檔案 Suite #1
- TestCase #1
- TestCase #2
- 與 test.describe() 群組對應的 Suite
- < 更多測試案例 ... >
- 檔案 Suite #2
- < 更多檔案 Suite ... >
- 檔案 Suite #1
- 專案 Suite #2
- < 更多專案 Suite ... >
- 專案 Suite #1。為專案中的每個測試檔案都有一個子 Suite。
在 reporter.onBegin() 方法中,會給報告器一個根 Suite。
方法
allTests
加入於:v1.10傳回此 Suite 及其後代中所有測試案例的清單,與 suite.tests 相反。
用法
suite.allTests();
傳回
entries
加入於:v1.44直接在此 Suite 中定義的測試案例和 Suite。元素會以其宣告順序傳回。您可以透過使用 testCase.type 和 suite.type 來區分各種條目類型。
用法
suite.entries();
傳回
project
加入於:v1.10此 Suite 所屬專案的組態,或是根 Suite 的 void。
用法
suite.project();
傳回
- FullProject | [undefined]#
titlePath
加入於:v1.10傳回從根目錄到此 Suite 的標題清單。
用法
suite.titlePath();
傳回
屬性
location
加入於:v1.10Suite 定義在來源中的位置。根 Suite 和專案 Suite 遺失。
用法
suite.location
類型
parent
加入於:v1.10父 Suite,根 Suite 遺失。
用法
suite.parent
類型
suites
加入於:v1.10子 Suite。如需 Suite 的層次結構,請參閱 Suite。
用法
suite.suites
類型
tests
加入於:v1.10Suite 中的測試案例。請注意,清單中僅包含直接在此 Suite 中定義的測試案例。在巢狀 test.describe() 群組中定義的任何測試案例都會列在子 suite.suites 中。
用法
suite.tests
類型
title
加入於:v1.10Suite 標題。
- 根 Suite 為空。
- 專案 Suite 的專案名稱。
- 檔案 Suite 的檔案路徑。
- 傳遞給群組 Suite 的 test.describe() 的標題。
用法
suite.title
類型
type
加入於:v1.44傳回 Suite 的類型。Suite 形成以下層次結構:root
-> project
-> file
-> describe
-> ...describe
-> test
。
用法
suite.type
類型
- "root" | "project" | "file" | "describe"