Questions Answers


Questions & Answers

Q1:

How do we know what extended camel casing translates to?

A1:

The simplest approach is to define the class for the relevant fixture and run the Fit test. The error message in the Fit report will tell you what program identifier is used.

Listing 28.8. Discounts.java
 public class Discounts extends DoFixture {    private DiscountApplication app = new DiscountApplication();    public Fixture setUps() {       return new SetUpDiscounts(app);    }    public Fixture orderedList() {       return new ArrayFixture(app.getGroups());    }    public Fixture subset() {       return new SubsetFixture(app.getGroups());    }    public Fixture calculateWithFutureValue(String futureValue) {       return new CalculateDiscounts2(app,futureValue);    } 

Listing 28.9. SetUpDiscounts.java
 public class SetUpDiscounts extends SetUpFixture {    private DiscountApplication app;    public SetUpDiscounts(DiscountApplication app) {       this.app = app;    }    public void futureValueMaxBalanceMinPurchaseDiscountPercent(          String futureValue, double maxBalance, double minPurchase,          double discountPercent) {       app.addDiscountGroup(futureValue,maxBalance,                minPurchase,discountPercent);    } } 

Q2:

Isn't it annoying to have to work out the name of the method involved and type it in when it can be so long?

A2:

There's no need. Simply define the fixture class and run Fit on the table. The report tells you the full name of the expected method.

Q3:

Why does the method name depend on all the given columns as well?

A3:

If it didn't, someone could easily make a mistake with the given columns, such as in the order, that might go unnoticed.

Q4:

Is there any point in using a SetUpFixture table if the corresponding DoFixture actions take no more space?

A4:

Maybe not, except that the form of the table makes it clear that it is setting up the data and/or state for the business rule that's being tested.

Note

As we saw in Chapter 21, camel casing removes the spaces from a label name and makes each word after the first start with an uppercase letter. Extended camel casing takes this further, to handle any characters in the label or keywords of any FitLibrary fixture tables. This means that the test writer can use whatever names make sense, without having to consider Java syntax.

Extended camel casing defines how an arbitrary header name is converted into a valid Java identifier. Any character that is not permitted in a Java identifier, such as "%" or Unicode, is translated into a valid sequence of ASCII characters. Camel casing is applied to the result. Finally, if the resulting identifier is a Java keyword, it is modified to not be. (For other programming languages, Fit applies appropriate translation rules for each language.)




    Fit for Developing Software. Framework for Integrated Tests
    Fit for Developing Software: Framework for Integrated Tests
    ISBN: 0321269349
    EAN: 2147483647
    Year: 2005
    Pages: 331

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net