librelist archives

« back to archive

Unit Tests

Unit Tests

From:
William Bowers
Date:
2012-09-24 @ 16:58
How do you all feel about unit tests? I personally like them and think
they'd make testing a lot easier. Even if we just covered the basics,
having some coverage in every file could go a long way to mitigating risk
when refactoring and adding new code.

Re: [browserquest] Unit Tests

From:
Justin Clift
Date:
2012-09-24 @ 17:08
On 25/09/2012, at 2:58 AM, William Bowers wrote:
> How do you all feel about unit tests? I personally like them and think 
they'd make testing a lot easier. Even if we just covered the basics, 
having some coverage in every file could go a long way to mitigating risk 
when refactoring and adding new code.

Personally, I haven't done much with any kind of testing
frameworks. (yeah, groan!)

However, every half decent (or better) place on the planet
uses them, and we probably should too. :)

Any idea of an easy, practical way for us to get started?
(something that doesn't require reading 50 pages of docs
first) :)

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Unit Tests

From:
Steve Gricci
Date:
2012-09-24 @ 17:16
I'm all for unit tests.

To ease continuous testing, we should probably look at something supported
by Travis-CI  [travis-ci.org], which seems popular for open source projects.

It seems Travis CI uses node to run the test cases against the javascript code
(http://about.travis-ci.org/docs/user/languages/javascript-with-nodejs/).

_s 


On Monday, September 24, 2012 at 11:08 AM, Justin Clift wrote:

> On 25/09/2012, at 2:58 AM, William Bowers wrote:
> > How do you all feel about unit tests? I personally like them and think
they'd make testing a lot easier. Even if we just covered the basics, 
having some coverage in every file could go a long way to mitigating risk 
when refactoring and adding new code.
> 
> 
> Personally, I haven't done much with any kind of testing
> frameworks. (yeah, groan!)
> 
> However, every half decent (or better) place on the planet
> uses them, and we probably should too. :)
> 
> Any idea of an easy, practical way for us to get started?
> (something that doesn't require reading 50 pages of docs
> first) :)
> 
> Regards and best wishes,
> 
> Justin Clift
> 
> --
> Aeolus Community Manager
> http://www.aeolusproject.org
> 
> 

Re: [browserquest] Unit Tests

From:
William Bowers
Date:
2012-09-24 @ 18:11
I've done a fair amount of unit testing and some TDD, and even wrote a
javascript unit testing library a while back (
https://github.com/willurd/JSTest, which I don't recommend we use because
it hasn't been touched in a while and was never production ready). Looking
around, this is what I found. Both of these support running on node and in
the browser, and asynchronous testing:

   - QUnit, TDD -- https://github.com/kof/node-qunit -- simple api
   - Mocha, BDD -- http://visionmedia.github.com/mocha/ -- sexy
   documentation

I've never done any BDD and the whole concept seems a bit foreign to me. As
such my vote would be for QUnit or something similar. But I'm eager to here
what you guys think...

Re: [browserquest] Unit Tests

From:
William Bowers
Date:
2012-09-24 @ 18:17
Nodeunit looks even better than QUnit IMO:
https://github.com/caolan/nodeunit

Re: [browserquest] Unit Tests

From:
William Bowers
Date:
2012-09-24 @ 18:18
And for due diligence, here's the Big List:
https://github.com/joyent/node/wiki/modules#wiki-testing . I'm sure not all
of these support client-side testing.

Re: [browserquest] Unit Tests

From:
Brynn
Date:
2012-09-24 @ 19:10
I've never in my life even looked at unit testing, but it's something
I'd like to learn and help out with, so I'm all for it.

On Mon, Sep 24, 2012 at 11:18 AM, William Bowers
<william.bowers@gmail.com> wrote:
> And for due diligence, here's the Big List:
> https://github.com/joyent/node/wiki/modules#wiki-testing . I'm sure not all
> of these support client-side testing.
>

Re: [browserquest] Unit Tests

From:
William Bowers
Date:
2012-09-24 @ 20:18
Unit testing is great. Maintaining tests for a large project can be a pain,
but there really is nothing like the assurance that a large body of tests
gives you when you modify code. And a suite of unit tests really is just a
collection of code that exercises automatically what you might otherwise
exercise manually whenever you change something. It's just about 10000%
faster and more accurate.

Also, unit testing helps inform the design of an application and make it
more modular. It's like magic.

/spiel

Re: [browserquest] Unit Tests

From:
Justin Clift
Date:
2012-10-07 @ 05:41
On 25/09/2012, at 4:17 AM, William Bowers wrote:
> Nodeunit looks even better than QUnit IMO: https://github.com/caolan/nodeunit

Nodeunit seems to be the common standard in Node.js projects.

I'll take a look at it after the initial linting is finished (hopefully soon). :)

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org