Search This Website

Tuesday, 25 August 2020

August month unit test paper 2020

August month unit test paper 2020

I admit that to 95% of you, this is a very WTF question.

 so.  What is a unit test?  I understand that essentially you are trying to isolate atomic functionality but how do you test for it?  When is it necessary?  When is this funny?  Can you give an example?  (Preferably in C? I mostly hear about it from Java devs on this site, so maybe it's specific to object-oriented languages? I don't really know.)

 I know that many programmers swear religiously by unit testing.  What is this all about?

 Edit: Also, what is the ratio of writing unit tests to the time you usually spend writing new code?

I am Java, before Java, before that C ++, I am completely convinced that all the work I have done, I am now unwelcome, was enhanced by the testing strategies I raised.  The test hurts skimming.

 I'm sure you test the code you write.  What technique do you use?  For example, you can sit in a debugger and step through the code and see what happens.  You can execute code against any given test data.  You can create special inputs because you know that your code has some interesting behavior for certain input values.  Suppose your content uses someone else's content and it is not ready yet, then you duplicate your code so that your code has at least some fake answers.

 In all cases you can do some degree unit tests.  The last one is interesting - you are testing too much in isolation, testing your UNIT, even if they are not ready yet.

 My opinion:

 1).  Tests that can be easily reused are very useful - there is no end to late creep defects.  The opposite test sitting in a debugger is mind-numbing.

 2).  When you write your code, or the activity of creating interesting tests before you write your code, you get to focus on your fringe cases.  Those annoying zero and zero inputs, they "shut down with an error".  I'm getting better code as a result of good unit testing.

 3).  There is a cost to maintain the test.  Generally it is worth it, but do not underestimate the efforrt of working them.

August month unit test paper 2020


 4).  There may be a tendency to over-emphasize unit tests.  Really interesting bugs creep when the pieces are integrated.  You replace the library you mocked with the real thing and lo!  It doesn't quite do what they said on the tin.  There is still a role for manual or exploit testing. The insightful human tester receives special faults.  From the point

No comments:

Post a Comment