Skip to content

Commit

Permalink
Merge pull request #8 from gdziadkiewicz/Helper_functions
Browse files Browse the repository at this point in the history
Added helper functions and changed readme
  • Loading branch information
gdziadkiewicz committed Dec 22, 2015
2 parents 2b330c9 + 0db5547 commit c0b86d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
```
9 changes: 7 additions & 2 deletions src/TestRunner.jl
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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")

Expand Down
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ sampleTests = quote
end
end

using TestRunner: TestStructureNode, FactsCollectionNode, FactNode, ContextNode

include("testComparisons.jl")

sampleTestsFilePath = "FileWithSampleTests.jl"
sampleExceptionFailingTestFilePath = "FileWithExceptionFailingTest.jl"

Expand Down

0 comments on commit c0b86d7

Please sign in to comment.