Fitnesse: how to initialize/tearDown suite (not individual test)

别等时光非礼了梦想. 提交于 2019-12-06 07:41:55

问题


I have a basic question:

When using JUnit, in your test suite (the class that holds your tests) you can declare suite-level initialization and cleanUp behaviour using @BeforeClass and @AfterClass. The methods thusly annotated are called before the suite begins and after the suite finishes all its tests respectivelly. This differs from the methods inside the suite which are annotated with @Before and @After which are called before each test is launched and after each finishes respectivelly.

I want the same setup in Fitnesse. I found out how to have stuff that's executed before and after each test (you create a SetUp page and a TearDown page in the suite, and they'll be called before and after each test in the suite). These are the equivalent of @Before and @After in JUnit. I can't however understand how can I declare a suite-level initialization and cleanUp logic (like @BeforeClass and @AfterClass in JUnit). Can someone please tell me if/how this can be achieved?

What I've tried is have a parent suite with SetUp and TearDown pages, and INSIDE that parent suite have mutlipl child suites which contain the actual tests (each with it's own SetUp and TearDown), hoping that this way the parent suite SetUp and TearDown pages will be called before and after each child suite, and the child suite's SetUp and TearDown pages will be called before and after each test in the suite, but no dice, what happends here is that the child suite SetUp/TearDown overrides the parent suite ones.


回答1:


SuiteSetUp and SuiteTearDown - see http://www.fitnesse.org/FitNesse.FullReferenceGuide.UserGuide.WritingAcceptanceTests.SpecialPages



来源:https://stackoverflow.com/questions/7997388/fitnesse-how-to-initialize-teardown-suite-not-individual-test

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!