Reputation: 1617
I'd like to know if there is any value in providing a test to say that a constant equals x in my test suite.
A couple of benefits I see to doing it:
You know when this value has changed, because the developer changing it will get a failed test
If the developer updating the constant updates the test with the new value, the test will confirm that it was properly updated
Would that be beneficial or just a nuisance?
Upvotes: 1
Views: 239
Reputation: 14550
imho, there is no benefit in it.
the only tests for constant i can imagine is when your constant is some complex object then maybe you can tests if all required constraints between its properties are met. but if it's just, let's say, a number or string then, imho, it's just a waste of time because test maintenance costs and it gives you absolutely no additional security
Upvotes: 2