user6690217 user6690217 - 1 year ago 265
JSON Question

Generating JSON object of the tests ran using Protractor?

I'm relatively new to end to end testing with

(for integration with
so I can use
and step definitions).

I've seen a plugin called
which generates an HTML report which can be viewed offline, along with this JSON object of the test results, all of which contained in a 'reports' folder.

I presume it's
which generates these JSON objects as the HTML page seems to have corresponding tags etc. Is there any way to generate a JSON object of the tests ran without the HTML reporter? The idea was to create my own sort of 'dashboard' containing information about the tests based on the JSON information.

Answer Source

Yes you can create a JSON report of your specs/tests with protractor.You just have to put resultJsonOutputFile: './Report.json' in your config file.

your config file should somewhat look like this:

exports.config = {

directConnect: true, 
capabilities: {
    'browserName': 'chrome'
baseUrl: '', 
framework: 'jasmine2', 
specs: ['*spec.js '], 
allScriptsTimeout: 180000, 
getPageTimeout: 180000, 
jasmineNodeOpts: {
    defaultTimeoutInterval: 180000
 resultJsonOutputFile: './Report.json', // It would create report.json file in your current folder
 onPrepare: function () {

    browser.ignoreSynchronization = true;

You can consume this json report and use it in your way!