Created
February 18, 2015 15:24
-
-
Save bendisposto/fdfe43f590b483de0814 to your computer and use it in GitHub Desktop.
vl_5_2_2015 Teil1: Example based testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns ebt.core | |
| (:require [clojure.test :as t :refer [deftest is run-all-tests]] | |
| [midje.sweet :as m :refer [tabular fact]] | |
| [speclj.core :as s :refer [describe it should= run-specs]])) | |
| (defn plus | |
| "I am a bogus addition function" | |
| [a b] | |
| (if (= a b) (+ a b) (+ a a))) | |
| ;; clojure.test | |
| (deftest addition | |
| (is (= 4 (plus 2 2))) | |
| (is (= 7 (plus 3 4)))) | |
| (run-all-tests) | |
| ;; midje | |
| (deftest addition-midje | |
| (tabular "about plus" | |
| (fact (plus ?a ?b) => ?c) | |
| ?a | ?b | ?c | |
| 2 | 2 | 4 | |
| 4 | 5 | 9)) | |
| (run-all-tests) | |
| ;; Speclj | |
| (describe "addition -speclj" | |
| (it "2 + 2 = 4" (should= 4 (plus 2 2))) | |
| (it "1 + 2 = 3" (should= 3 (plus 1 2)))) | |
| (run-specs) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defproject ebt "0.1.0-SNAPSHOT" | |
| :description "FIXME: write description" | |
| :url "http://example.com/FIXME" | |
| :license {:name "Eclipse Public License" | |
| :url "http://www.eclipse.org/legal/epl-v10.html"} | |
| :dependencies [[org.clojure/clojure "1.6.0"] | |
| [speclj "2.9.0"] | |
| [midje "1.6.3"] | |
| [expectations "2.0.9"] | |
| [pjstadig/humane-test-output "0.6.0"]] | |
| :injections [(require 'pjstadig.humane-test-output) | |
| (pjstadig.humane-test-output/activate!)] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment