我有一个像这样的功能文件:
Feature: Viewing revenue
Background:
Given invoices
| Date | Amount |
| 1/1/2010 | 200 |
| 1/1/2011 | 300 |
Scenario: Total revenue
Then the total revenue is
| Label | Revenue |
| | $500 |
Scenario: Total revenue by year
When I choose to view it by "Year"
Then the total revenue is
| Label | Revenue |
| 2010 | $200 |
| 2011 | $300 |
我想在每个场景执行后运行一些清理代码。我有一个用 AfterScenario 属性装饰的函数,如下所示:
let [<AfterScenario>] ``Drop Invoices`` () =
Invoices.removeAll
该函数确实被调用,但只有一次,并且只有当我通过 NUnit 的 gui 运行器重新加载项目时。测试的后续运行,不重新加载项目,不调用该函数。