c++ - How to determine if an existing class can be unit-tested? -


recently, took ownership of c++ code. going maintain code, , add new features later on. know many people not worth adding unit-tests existing code, still add tests @ least partially cover code. in particular, add tests reproduce bugs fixed.

some of classes constructed pretty complex state, can make more difficult unit-test.

i willing refactor code make easier test.

is there article recommend on guidelines identify classes easier unit-test? have advice of own?

while martin fowler's book on refactoring treasure trove of information, why not take @ "working legacy code."

also, if you're going dealing classes there's ton of global variables or huge amounts of state transitions i'd put in lot of integration checks. separate out of code interacts code you're refactoring make sure expected inputs in order recieved continue produce same outputs. critical it's easy "fix" subtle bug might have been addressed somewhere else.

take notes too. if find there bug function/class expects , handles you'll want change both @ same time. that's difficult unless keep thorough records.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -