diff --git a/README.md b/README.md index f29c010..eae3570 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Build Status](https://travis-ci.org/gdziadkiewicz/TestRunner.jl.svg?branch=master)](https://travis-ci.org/gdziadkiewicz/TestRunner.jl) [![Build status](https://ci.appveyor.com/api/projects/status/l5h55yi87aag0dh3?svg=true)](https://ci.appveyor.com/project/gdziadkiewicz/testrunner-jl) -`TestRunner.jl` is a [Julia](http://julialang.org) test runner library used by standalone [Tk](https://github.com/JuliaLang/Tk.jl) based [GUITestRunner](https://github.com/meoke/GUITestRunner.jl) and [atom-julia-test-runner](https://github.com/mateuszkaleta/atom-julia-test-runner) extension for [Atom](https://github.com/atom/atom). It can parse [FactCheck](https://github.com/JuliaLang/FactCheck.jl) tests to information rich, tree structure. In the nearest future it will be able to run provided test file and parse it's output. +`TestRunner.jl` is a [Julia](http://julialang.org) test runner library used by standalone [Tk](https://github.com/JuliaLang/Tk.jl) based [GUITestRunner](https://github.com/meoke/GUITestRunner.jl) and [atom-julia-test-runner](https://github.com/mateuszkaleta/atom-julia-test-runner) extension for [Atom](https://github.com/atom/atom). It can parse [FactCheck](https://github.com/JuliaLang/FactCheck.jl) tests and run them returning results as an information rich, tree structure. MIT Licensed - see LICENSE.md @@ -17,5 +17,13 @@ Test file structure parsing: using TestRunner testFilePath = "tests.jl" -result = get_test_structure(testFilePath) +structure = get_test_structure(testFilePath) +``` + +Running tests from file: +```julia +using TestRunner + +testFilePath = "tests.jl" +results = run_all_tests(testFilePath) ``` diff --git a/src/TestRunner.jl b/src/TestRunner.jl index f5d9fba..a18fd2e 100644 --- a/src/TestRunner.jl +++ b/src/TestRunner.jl @@ -1,6 +1,6 @@ module TestRunner -export TestStructureNode, FactsCollectionNode, ContextNode, FactNode, get_tests_structure, children, run_all_tests, get_tests_structure_as_json, get_tests_results_as_json +export get_tests_structure, run_all_tests, get_tests_structure_as_json, get_tests_results_as_json, children, line, name, result, details using FactCheck @@ -108,7 +108,12 @@ function run_all_tests(testFilePath::AbstractString) _get_tests_structure(content, results) end -children(node::TestStructureNode) = isa(node, FactNode) ? Vector{TestStructureNode}() : node.children +children(node::FactNode) = Vector{TestStructureNode}() +children(node::TestStructureNode) = node.children +line(node::TestStructureNode) = node.line +name(node::TestStructureNode) = node.name +result(node::FactNode) = node.result +details(node::FactNode) = node.details include("TestRunnerJSON.jl") diff --git a/test/runtests.jl b/test/runtests.jl index 396ec5a..19f0861 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -21,7 +21,10 @@ sampleTests = quote end end +using TestRunner: TestStructureNode, FactsCollectionNode, FactNode, ContextNode + include("testComparisons.jl") + sampleTestsFilePath = "FileWithSampleTests.jl" sampleExceptionFailingTestFilePath = "FileWithExceptionFailingTest.jl"