3

We have a large web application in my office and we have a relatively large testing framework in place for the codebase (jsdriver and mocha). I'm pretty happy having a lot of the code tested (modules for web queries, controllers, etc.), but we have a lot of code that checks styling down to the pixel, which really bugs me. We have a lot of hard-coded values in the tests that make sure everything is where it's supposed to be.

For example, we have a widget A and another widget B inside of it. We then check if B is globally located properly in relation to its relative position and A's relative position. This means if we go into the styles and move something down a couple pixels, we have to go into the tests and change that hard-coded value by a couple of pixels.

This seems to create a very tight coupling of the style and tests, which I don't see a lot of value in. From an interface perspective, I see more value in testing things like is widget X visible when we move into this state. Is this a standard practice to so closely follow the pixel values? And if not, is there a better way to do it?

voodoogiant
  • 2,118
  • 6
  • 29
  • 49

0 Answers0