| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.Framework.JsonOutput
Contents
Description
HTF's machine-readable output is a sequence of JSON messages. Each message is terminated by a newline followed by two semicolons followed again by a newline.
There are four types of JSON messages. Each JSON object has a "type" attribute denoting
this type. The types are: test-start, test-end, and test-list, test-results.
Their haskell representations are TestStartEventObj, TestEndEventObj, TestListObj, and
TestResultsObj. The corresponding JSON rendering is defined in this module.
- The
test-startmessage denotes the start of a single test case. Example (whitespace inserted for better readability):
{"test": {"flatName": "Main:nonEmpty",
"location": {"file": "Tutorial.hs", "line": 17},
"path": ["Main","nonEmpty"],
"sort": "unit-test"},
"type":"test-start"}- The
test-endmessage denotes the end of a single test case. It contains information about the outcome of the test. Example:
{"result": "pass",
"message":"",
"test":{"flatName": "Main:nonEmpty",
"location": {"file": "Tutorial.hs", "line": 17},
"path": ["Main","nonEmpty"],
"sort": "unit-test"},
"wallTime": 0, // in milliseconds
"type": "test-end",
"location":null}- The
test-resultsmessage occurs after all tests have been run and summarizes their results. Example:
{"failures": 0,
"passed": 4,
"pending": 0,
"wallTime": 39, // in milliseconds
"errors": 0,
"type":"test-results"}- The
test-listmessage contains all tests defined. It is used for the --list commandline options. Example:
{"tests": [{"flatName":"Main:nonEmpty","location":{"file":"Tutorial.hs","line":17},"path":["Main","nonEmpty"],"sort":"unit-test"},
{"flatName":"Main:empty","location":{"file":"Tutorial.hs","line":19},"path":["Main","empty"],"sort":"unit-test"},
{"flatName":"Main:reverse","location":{"file":"Tutorial.hs","line":22},"path":["Main","reverse"],"sort":"quickcheck-property"},
{"flatName":"Main:reverseReplay","location":{"file":"Tutorial.hs","line":24},"path":["Main","reverseReplay"],"sort":"quickcheck-property"}],
"type":"test-list"}For an exact specification, please have a look at the code of this module.
Documentation
data TestStartEventObj Source #
Instances
| HTFJsonObj TestStartEventObj Source # | |
Defined in Test.Framework.JsonOutput | |
| ToJSON TestStartEventObj Source # | |
Defined in Test.Framework.JsonOutput Methods toJSON :: TestStartEventObj -> Value # toEncoding :: TestStartEventObj -> Encoding # toJSONList :: [TestStartEventObj] -> Value # toEncodingList :: [TestStartEventObj] -> Encoding # omitField :: TestStartEventObj -> Bool # | |
data TestEndEventObj Source #
Instances
| HTFJsonObj TestEndEventObj Source # | |
Defined in Test.Framework.JsonOutput | |
| ToJSON TestEndEventObj Source # | |
Defined in Test.Framework.JsonOutput Methods toJSON :: TestEndEventObj -> Value # toEncoding :: TestEndEventObj -> Encoding # toJSONList :: [TestEndEventObj] -> Value # toEncodingList :: [TestEndEventObj] -> Encoding # omitField :: TestEndEventObj -> Bool # | |
data TestListObj Source #
Instances
| HTFJsonObj TestListObj Source # | |
Defined in Test.Framework.JsonOutput | |
| ToJSON TestListObj Source # | |
Defined in Test.Framework.JsonOutput Methods toJSON :: TestListObj -> Value # toEncoding :: TestListObj -> Encoding # toJSONList :: [TestListObj] -> Value # toEncodingList :: [TestListObj] -> Encoding # omitField :: TestListObj -> Bool # | |
data TestResultsObj Source #
Instances
| HTFJsonObj TestResultsObj Source # | |
Defined in Test.Framework.JsonOutput | |
| ToJSON TestResultsObj Source # | |
Defined in Test.Framework.JsonOutput Methods toJSON :: TestResultsObj -> Value # toEncoding :: TestResultsObj -> Encoding # toJSONList :: [TestResultsObj] -> Value # toEncodingList :: [TestResultsObj] -> Encoding # omitField :: TestResultsObj -> Bool # | |
mkTestListObj :: [(FlatTest, String)] -> TestListObj Source #
decodeObj :: HTFJsonObj a => a -> ByteString Source #
class ToJSON a => HTFJsonObj a Source #
Instances
| HTFJsonObj TestEndEventObj Source # | |
Defined in Test.Framework.JsonOutput | |
| HTFJsonObj TestListObj Source # | |
Defined in Test.Framework.JsonOutput | |
| HTFJsonObj TestResultsObj Source # | |
Defined in Test.Framework.JsonOutput | |
| HTFJsonObj TestStartEventObj Source # | |
Defined in Test.Framework.JsonOutput | |