Browse Source

More testing content

Peter J. Jones 10 years ago
2 changed files with 40 additions and 3 deletions
  1. 2
  2. 38

+ 2
- 0
README View File

@@ -30,6 +30,8 @@
*** Chapter Recipes
- Replacing a method without mocking because of side effects
(setting a variable)
- Testing without an internet connection using mocking and local
** Content Ideas
*** Blocks
**** Knowing if a block takes arguments

+ 38
- 3
chapters/testing.tex View File

@@ -97,13 +97,48 @@ can justify the financial expenditure.
% ============================================================================
\section{Approaches to Testing}

Testing is a pretty huge umbrella that covers a wide range of topics
including when in the development life cycle you should write tests,
how coupled the tests should be to the software, and how much code to
evaluate with each test.

While not specific to Ruby, you should at least have a general
understanding of these topics so you can write clearer tests.


\todo{TDD, BDD}
As automated testing became more and more popular over the last
several years people started to think of it in different ways.

In a more traditional company with a QA department you usually find
software developers writing code and then throwing it over the cube
wall to testers. The testers find bugs, tell the developers, and the
process starts over again.

While having a testing team can certainly be valuable, many companies
have shifted to a model where the developers do the testing (or at
least do a significant amount of testing before it goes to QA).

This has lead to testing patterns and methodologies such as Test
Driven Development (TDD)\index{testing!test driven development} which
places emphasis on writing tests before writing code.

This is useful for a number of reasons, including:

\item Helps you think about what an interface should look like before
you actually write that interface (e.g. method, class, etc.)
\item Ensures that you start with a failing test so you know that the
test does work
\item Rewards you with a passing test once the implementation is

\todo{BDD mention}


\todo{Black-box, white-box, happy path, etc.}
\todo{Black-box, white-box, happy path, sad path, fuzzing etc.}


@@ -121,7 +156,7 @@ can justify the financial expenditure.

\subsection{Other Testing Frameworks}

\subsection{Mocking with Mocha}