diff --git a/README.md b/README.md index f61f9bd..7d90ab6 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,20 @@ The tests show the 3 basic ways to use this: (stop-fn) (is (true? ret))))) -;; fixture ;; (use-fixtures :once test-suite-fixture) +(deftest with-test-suite-args-test + (with-test-suite-args + {:branch "some-branch"} + (let [stop-fn (run-lrs) + ret (conformant? "-e" "http://localhost:8080/xapi" "-b" "-z")] + (stop-fn) + (is (true? ret))))) + +;; fixture ;; + +(use-fixtures :once test-suite-fixture) +;; or +(use-fixtures :once #(test-suite-fixture % :branch "some-branch")) + (deftest test-suite-fixture-test (test-suite-fixture #(let [stop-fn (run-lrs) @@ -41,6 +54,12 @@ The tests show the 3 basic ways to use this: ``` +### Options + +The following options are available: +* git-uri - an alternate source for the conformance tests, defaults to https://github.com/adlnet/lrs-conformance-test-suite.git +* branch - an alternate branch, defaults to `master` + ## Roadmap This is basically a port of what `lrs` does, and assumes a working node/npm environment. diff --git a/src/main/com/yetanalytics/lrs/test_runner.clj b/src/main/com/yetanalytics/lrs/test_runner.clj index 9525aa5..c00bfd3 100644 --- a/src/main/com/yetanalytics/lrs/test_runner.clj +++ b/src/main/com/yetanalytics/lrs/test_runner.clj @@ -182,13 +182,25 @@ (finally (delete-test-suite! *current-test-suite-dir*))))) +(defmacro with-test-suite-args + "Do things with a test suite and clean it up, taking a map of clone args + as the first argument." + [argm & body] + `(binding [*current-test-suite-dir* + (some-> (clone-test-suite ~@(-> argm seq flatten)) + install-test-suite!)] + (try + ~@body + (finally + (delete-test-suite! *current-test-suite-dir*))))) + ;; or fixture (defn test-suite-fixture "Fixture to ensure clean test environment." - [f] + [f & clone-args] (binding [*current-test-suite-dir* - (some-> (clone-test-suite) + (some-> (apply clone-test-suite clone-args) install-test-suite!)] (try (f)