Fitnesse: how to initialize/tearDown suite (not in

2019-04-11 20:21发布

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.

标签: fitnesse
1条回答
登录 后发表回答