问题
I have had DbFit running in Standalone mode for a while and have had the fixture import in my SetUp wiki like
#SetUp content
[...]
!|Import|
|dbfit.fixture|
[...]
and with a test wiki like
#DbTestWiki content
!|DatabaseEnvironment|ORACLE|
|Connect|${URI}|${USERNAME}|${PASSWORD}|
[...]
It is working perfectly fine in this way. But I thought that it would be nicer to have all imports made in the SuiteSetUp wiki. So I moved the import code there and ran my test; the result was this exception
java.lang.NullPointerException
at dbfit.fixture.DatabaseEnvironment.connect(DatabaseEnvironment.java:56)
[...]
at fitlibrary.suite.InFlowPageRunner.run(InFlowPageRunner.java:34)
[...]
So it seems like it is run in Flow mode in this way. So why is it working in SetUp, but not in SuiteSetUp?
Minimum example hierarchy with the content given above (that is without any content in [...]).
FitNesseRoot
+->DbFitTest
\->SuiteSetUp
回答1:
A SetUp page is included in each page so the content is executed as part of each test. A SuiteSetUp page is executed once as a separate test before any of the other tests. So the DatabaseEnvironment table will be the second table in your test with SetUp and the first table with SuiteSetUp.
来源:https://stackoverflow.com/questions/21781394/why-cannot-dbfit-be-imported-in-suitesetup