Reporter Class
The jUnit reporter can produce a jUnit compatible file with the results of your testrun, this reporter enables you to use daleks testresults within a CI environment like Jenkins.
The reporter can be installed with the following command:
$ npm install dalek-reporter-junit --save-dev
The file will follow the jUnit XML format:
<?xml version="1.0" encoding="utf-8"?>
<resource name="DalekJSTest">
<testsuite start="1375125067" name="Click - DalekJS guinea pig [Phantomjs]" end="1375125067" totalTests="1">
<testcase start="1375125067" name="Can click a select option (OK, jQuery style, no message)" end="1375125067" result="pass">
<variation start="1375125067" name="val" end="1375125067">
<severity>pass</severity>
<description><![CDATA[David is the favourite]]></description>
<resource>DalekJSTest</resource>
</variation>
<variation start="1375125067" name="val" end="1375125067">
<severity>pass</severity>
<description><![CDATA[Matt is now my favourite, bow ties are cool]]></description>
<resource>DalekJSTest</resource>
</variation>
</testcase>
</testsuite>
</resource>
By default the file will be written to report/dalek.xml
,
you can change this by adding a config option to the your Dalekfile
"junit-reporter": {
"dest": "your/folder/your_file.xml"
}
If you would like to use the reporter (in addition to the std. console reporter), you can start dalek with a special command line argument
$ dalek your_test.js -r console,junit
or you can add it to your Dalekfile
"reporter": ["console", "junit"]
Constructor
Reporter
()
Item Index
Methods
_checkNodeAttributes
-
testIdx
-
testCount
-
variationCount
Helper method to check if attributes should be set to an empty object literal
Parameters:
-
testIdx
StringId of the test node
-
testCount
StringId of the child node
-
variationCount
StringId of the testCount child node
_recursiveMakeDirSync
-
path
Helper method to generate deeper nested directory structures
Parameters:
-
path
StringPAth to create
assertion
-
data
Generates XML skeleton for an assertion
Parameters:
-
data
ObjectEvent data
runBrowser
-
browser
Stores the current browser name
Parameters:
-
browser
StringBrowser name
runnerFinished
-
data
Finishes XML and writes file to the file system
Parameters:
-
data
ObjectEvent data
startListening
()
chainable
Connects to all the event listeners
testFinished
-
data
Finishes XML skeleton for a testcase
Parameters:
-
data
ObjectEvent data
testStarted
-
data
Generates XML skeleton for a testcase
Parameters:
-
data
ObjectEvent data
testsuiteFinished
()
chainable
Finishes XML skeleton for testsuites
testsuiteStarted
-
name
Generates XML skeleton for testsuites
Parameters:
-
name
StringTestsuite name