Should I translate string inside a Unit test? I have a Unit test where I need to print a string so I decide to use the t() function to translate it:

$this-&gt;assertTrue(is_numeric($expected), t('Parameter is numeric.'));


But the problem is that in the Unit test the t() function is not available. So I decide to check a similar Unit test in core (SortArrayTest) and the test don't translate the string:

$this-&gt;assertTrue(is_numeric($expected) &amp;&amp; is_numeric($result), 'Parameters are numeric.');


I know that at this moment Drupal don't have integration with the Unit test from the UI, but this can be possible in future, so:

Should I translate string inside a Unit test? If the answer is Yes, How I can do it?
No, you should not. An assertion message is basically on the same level as a code comment, you're not translating that either.

We used to do that in core, also because it was all Simpletest then and the messages were shown in the UI, so an argument could be made that should be translatable. But we did massive patches to get rid of that, it just adds more complexity without any additional benefit.