简体   繁体   English

在FitNesse中,我如何只为一个套件运行套件设置代码?

[英]In FitNesse how can I run suite setup code for one suite only?

I want to run some suite setup code at the start of a particular suite. 我想在特定套件的开头运行一些套件设置代码。 As I understand it a suite will run a SuiteSetUp page that is its sibling (ie next to it, in the same folder). 据我了解,套件将运行与其同级的SuiteSetUp页面(即,在其旁边的同一文件夹中)。 However, that would mean the same SuiteSetUp page would also be run by other suites in the same folder. 但是,这意味着同一SuiteSetUp页面也将由同一文件夹中的其他套件运行。

How can I make a SuiteSetUp page that is run only by a single suite, say SuiteA, and ignored by other suites in the same folder as SuiteA? 如何制作仅由单个套件(例如SuiteA)运行,并被SuiteA所在文件夹中的其他套件忽略的SuiteSetUp页面?

If a SuiteSetUp page is not the best way to do this, what is? 如果SuiteSetUp页面不是执行此操作的最佳方法,那是什么? I only want to run the code once at the start of the suite, not at the start of each test, so I don't want to add the code to a test SetUp page. 我只想在套件开始时运行一次代码,而不是在每个测试开始时运行代码,因此我不想将代码添加到测试“ SetUp”页面中。

I assume I can't just add the setup code to the first test page in the suite. 我想我不能只是将设置代码添加到套件的第一个测试页中。 From what I've read it seems the execution order of tests within a suite is not guaranteed, so the first test page in the suite may not always be executed before the other tests. 根据我的阅读,似乎无法保证套件中测试的执行顺序,因此套件中的第一个测试页可能并不总是在其他测试之前执行。

将SuiteSetup放置在Suite A中。它将在对Suite A进行第一次测试之前运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM