Skip to content

Aliases

jochenwierum edited this page Jul 9, 2012 · 1 revision

Aliases

The new FileRunners of FitGoodies are "alias-enabled". Sometimes, Fixtures are hidden deep in namespaces. Imagine you have org.example.myapp.tests.fitfixtures.FinanceFixture. This is hard to read, especially if the author of the document doesn't know what that means. FinanceFixture would be better - or how about Test Finances?

Before FitGoodies loads a Fixture, it uses a lookup table to map Fixture names to custom classes. If the name is not found, it is interpreted as fully qualified class name. So org.example.myapp.tests.fitfixtures.FinanceFixture still works. To add an alias, insert the following table into your setup.html (see SetUpTearDownFiles):

fitgoodies.alias.SetupFixture
Test Finances org.example.myapp.tests.fitfixtures.FinanceFixture
OtherFixture org.example.myapp.tests.fitfixtures.OtherFixture

You can now use your Fixture with the old and the new name

Test Finances
... ... ...
... ... ...
... ... ...

By default, there are some aliases preregistered. Every fixture de.cologneintelligence.fitgoodies.X is also available as fitgoodies.X (This is why addressing fitgoodies.alias.SetupFixture in the upper example works).

Clone this wiki locally