Mercurial > public > mercurial-scm > hg-stable
diff tests/test-run-tests.t @ 22391:c42e69268f5b
run-tests: added '--json' functionality to store test result in json file
This patch added a new functionality '--json'. While testing, if '--json'
is enabled then test result data gets stored in newly created "report.json"
file in the following format.
testreport ={
"test-success.t": {
"result": "success",
"time": "2.041"
}
"test-failure.t": {
"result": "failure",
"time": "4.430"
}
"test-skip.t": {
"result": "skip"
"time": "3.754"
}
}
Otherwise, if '--json' is enabled but json module was not installed then it
will raise an error "json module not installed".
This "report.json" file will further accessed by html/javascript file for
graph usage.
author | anuraggoel <anurag.dsps@gmail.com> |
---|---|
date | Mon, 08 Sep 2014 16:41:00 +0200 |
parents | eb6adf750954 |
children | f166e08ece3b |
line wrap: on
line diff
--- a/tests/test-run-tests.t Tue Sep 02 12:11:36 2014 +0200 +++ b/tests/test-run-tests.t Mon Sep 08 16:41:00 2014 +0200 @@ -369,3 +369,40 @@ Skipped test-failure.t: blacklisted # Ran 0 tests, 2 skipped, 0 warned, 0 failed. +test for --json +================== + + $ $TESTDIR/run-tests.py --with-hg=`which hg` --json + + --- $TESTTMP/test-failure.t + +++ $TESTTMP/test-failure.t.err + @@ -1,4 +1,4 @@ + $ echo babar + - rataxes + + babar + This is a noop statement so that + this test is still more bytes than success. + + ERROR: test-failure.t output changed + !.s + Skipped test-skip.t: skipped + Failed test-failure.t: output changed + # Ran 2 tests, 1 skipped, 0 warned, 1 failed. + python hash seed: * (glob) + [1] + + $ cat report.json + testreport ={ + "test-failure.t": [\{] (re) + "result": "failure", + "time": "\s*[\d\.]{5}" (re) + }, + "test-skip.t": { + "result": "skip", + "time": "\s*[\d\.]{5}" (re) + }, + "test-success.t": [\{] (re) + "result": "success", + "time": "\s*[\d\.]{5}" (re) + } + } (no-eol)