Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Move aside acceptance style rspec suite, and replace it with a stub unit test framework #410

Closed
daniel-pittman opened this Issue · 0 comments

1 participant

@daniel-pittman

The current tests under spec require a fully functional Razor instance - daemons running, nodejs engaged, datastore empowered, and so forth.

This isn't really "unit" testing, in the traditional sense, and that confusion makes it hard to see how to build real unit tests for the code we build.

None of that makes the tests bad, of course - acceptance testing is hugely valuable, sometimes more so than unit testing is, because it has the broader view of the overall system.

We should move the current testing aside, to a location that reflects the real role it serves in the test process, and build a new unit test suite for the code.

Since that is a huge undertaking even on a codebase of 8,600 lines, this will initially cover a relatively limited portion of the ground. By providing a clean, clear framework for how to build unit tests, though, it will make it easier for contributors to add testing to their future contributions.

@daniel-pittman daniel-pittman referenced this issue from a commit in daniel-pittman/Razor
@daniel-pittman daniel-pittman (#410) Move acceptance style spec tests into the acceptance directory
The previous "spec" test suite was really an acceptance / integration level
test: you had to have a fully functional end to end Razor stack to run
the test - including the nodejs web components, a data store, etc.

This is really valuable, and has brought a lot of value to development, but it
also makes it very hard to add actual unit style tests to validate small parts
of the functionality of the Razor codebase.

This moves aside the acceptance spec files, so that we no longer have them
sitting where Ruby convention dictates a unit style test suite would live.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
f74ddf8
@daniel-pittman daniel-pittman referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@daniel-pittman daniel-pittman referenced this issue from a commit in daniel-pittman/Razor
@daniel-pittman daniel-pittman (#410) Build the stub rspec unit test suite
This adds the bones of an rspec test suite.  While *cough* extremely
limited *cough* at the moment, having the framework in place makes it easier
to start adding flesh to these empty bones.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
4d1e752
@daniel-pittman daniel-pittman referenced this issue from a commit in daniel-pittman/Razor
@daniel-pittman daniel-pittman (#410) Create template spec stubs for all conventional classes
This creates a stub template spec with a minimal test - can the code load, and
does it define the constant we expect - for everything that complies with Ruby
convention for how code is loaded.

These are not deep tests, but they should ensure that we, at the least, manage
to load most of the code in the project when we run the spec tests.  That will
catch the worst of errors, that we fail to require the right things, or that
we have a syntax error.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
8c33514
@daniel-pittman daniel-pittman referenced this issue from a commit
@daniel-pittman daniel-pittman (#410) Move the acceptance spec tests to the correct location
Embarrassingly, my previous pull request for #410 was incorrect.  I had
committed and tested it, and found that it didn't work correctly since the
acceptance suite runs `acceptance/**/*.rb` unconditionally.

I then fixed that up by moving things around, staged those changes, tested,
and submitted my pull request.  Yes - without actually *committing* the fixed
version, but with testing the checked out (and functional) version.

Lesson learned: I should update my pull request making tooling to check for a
dirty repository, or staged but uncommitted changes, and abort the pull
request.  If it isn't clean, it isn't ready to be a pull request.

This fixes that by pushing the fixed and functional version into place.

Signed-off-by: Daniel Pittman <daniel@rimspace.net>
6e156bf
@daniel-pittman daniel-pittman referenced this issue from a commit
@daniel-pittman daniel-pittman Fix for failed merge of #410 - add the missing commit
The pull request for #410 was missing a commit that actually made it work,
which is very embarrassing.  This corrects that by adding it in.
390ffe3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.