Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize test suite to use Spectrum to test Spectrum #20

Open
greghaskins opened this issue Feb 1, 2016 · 0 comments
Open

Organize test suite to use Spectrum to test Spectrum #20

greghaskins opened this issue Feb 1, 2016 · 0 comments

Comments

@greghaskins
Copy link
Owner

Spectrum was originally bootstrapped by test-driving with traditional JUnit tests. Most of those tests live on in packages like given.a.spec.with.nested.describe.blocks. Later on, Spectrum became feature-rich enough to be able to test itself (dogfood), for example FixturesSpec and of course ExampleSpec).

This mix of testing styles makes it hard to figure out what is tested where and how. It should be possible to convert all the old vanilla JUnit tests over to Spectrum, but if not, that exercise may reveal important functionality gaps.

I've been trying to follow these rough guidelines:

  1. Prefer testing "happy path" Spectrum behavior with direct examples (similar to the Jasmine docs). Just call the functions in the appropriate context and assert that they behave correctly.
  2. Avoid having "expected" failures or ignored specs in Spectrum's test suite. Test those "sad path" behaviors through indirection with SpectrumRunner instead. For an example, see RunnerSpec
  3. Try to organize suite files around functional boundaries (e.g. a suite about focused specs in one file, another about ignored specs, etc.)
  4. When adding features, always include an example in ExampleSpec and update the README. Test all the edge cases in the suite itself, but it's good to have an overview that is big and visible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant