【问题标题】:How to run a Canopy test suite with xUnit?如何使用 xUnit 运行 Canopy 测试套件?
【发布时间】:2021-02-11 16:53:02
【问题描述】:
【问题讨论】:
标签:
f#
xunit
ui-testing
canopy-web-testing
【解决方案1】:
xUnit 有 class fixtures 和 here 是如何将其引入 F# 代码的示例。
结合树冠场景,以下是它的外观示例:
open canopy.classic
open canopy.types
open System
open Xunit
let private openApp() =
...
type Fixture() =
do
start ChromeHeadless
interface IDisposable with
member _.Dispose() =
quit()
type Tests() =
interface IClassFixture<Fixture>
[<Fact>]
member _.``Soundcheck - Server is online``() =
openApp()
[<Fact>]
member _.``Button1 is enabled``() =
openApp()
let button = element "#button1"
Assert.True button.Enabled
[<Fact>]
member _.``Button2 is disabled``() =
openApp()
let button = element "#button2"
Assert.False button.Enabled