Project

General

Profile

Actions

Bug #17829

open

Tests failing when translations are available

Added by Sebastian Gräßl over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Tests
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I ran into a case when working on Host Groups, where tests would fail on CI, but pass locally.

The test on Jenkins failed, because it could not find the link with `click_link 'Host Group'`, when running locally the same test passed.
Reason why it passed locally was, because there were translations present and and used.

The link is using `Hostgroup` as the msgid in the `t`-helper and would use that instead of `Host Group` for the text on CI as no translations are pulled.

To address this issue there are a few approaches:

  1. Align msgid and default en locale
  2. Ignore and not locales in tests at all, on CI and locally
  3. Use `t()` in tests as well and set a locale for tests

The first would be the simplest approach, but wouldn't avoid others running into similar issues in the future. The Second would probably require a bit more effort. It would mean that you use the msgid consistently and you know it's going to work on both. The same principle applies to the third option, but would require to either patch/configure `click_link` (and others) or go over all tests and add `t()`.

There are a few articles regarding this topic, which go a bit further and are stricter when it comes to translations.

Actions #1

Updated by Dominic Cleal over 7 years ago

  • Category set to Tests
Actions

Also available in: Atom PDF