Game development studying Whole by Maxim Zavadskiy: Game Programming Basics 2 : week5: Unit testing with NUnit

week5: Unit testing with NUnit

Posted by Maxim Zavadskiy on 21 January 2012, 10:41 PM



This week's material won't be interesting that much for me I suspect. I have experience with JUnit and NUnit won't differ much most likely. From the other side I may do the task fast.

Let's look at videolectures:

Video lecture

Why do we need Unit testing: The main problem for me is to make myself DO the test units once right after I did my class and then forget about it. But I always lazy enough so I leave this for "later" which may result in nasty situations. This is the same as in case of documentation:)



There was mentioned smth about "Simplifies integration" but it was swallowed so I didn't understand. How it can simplify integration?

Let's look at that wikipedia link about unit test tools... From there I found that NUnit and JUnit are related to so-called xUnit. That means that they are basically the same systems but just implemented for different languages. And for many languages there are relevant xUnit frameworks.

Creating a simple test: what's an attribute in C#? Is [TestFixture] similar to Java's @TestFixture? I am pretty sure it's so.

Why may we need constraint-based assert model? It just does the same as "normal" model but we write slightly similar line of code. I wonder when it may be more convenient that usual style?

ExpectedException: but what if we have several test for some method of class that are put in TestMethod()? Then if the first test in TestMethod will thorow an exception the others simply won't be run! What is the solution here? Currenly I don't see any sense in such feature because usually there are plenty of tests for each method. Of course we may put try-catch block everywhere but it's not convenient.

I am not sure if I got the difference between MaxTime and TImeout. So Timeout may be applied only for complete test fixture and it measures the executing time of the whole fixture?

I watched the demo and I go for task. Oh yes, almost forgot there're some articles in Material section let's read them first...


"About software testing in general": Yes I agree it would be nice to study a separate course in Testing, But the problem is that I haven't seen such on, or at my curriculum. A section "Testing methods" is interesting for me. So which of these 3 methods works better in most cases? Another question is, who should actually test some piece of the software: the programmer, who knows best of all what his code does  or other person, e.g. tester who will have a fresh look? Of course the best case is both but I think it may take to much time.

12 Unit Testing Tips for Software Engineers: "Instead, write a test that focuses on the behaviour of the system." - well, I am not agree here. Behaviour may depend on many helper methods/classes and if for some reason behaviour method test will fail we then have to check each non-behaviour method used here in that case. But if the test will be written for helpers too then we will see immediately probably where is the problem exactly.


Task: Write a complete NUnit test classes



:(( For one hour I tried running the NUnit test but I always crashes with reporting of invalid path. I googled it and tried a plenty of different ways but all doen't help:(. I left my post in discussion forum on Moodle. I see other guys have similar problem. I will probably reinstall MonoDevelop and try again later on.




Today I did that assigment, here's the link to the screencast -

I did this week's assigment in several weeks! Probably I was too lazy or there were many things to do maybe.

I have studied a couple of new things about unit testing but the majority of them studied before. To be honest that week was not that interesting for me as previous one. But now I will go for the next one!


Total time spent: 4:40

Attached files Attachments 1 (123.7K) - Download


anonymous profile picture
First distributed computing has an upper floor where you run out of systems to further distribute the problem, which it then just function as a traditional system with X number of available processing power. You can most definitely distribute the Hanoi problem, but you'll soon run out of systems to further distribute all the possible paths.

anonymous profile picture
how to hack into someones email without their password
Great article, a debt of gratitude is in order for assembling this! This is clearly one extraordinary post. A debt of gratitude is in order for the significant data and bits of knowledge you have so given here.
anonymous profile picture
when you must switch to the World Wide Web to search for some Assignment help.Taking help our high expert's professionals who have extensive experience in writing assignment will not only make you avail with the quality assignment, but you will also get plagiarism free assignment within the given time.
anonymous profile picture
igloo portable ice maker
A debt of gratitude is in order for sharing the information, keep doing awesome... I truly delighted in investigating your site. great asset..
anonymous profile picture
water heater repair st louis
I am consistently flabbergasted by the measure of data accessible on this subject. What you introduced was all around investigated and eloquent keeping in mind the end goal to get your stand on this crosswise over to every one of your perusers.
anonymous profile picture
travel silicone bottle
When I originally commented I clicked the -Notify me when new surveys are added- checkbox and from now on every time a comment is added I buy four emails with similar comment. Perhaps there is any way you are able to eliminate me from that service.<a href="">travel silicone bottle</a>
anonymous profile picture
golf short game
[url=]golf short game[/url]
A debt of gratitude is in order for your post. I've been contemplating composing an exceptionally equivalent post in the course of the last couple of weeks, I'll most likely keep it quick and painless and connection to this rather if thats cool.
anonymous profile picture
Stefan Carl
Are you demanding for the best assignment help services? Then no more wait you are the perfect place at Students Assignment, here you can get all your queries resolved faster. We have top <a href="">assignment helper USA</a> in our team that is with all the academic discipline and giving the best help that makes students score high grades.
anonymous profile picture
Stefan CarlAssignment writers Sydney is an assignment writing service in Australia that helps students at all levels achieve academic success through our easy to use services. In other words, we do the hard work so you do not need to and you can plan your time to study well.
Thus, let help you. Our Assignment Writers Sydney can write your essay, paper or do any kind of other assignments for you in a reliable and quick way.
anonymous profile picture
Vi ringrazio per l'informazione! Stavo cercando e non poteva trovare. Lei mi ha aiutato!