Skip to content

Rename and add test for HTMLFormatter #1218

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

Merged
merged 1 commit into from
Sep 9, 2017
Merged

Rename and add test for HTMLFormatter #1218

merged 1 commit into from
Sep 9, 2017

Conversation

mlvandijk
Copy link
Member

@mlvandijk mlvandijk commented Sep 6, 2017

Summary

Rename and add test for HTMLFormatter

Details

Trying to duplicate / fix #729

Cannot reproduce this bug by setting Locale for my laptop, or running the test with VM options: -Duser.language=fr (or nl, for that matter). Only by explicitly setting the Locale in the test (see previous PR).

Motivation and Context

The original test does not validate that report.js is valid; it validates that an empty report throws a particular exception. Replaced it with a test that does check for valid Javascript instead.

How Has This Been Tested?

'mvn clean install' => Build Success

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code. (code is a test ;)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 56.209% when pulling 4ff2701 on mlvandijk:locale-format into a3f847b on cucumber:master.

@Test
public void writes_valid_report_js() throws Throwable {
@Test(expected = EcmaError.class)
public void empty_report_js_throws_error() throws Throwable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't this this the test that caused the problems with the locale because the EcmaError contained a localized message?

Copy link
Member Author

@mlvandijk mlvandijk Sep 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was. But I cannot reproduce that either by setting my laptop's locale or passing a VM argument (see PR description).
I can only reproduce it by explicitly setting the Locale in the test and then resetting after.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, removed the test that checks for error and replaced with test that verifies content of reportJs.

@mpkorstanje mpkorstanje merged commit f0758b6 into cucumber:master Sep 9, 2017
@mlvandijk mlvandijk deleted the locale-format branch September 9, 2017 09:15
assertTrue(expected.getMessage().startsWith("ReferenceError: \"document\" is not defined."));
}
String reportJs = FixJava.readReader(new InputStreamReader(new URL(outputDir, "report.js").openStream(), "UTF-8"));
assertEquals("$(document).ready(function() {var formatter = new CucumberHTML.DOMFormatter($('.cucumber-report'));formatter.uri(\"some\\\\windows\\\\path\\\\some.feature\");\n" +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mlvandijk @mpkorstanje assertEquals cannot be used to compare things with json data structures in them, since json data structures should be considered equal also if the attribute order differs. Thus we got a build failure when this PR was merged: https://travis-ci.org/cucumber/cucumber-jvm/jobs/273568042.
It is now fixed in fb15952

@lock
Copy link

lock bot commented Oct 24, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test fails : HTMLFormatterTest#writes_valid_report_js
4 participants