6.6. Platform prejudice

We’ve come a long way since the word computer was synonymous with one specific product that everybody used. Programmers increasingly need to consider multiple alternative platforms and operating systems for their software. Though Java was once pitched at us with the tag line “write once, run anywhere,” we’ve all found ourselves implementing platform-specific functionality because not everything is abstracted away.

With our software products concerned with multiple platforms, our tests must do the same. The platform prejudice test smell could be described as a failure to treat all platforms equal. It’s more intricate than that, but perhaps an example will make it crystal clear.

6.6.1. Example

The following example checks ...

Get Effective Unit Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.