|
FAQ
Frequently Asked Questions
Tutorial IntroductionSo what is it?Instinct is a Behaviour Driven Development (BDD) framework for Java. Inspired by RSpec, Instinct provides flexible annotation of contexts, specifications, actors, etc. (via Java 1.5 annotations, marker interfaces or naming conventions); automatic creation of test doubles (dummies, mocks & stubs) & test subjects; state and behavioural (mocks) expectation API; JUnit test runner integration & Ant tasks. See the overview for more details. What! Another testing frameworkWhile Instinct isn’t intended as a “testing” framework, it can indeed be used as a testing framework in place of JUnit, TestNG, JTiger, etc. Instinct was developed to be used in performing behaviour driven development, which has a slightly different emphasis than testing, focusing more on specifying behaviour and exploring the design of code. We won’t go into the psychology of why names are important, suffice to say that a new framework allows me to explore behaviour driven development (which the projects I’ve been working on have been doing for a while) while also offering additional features not found in current testing frameworks. Also, Instinct was developed to overcome some deficiencies in current frameworks and provide a simplification of key ideas such as mocking. Instinct also aims to standardise on names of common items used in testing (subject, fixture, mock, stub, dummy, etc.), and provide framework level support for these items. Instinct will also offer flexibility in the way things are marked, and hence made available to the framework. TestNG pioneered the use of annotations for marking tests and providing metadata (such as test groups), however there are times when you may not want to use annotations and would prefer say a naming convention (cf. JUnit picks up method names starting with “test”) or a marker interface. Here’s a complete list of why Instinct was created:
But if I wanted BDD, I’d use jBehaveTrue, jBehave is the original BDD framework. However, jBehave's goals and implementation is different to Instinct. jBehave appears to be aiming at a higher level (i.e. not atomic/unit), allowing you to specify acceptance/functional type tests in textual form, and parsing them into executable statements. Also, when Instinct was created jBehave appeared to be an orphaned project, however it has since released a 1.0 version and appears to be thriving. Supported JDKsInstinct is written and targeted at JDK 1.5. It also works under Java 1.6. DependenciesUp to date dependencies can be found in the README. Related ProjectsInstinct is not the only BDD framework, others include:
Why does Instinct use jMock and not EasyMock?Rather than inventing one from scratch, Instinct bundles a mocking library called jMock. jMock was chosen for the following reasons:
However, EasyMock does offer the following advantages;
jMock 2 alleviates even more of EasyMock's advantages by offering type inference using an EDSL style. Why does Instinct not support test failure and error like JUnit?Instinct made an explicit choice to simplify this part of the API and to not distinguish between "failure" and "errror". These two conditions are symptoms of the same cause; a test failure. |