Skip to content

Commit

Permalink
Display failing scenario URIs in summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jbpros committed Jun 19, 2012
1 parent 35c4d25 commit bb046a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/cucumber/listener/summary_logger.js
Expand Up @@ -62,8 +62,9 @@ var SummaryLogger = function () {

self.storeFailedScenario = function storeFailedScenario(failedScenario) {
var name = failedScenario.getName();
var uri = failedScenario.getUri();
var line = failedScenario.getLine();
self.appendStringToFailedScenarioLogBuffer(":" + line + " # Scenario: " + name);
self.appendStringToFailedScenarioLogBuffer(uri + ":" + line + " # Scenario: " + name);
};

self.storeUndefinedStep = function storeUndefinedStep(step) {
Expand Down
12 changes: 9 additions & 3 deletions spec/cucumber/listener/summary_logger_spec.js
Expand Up @@ -307,13 +307,14 @@ describe("Cucumber.Listener.SummaryLogger", function () {
});

describe("storeFailedScenario()", function () {
var failedScenario, name, line;
var failedScenario, name, uri, line;

beforeEach(function () {
name = "some failed scenario";
uri = "/path/to/some.feature";
line = "123";
string = ":" + line + " # Scenario: " + name;
failedScenario = createSpyWithStubs("failedScenario", {getName: name, getLine: line});
string = uri + ":" + line + " # Scenario: " + name;
failedScenario = createSpyWithStubs("failedScenario", {getName: name, getUri: uri, getLine: line});
spyOn(summaryLogger, 'appendStringToFailedScenarioLogBuffer');
});

Expand All @@ -322,6 +323,11 @@ describe("Cucumber.Listener.SummaryLogger", function () {
expect(failedScenario.getName).toHaveBeenCalled();
});

it("gets the URI of the scenario", function () {
summaryLogger.storeFailedScenario(failedScenario);
expect(failedScenario.getUri).toHaveBeenCalled();
});

it("gets the line of the scenario", function () {
summaryLogger.storeFailedScenario(failedScenario);
expect(failedScenario.getLine).toHaveBeenCalled();
Expand Down

0 comments on commit bb046a5

Please sign in to comment.