8. Best Practices

8.1 Unit Testing

Testing Operations, pipe-assemblies, and applications is a must. The cascading.CascadingTestCase provides a number of helper methods.

When testing custom Operations, use the invokeFunction(), invokeFilter(), invokeAggregator(), and invokeBuffer() methods.

When testing Flows, use the validateLength() methods. There are quite a few, each offering extra flexibility. All of them will read the sink Tap and validate it is the correct length, have the correct Tuple size, and if the values match a given regular expression pattern.

The cascading.ClusterTestCase can be used if you want to launch an embedded Hadoop cluster inside your TestCase.

Make sure cascading-test-x.y.z.jar is in your testing class-path in order to use these helper classes.

Copyright © 2007-2008 Concurrent, Inc. All Rights Reserved.