3. What is unit testing?
A unit test is an automated piece of code
that invokes a unit of work in the system and
then checks a single assumption about the
behavior of that unit of work.
4. What is unit testing?
A unit of work is a single logical functional
use case in the system that can be invoked by
some public interface (in most cases).
A unit of work can span a single method, a
whole class or multiple classes working together
to achieve one single logical purpose that can be
verified.
8. Why we need unit testing?
Highly stable solution
Integration of different components will be easier
New and regression defects can be minimized
Good unit testing reduces the test cycle for each
phrase
Good unit testing can be a good reference for the
system documentation
10. Test-Driven Development
Write test cases for a specific part of your code
Write your code to ‘fill in’ the tests. Your code only
serves to make all of your tests pass, and nothing
more
Once all your tests pass, go back and clean your
code (Refactoring)
TDD gives developers the power to think clearly about
the specifications before they engage themselves with
implementations.
11. Test-Driven Development
Writing a failing test case
Run the test,
Fail?
Write application code
Run the tests,
Success?
Refactor
?
Refactor the code
Yes
Yes
Yes
No
No
No
12. Behavior-Driven Development
Write application code first.
Test cases must be small and tests one thing. Test a small
unit of code instead of the entire application
Run test cases against class or method specific for that
test case
If test fails, fix the defects and test again
With BDD, you can write specifications that are small and easy
to read.
13. Behavior-Driven Development
Write class(es) or method(s)
Write unit tests
Run the tests,
Fail?
Refactor
?
Refactor the code
No
Yes
No
Yes
Fix the defects
15. What is Jasmine?
Jasmine is a behavior-driven testing
framework for JavaScript programming language.
It does not depend on any other JavaScript
frameworks. It does not require a DOM.