Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JUnitXmlReporter not reporting all tests in the result #169

Closed
macroking opened this issue Jun 23, 2017 · 3 comments
Closed

JUnitXmlReporter not reporting all tests in the result #169

macroking opened this issue Jun 23, 2017 · 3 comments

Comments

@macroking
Copy link

macroking commented Jun 23, 2017

Spec File:

describe('angularjs homepage', function() {
    it('should greet the named user', function() {
        browser.get('http://www.angularjs.org');
        element(by.model('yourName')).sendKeys('Julie');
        var greeting = element(by.binding('yourName'));
        expect(greeting.getText()).toEqual('Hello Julie!');
    });

    describe('todo list', function() {
        var todoList;

        beforeEach(function() {
            browser.get('http://www.angularjs.org');

            todoList = element.all(by.repeater('todo in todoList.todos'));
        });

        it('should list todos', function() {
            expect(todoList.count()).toEqual(2);
            expect(todoList.get(1).getText()).toEqual('build an AngularJS app');
        });

        it('should add a todo', function() {
            var addTodo = element(by.model('todoList.todoText'));
            var addButton = element(by.css('[value="add"]'));
            addTodo.sendKeys('write a protractor test');
            addButton.click();

            expect(todoList.count()).toEqual(3);
            expect(todoList.get(2).getText()).toEqual('write a protractor test');
            expect(1).toEqual(1);
        });

        it('should fail', function() {
            expect("hi").toEqual("hi");
        });
    });
});

Generated Output

<?xml version="1.0" encoding="UTF-8" ?>
<testsuites>
 <testsuite name="todo list" timestamp="2017-06-23T08:27:06" hostname="localhost" time="4.335" errors="0" tests="3" skipped="0" disabled="0" failures="0">
  <testcase classname="todo list" name="should list todos" time="1.732" />
  <testcase classname="todo list" name="should add a todo" time="1.721" />
  <testcase classname="todo list" name="should fail" time="0.881" />
 </testsuite>
 <testsuite name="angularjs homepage" timestamp="2017-06-23T08:27:11" hostname="localhost" time="0" errors="0" tests="0" skipped="0" disabled="0" failures="0">
 </testsuite>
</testsuites>

Conifg File:

// An example configuration file.
var HtmlScreenshotReporter = require('jasmine-reporters');

exports.config = {

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        'browserName': 'chrome'
    },

    // Framework to use. Jasmine is recommended.
    framework: 'jasmine',

    // Spec patterns are relative to the current working directory when
    // protractor is called.
    specs: ['exampleSpec.js'],

    // Options to be passed to Jasmine.
    jasmineNodeOpts: {
        defaultTimeoutInterval: 30000
    },

    onPrepare: function() {
        browser.getProcessedConfig().then(function(config) {
            var browserName = config.capabilities.browserName;
            reporter = new HtmlScreenshotReporter.JUnitXmlReporter({
                consolidateAll: true,
                savePath: 'target',
                filePrefix: browserName + '-dev',
                modifySuiteName: function(generatedSuiteName, suite) {
                    return generatedSuiteName;
                }
            });
            jasmine.getEnv().addReporter(reporter);
        });
    }
};

Missed to report the test 'should greet the named user' in the report

@paulcosma
Copy link

Can you please provide the config?

@macroking
Copy link
Author

@paulcosma updated the issue with config details.

@macroking
Copy link
Author

I followed the example provided in the documentation and the report generation is working as expected. I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants