Quantcast
Channel: Davisbase Consulting » Leslie Lowman
Viewing all articles
Browse latest Browse all 5

You Call That Unit Testing? What we really do!

$
0
0

As you saw from the previous post, “You Call That Unit Testing – What Is It?”, unit testing is something that is very important and should be very much a part of a team’s everyday process.

However, the one thing that always surprises me is that a lot of developers think they are doing unit testing, but in fact, they are not. What exactly are they doing?

The mindset of a lot of developers, including myself early in my career, is that you code a piece of functionality, you run the application, you walk through a ‘happy path’ scenario where you click all the right buttons, input all the right things, and voila, that’s unit testing.

Well, I’m here to tell you that’s not how it works!!

Unit testing is all about testing each independent unit of code, independently.  The idea is that I, as a developer, write a function/method and then write, in the same programming language as the function/method, a test where you would call the application’s function/method.  You would call it just as if you were to click a fictitious button, even passing any inputs to it.

Once you have written the test in the same programming language, then you would use some sort of framework, such as nUnit, jUnit, or Microsoft’s Testing Framework, to run the test.  When the test is run, it will either ‘run red’ or ‘run green’.  If it ‘runs red’, then you know something is wrong and therefore can fix it right then.  If it ‘runs green’, then you know all is good and you can proceed with the next function/method.

If you are interested in seeing an example of unit testing in Java, check out Kushal’s Java Blog.  If you want to learn more about unit testing, or testing in general, you would find our Agile Testing course very beneficial—it could open your eyes and help you be a better developer, tester, or all around team member; it could also help make your product better!

The post You Call That Unit Testing? What we really do! appeared first on Davisbase Consulting.


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images