Testing Flashcards
Why is testing early important?
The later that the bug is found… the more expensive it is.
Unit testing
Test a single unit of your program:
- Typically: functions
- Success cases, error cases
- easy to automate
Integration testing
Test several units together
- Several functions working together
- Several modules/classes working together
System testing
Test the entire system
- Use cases
- Test case should cover a reasonable real-life scenario
- Is the correct behaviour visible in the system
- Tricky to automate
Acceptance testing
Test the entire system from a customers viewpoint
- Use cases
- Focus on visible functionality
- What do I get back if i put in X?
- Tricky to automate
What to test?
UI testing User experience testing Functional testing Performance testing Robustness testing
Test Driven Development TDD
Write tests before you write code
Forces you to think about input/output, behaviour and, error cases
Behaviour Driven Development
Write tests before you write code, but in a specific format “Given-When-Then”
HTML what to test?
W3C validator
Check that elements exist
Check that HTML functionality works
Mainly in system testing (with css and JS)
CSS what to test?
W3C validator
Check that elements have the right look (UI testing)
Check that responsive design works (resizing, media queries) (functional testing)
system testing with html and js
JavaScript what to test?
Unit tests
Integration tests
System/acceptance tests in combination with HTML and CSS
Mocha
Unit testing framework for JS
Requires some kind of assertion library
Chai
Assertion library that allows the TDD/BDD styles
mocha/chai syntax
describe('name of test suite' function () { it('name of test', function() { chai.expect(bla).to.equal(bla); } })
Mocha cleanup and preperations
Inside describe blocks there can be
before(function() {})