Permit controller or view tests under specific criteria #1132

Open
CloCkWeRX opened this Issue Dec 20, 2016 · 3 comments

Projects

None yet

4 participants

@CloCkWeRX
Contributor
CloCkWeRX commented Dec 20, 2016 edited

#1127

I'd be +1 permitting controller tests for:

  • API/structured responses (xml, json, etc)
  • Security testing (ok vs 403 responses)

View tests at the page level would still be better as features (When I view a page, I see an X, click a Y)

View tests at the javascript component level or helper/widget level (Graph widget X, given this data, does Y, Z)

Outcome of this would be to add it to the coding style wiki and amend the various deprecation notices

Good talk on it via https://www.youtube.com/watch?v=MkPHntWZAPc - specifically using features for 'end to end' style tests on the absolute critical path, vs the risk of flakey behaviour (which has caused us much fun with PRs).

This concept ("The test pyramid") is useful for assessing what is better tested where
image

If we end up with lots of tests, the above talk introduces a companion concept, the "PUMA" test:
http://www.bbc.co.uk/blogs/internet/entries/ba0c030e-d031-4ab6-8ba6-3afe41807b55
image

The less a test meets that criteria, the more worth pushing it down the testing pyramid

@maco
Member
maco commented Dec 20, 2016
@pozorvlak
Member
@Br3nda
Contributor
Br3nda commented Dec 21, 2016 edited

I started writing controller specs for gardens last night.

I tested for users editing other people's gardens, deleting other people's gardens etc.

I came to the conclusion, we need to have the successful normal edits in the controller spec too. I need to verify we are calling the controller correctly and able to get a success, before then changing owner_ids and expecting to be blocked. Otherwise we may get a pass on "when user tries to edit another member's planting they are refused" only because we called the controller wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment