Find answers, ask questions, and connect with our
community around the world.

Forums Forums Web Design Unit tests and trivial code in web-applications

  • Unit tests and trivial code in web-applications

    updated 4 months, 3 weeks ago 0 Member · 1 Post
  • BusinessMag

    July 9, 2022 at 5:13 pm

    I am struggling with understanding how to properly cover code with unit-tests in web-applications. There seems to be a fundamental problem that is not discussed much. Web applications are inherently entwined in lots of transport protocols, storage and message passing systems. Because of it there is a lot of boilerplate code that simply passes data to and from without really doing much. Like receive data in thin controller action to put it into several DBs or send a push notification to another service. Writing unit-tests I am supposed to test my own code functions isolated from dependencies. So when I remove dependencies in unit-tests it seems like almost all of my code disappears almost being reduced to `f(x) = x` formula. I spent 2 weeks making this small project so far and it seems like I found like maybe 2-5 functions that actually have more than 1-3 lines of code. So I am wondering how other developers respond to this? How and why do you achieve high percentage of unit test coverage when more than half of functions may be trivial? Do you really cover all trivial functions? Maybe functions of other developers are more complex and it’s just my tasks themselves are too easy and unremarkable? How complex functions should be to warrant coverage? – by /hq/cosmic_cod – –

Viewing 1 of 1 replies
Reply to: BusinessMag
Your information:

Original Post
0 of 0 posts June 2018