Monday 15 July 2013

ruby on rails 3 - Testing specific text on page render a code smell? -


Occasionally, I'll get tests written by other people who depend on a lesson (like a successful message, An empty warning, etc.)

I find it unattractive, and usually they are given a specific selector (i.e.. # success message / or .error ) Or I18n value (ie. I18n.t ('foobar.success') or I18n.t ('form.error.missing_error') ) < P> The latter and future evidence seems to be, because if copy If the change happens then my test will not fail. However, some people have argued that if you change the message by mistake, it will not be caught as a failure.

Is there any standard practice when using such things that I do not know?

I do both in my tests: check selectors and check copy. If it is good, the test fails due to a copy of the test. It has slightly more maintenance, but people who change the copy should also be tested or if the test fails, then there should be a continuous integration setup to inform you immediately.

If you run a / b or multi-veteran test, but it is not very difficult ... just like I said, just more maintenance.

In the IMO, code coverage is good business of maintaining confidence.

No comments:

Post a Comment