4. Unit TestOverovanie vstupov a výstupov pre funkciuclassTestSimpleNumber<Test::Unit::TestCasedeftest_simpleassert_equal(4, SimpleNumber.new(2).add(2))assert_equal(6, SimpleNumber.new(2).multiply(3))endend
8. Akona to? (BDD)Popísať požiadavku na funkcionalitu (feature)Definovať kroky, ktoré napĺňajú danú požiadavku(scenario)Implementovať jednotlivé kroky pomocou nizkoúrovňových testov(steps)Implementovať kód, aby sme prešli testamiOpakovať, kým nie sú všetky požiadavky splnené
10. Feature – príkladFeature: Manage articlesIn order toprovide fresh content for visitorsAs an editor of the web pageI want tocreate and edit articles
13. Scenario –príkladScenario: Publishingnew articleGivenI log in as „admin“ using password „dog123“When I follow „New Article“AndI fill in „Title“ with „First Article“And I fill in „Article“ with „My first article about Cucumbers“And I press „Publish article“Then I should see „First Article was published“And I go to „the main page“And I should see „My first article about Cucumbers“