What happens when your code breaks in production? If you have Honeybadger you'll be alerted with crucial details like the error location, the data being processed and the affected users. So you can deploy a fix quickly and get back to coding. Learn more.

RubyFlow The Ruby and Rails community linklog


The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

nanotest - When all you need is #assert

Extremely minimal test framework. Perfect for DIY lovers. Nanotest provides the bare minumum needed; for everything else, there’s ruby.



this is 22 lines of code. the results aren’t even that flexible or sensible. some dots? if you want to add some value, why not a hash or something? so, so, so pointless

oh yeah, and there’s

require ‘test/unit’

hey let’s spend 20 minutes writing a pointless little app, call it “simple” and “minimal” and think we’ve accomplished something

Does not hurt to have one more test framework. Ruby does not have assert built in. This could potentially be poor man’s assert after some modification.

@kenny The results only contain dots and F’s because that’s all you truly need a test suite to provide. Of course other features are sometimes nice to have, in which case you can either add a simple nanotest extension to provide it, or, as you pointed out, use a more complete test framework like test/unit. Writting a full-featured framework was not the goal of nanotest.

As for simplicity, there are concrete advantages to it. For one, it makes it easy to extend (see test/unit’s source for example), and it also allows you to use/require only what you need. Some people appreciate this, though I do understand that others prefer a lib that does a lot and only pick what they need from it.

Btw, minitest was a rewrite of test/unit with code simplicity in mind AFAIK, and it made it into ruby core. I’m pointing this out only to illustrate that there are quite a few coders who enjoy working with simple(r) libs.

Nanotest’s code being tiny, I was expecting bikeshed arguments and harsh comments. So I’m ok with it. I thought I should at least justify a few design choices.

I think this is pretty cool, actually. I love minimalism. Less is more, especially when programming.

@kenny, no need to be rude when criticizing

I’ll +1 on the idea of being a coder that enjoys working with simple(r) libs. The most powerful notion in nanotest is that it doesn’t tell you how to structure your tests.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in