0

I have a class that does reboots a machine and then prompts it for readiness. The prompting is done via ssh and the standard output needs to be formatted to verify if the machine is in ready-state. So should I write tests for the method that does the parsing? There's no actual logic in there, just cutting and joining of a string. I have to run some integration tests anyway to verify it, so is there a point in writing a unit test for it?

1

1 Answer 1

3

I would think a unit test would verify that the parsing works correctly. Whether or not it's strictly required might be of some debate, but I'd say it wouldn't be a bad thing.

Unit tests are supposed to offer fast feedback on broken expectations. That's (one of) the considerable advantages over an integration test, which is not really expected to be fast or to run nearly as often as unit tests.

As such, it would probably be a decent argument to say that a unit test that verifies the string cut/paste operations would be better than just having it tested as integration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.