i don't understand unit testing-and/or Busted

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
DarthGrover
Prole
Posts: 16
Joined: Wed Feb 05, 2014 11:31 pm
Location: Ohio USA

i don't understand unit testing-and/or Busted

Post by DarthGrover »

Ive been finding myself more and more bogged down with troubleshooting as my game gets bigger. I have made great strides in writing cleaner code but started thinking that busted or something like that could help too. Unfortunately I just cant wrap my mind around how unit testing libraries work. or the general workflow of using busted with love2d. I read the documentation but I think I need a more basic understanding. can anyone point me in the right direction?
User avatar
bdjnk
Citizen
Posts: 81
Joined: Wed Jul 03, 2013 11:44 pm

Re: i don't understand unit testing-and/or Busted

Post by bdjnk »

Although I'm no expert on unit testing, I can give you some small insights.

Unit testing is, exactly as it sounds, a method for testing 'units' of code. A unit just being a small testable portion, often a function or method. Relevent to this is the concept of good modularization (at least on the function level).

Unit testing does not require a framework, and how they work might be clouding the essence of unit testing. What I want when I test a unit of my code, is to check all the edge cases. If I have a function that takes a number and a string, I want to know how that function will respond when the number is zero or near zero or negative or tiny or huge, and when the string is empty or huge or contains bizarre symbols, and when either or both of them are nil, etc. I want to examine the output of all those scenarios. This is an extraordinarily tedious proposition.

A framework, like Busted, can be amazing because it allows you do this testing in a more efficient, uniform, and effective fashion. It will still be tedious, but it will make your code less buggy.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: i don't understand unit testing-and/or Busted

Post by Roland_Yonaba »

bdjnk wrote:It will still be tedious, but it will make your code less buggy.
So true.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Google [Bot] and 8 guests