Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Why ?

The system under development is a bridge between your Fixtures and the system your testing.
If you want to change the way GreenPepper is finding/instanciating your fixtures, or if you need to hook the document execution then you can define a Custom System Under Development.

...

The converters are always check in an LIFO manners. If two converters can process a data type the last one that has been register will be used. That way, you can provides your own converters in place of the standard GreenPepper converters. 

Self conversion

...

Instead of registering a TypeConverter, you can uses self converting types.

 

Self converting type implies that you add a static parse method to your class.

 

Code Block
titleJava
public static T parse(String val);
// And then to revert back to a string,
public static String toString(T value)

 

 

Code Block
titleC#
public static T ValueOf(string text)
// And then to revert back to a string,
public static String ToString(T value)

...

Your class does not have to provides both of them. 

Rules of conversion

...

conversion 

From example to fixture

...

1 First GreenPepper will verify if the type is can self convert (ie public static T parse(String) or public static T ValueOf(string))
2 If not, look for a registered TypeConverter that can handles the type.
3 An UnsupportedOperationException will be thrown

 

From fixture return value to String

...

1 First GreenPepper will verify if the type is can self revert (ie public static String toString(T) or public static T ToString(string))
2 If not, look for a registered TypeConverter that can handles the type.
3 Use the toString() or ToString() method on the data itself.

...

This could be useful when you are using for example an IOC, like Spring (see Spring Example) or just when you want to add locations (packages in java, namespaces in .Net) for GreenPepper can resolve your fixtures.

To change the system under development :

Only for specifying location to resolve fixtures (packages in java, namespaces in .Net)

 

Code Block
langjava
titleAuto import SUD
collapsetrue
public static class CustomSystemUnderDevelopment extends DefaultSystemUnderDevelopment  {
        public CustomSystemUnderDevelopment( String... params )
        {
           super.addImport("com.mycompany.fixtures");
           super.addImport("com.mycompany.specials.fixtures");
        }
}

By this custom system under development you tell  GreenPepper to look in "com.mycompany.fixtures" and "com.mycompany.specials.fixtures" to resolve fixtures in specfications that your are running.

...