Testing Glossary

assertion
Boolean (yes/no) function that causes the test it's executed within to fail if it is not true.
BDD
Behaviour driven development - a style of testing that emphasises that you should be testing behaviour not implementation. Often uses testing syntax that approximates natural language.
behaviour
What your code should do. For instance, a
sqrt
function should give you
sqrt(4) == 2
and
sqrt(2) == NaN
. This is contrasted with how it does it - this is implementation. See implementation for a worked example.
declarative
Not a testing term, but a programming pattern that ensures you write code to do routine jobs, eliminating the need to write certain tests. For instance - HTML lets you 'declare' you'd like a red box with a 1px border and 3px drop shadow. In Canvas, you'd have to draw the 4 edges etc. You'd not need to test the HTML render, but you would the canvas. Similarly, you can setup a event listener by hand, or use Backbone's declarative event binding hash.
example
An example of behaviour something should exhibit. Also called: test.
functional test
Tests that run on functionality users could recognise, as close to the production environment as possible. Contrast with unit test
helper
In testing, normally handles a bit of repetitive test setup.
implementation
How your code does something. For instance, you could remove an element with
$(el).remove()
or
el.parentNode.innerHTML = ''
or
el.parentNode.removeChild(el)
If you write a test that tests for removal by ensuring any one of these methods was called, it'll break if you later change to another method, even if the behaviour - the removal - is actually still occurring. Test for the removal - you only care that it's done, not how.
integration test
Tests to ensure multiple components work - integrate - with each other. Often a synonym for functional test.
mock
An implementation of a method that also acts as an assertion about how that method is called during the test. For example, it could be set to fail if it is called too often or seldom, or with the wrong arguments.
none-one-many
You can have none, one or many things, both in the sense of being passed a null, object or collection. Make sure code can handle all three, or at least mentally ensure you've know why it won't see one or more of them.
spec
Short for 'specification'. Also called: test.
stub
Replacement for real implementation of a method. An example would be: model.slowMethod = function() { return 'result that otherwise would take ages to generate' };
TDD
Test-Driven-Development - writing code only when you have a failing test. Writing tests first makes you 'drive-out' your development by making each test pass.
test
Code containing one or more assertion that ensures the code under test has the behaviour described it in the test's name.
test case
A test
test suite
One or more tests, run together.
unit test
A test of an isolated function or small piece of behaviour. Likely involves using stubs to avoid relying on complex, slow or not-yet-implemented code.

Enjoy this? Subscribe to my RSS feed or follow me on Twitter.