refi64/zypak

Unit tests would be nice

rugk opened this issue · 2 comments

rugk commented

I see in the source code you seem to have no (unit) tests… Needless to say, that these likely would be a nice feature to have… 🙂

I did try this out a bit early on, but there were a couple of reasons they were...quite awkward. Since what Zypak does is so specific to mimicking the flow of the Chrome source code, tests tended to be really brittle while I was still trying to wire everything up together. In addition, the nature of it relying on LD_PRELOAD injection and such makes writing tests a lot more complicated, and this would also require a largely custom testing harness since they aren't generally designed with this in mind. I was also trying to finish the initial version in a relatively restricted timeline since many Electron apps were starting to enable their sandboxes, while also working on university classes (and squeezing in some unrelated stuff to not lose my sanity)... The tests unfortunately were pushed out to the wayside.

Despite this, do note that I have lists of things to manually test each Zypak release based on pain points in the past, and it's...surprisingly not very long.

That being said, since Zypak is mostly stable nowadays (and I'm not sharing time with classes anymore!), I've had my eye on making some regression-style tests for a bit now, since there are some internal cleanups I want to make to a few parts of the code and don't want to break anything. (Do note I will be using the manual testing as well.)

rugk commented

That sounds very good! And thanks a lot for all the effort you put into that despite having other things to do!

And yeah, I guess starting small with some tests is a very good idea. And if the internals change too much, they could likely be more like integration-tests or so, but I don't know the technical details or let alone C++ enough, so just take this as some inspiration…