Little -> Monster



Often when I do coding I asking myself how this small modification that I wanted to do converted into this monster that I working on ...  Good example is my recent decision to add regressions tests. I want to validating that I'm still able load some of the resources. 

Spoiler alert : I spend already few hours and still don't have this tests. 


Current setup look like this:
  • native tests - don't require initialization of whole engine and testing mostly low level stuff. 
  • tools tests - run inside in tools with initialized engine but don't have direct access to it API. 
Plan was simple. I want to add:
  • run-time tests - run inside engine (they have direct access to it).
This would allow me to easy load resources and do some simple check on it to validate that there is no major problems with them. So far so good...

Clean vision what I want to do

Because this is pretty straight forward modification there is no need for too much planning. I just need to jump into code and expand a little bit UnitTest-Cpp to support what I want. 

To do that like always I poking around in test runner. Adding some code here and there. With time I start realizing that there is issue with my approach. I want to have nice progress bar that follow executed tests and this approach don't support it.

Turning out this will be a little bit harder just because of this "stupid" feature but I really want to support it because it is cool to have it. Jumping into code again to add even more stuff ... 

(2 hours later)

Not so clean execution of what I wanted to do

Finally. Code works but I don't like it. Can you imagine ? I spend all this time just to came to this conclusion. What I have now is mess which is hard to follow. Somewhere around this point of time I came to realization that it would be really cool if GUI handle all tests the same way and the best thing I have idea how to do it. Time to do some cleanup and more work. 

(2 hours later)

Something went wrong

Whole change taking shape and is what I want. Doing some final testing ... and something is wrong. I just noticed that after finishing whole run I have more than thousand of test finished. This wouldn't be weird if not the fact that I have just eight hundred of them. Taking deep breath and starting debugging... 

(0.5 hour later )  

Found issue in filtering of tests. Small mistake in code but could propagate pretty badly. Adding some additional tests for founded cases and re-running all tests... f.. . Taking another deep breath and returning to debugging. There is still too many tests executed.

(0.5 hour later )   

Found second issue. One of changes I added on top of UnitTest-Cpp had some issue that allow to define duplicated tests. Fix is on it way.

Happy ending

I don't see any more issues. Whole thing works, bugs are fixed, additional test are in place and whole change-list ended with  64 files modified, added 2 new ones and total od: +720 lines / -232 lines. Not so small change anymore.

Conclusion

This is not first time that turning out that my initial vision was more like wish which when confronted with reality crumbling and need to be changed. Small modification then escalating and became something bigger. Bigger code require more effort to make it into something that fit whole engine architecture and code standards. 

In the end I'm most of the time satisfy with result but in the same time tiring. I know how much work is still ahead me to finish this project and the worst thing is that I probably once again underestimating amount of works :/  Do you guys have similar experience when you working on some features ? or this is just me?  

Greg

    Comments

    Popular posts from this blog

    Query commands execution

    W.U. 0x20

    Lets play : Good code / Bad code