Arc Forumnew | comments | leaders | submitlogin
2 points by zck 4159 days ago | link | parent

Good luck. I could use one -- I've wanted to use it with Twitter for a while. I started writing one myself, then realized I needed a unit test framework, so I've been working on that. Oh, the perils of a language lacking libraries.

Would you like some help? As long as it's free software, I'd love to assist.



2 points by akkartik 4158 days ago | link

But anarki has a unit test framework already: https://github.com/arclanguage/anarki/blob/7415f52cdc/lib/ar.... It also has some intermittent unit tests, e.g. https://github.com/arclanguage/anarki/blob/7415f52cdc/arc.ar...

Did you mean in some other language? It's easy to build a test harness, it's usually the first thing I do with a new language, and invariably just a few lines of code.

Here's my test harness in C++, for example: https://github.com/akkartik/wart/blob/cc70d66ee6/literate/00.... Even in C++ it's just 50 lines or so. Dynamic languages are often even shorter.

(It's not a normal C++ project. I use readable diff directives inside :(..) to add the test harness to the skeleton program at https://github.com/akkartik/wart/blob/cc70d66ee6/literate/00.... But now that this is done, any function I write with 'test_' is automatically run in test mode. Look at the makefile to see how I do that with minimal code.)

Anyways, tell me what language and I'm sure we can get you quickly past this hurdle.

-----

3 points by zck 4157 days ago | link

Honestly, there are some fiddly bits about the unit test framework I don't like, but mainly I wanted to write one.

I actually applied with it for Lisp In Summer Projects (http://lispinsummerprojects.org/), which is why I haven't announced it -- you're supposed to do the work yourself, without help. And people here like to help out and post code. :-p

Luckily, at this point it's got the main features I want, so I can actually use it.

-----

3 points by brianru 4157 days ago | link

Sweet. I had been wanting to play around with the unit test code too -- i'm excited to see what you've put together.

The oauth utility is also for the LISP contest -- we'll see how far I get over the next few weeks.

Either way I'm planning on uploading a few bits and pieces to Anarki or my own repos over the next couple of weeks. (spent some time on anarki's web.arc, the state machine stuff, oauth, some lazy evaluation stuff, etc...)

Once it's all up I'd love some help!

-----

4 points by zck 4157 days ago | link

Well, if it might be useful, let's do it. https://bitbucket.org/zck/unit-test.arc

Please let me know what you think -- email in profile, comment here, open bitbucket tickets, find me on the street^1, etc.

[1] Actually, after writing this, I read your profile, and found you're in Hacker School. I'm in nyc too -- we should meet up sometime. Shoot me an email.

-----

1 point by akkartik 4157 days ago | link

That makes sense :) I'd love to hear more about what's fiddly about the existing version (I have different versions at http://github.com/akkartik/arc, etc.) and why you need the features (suites, nested suites, failure messages, anything else?)

-----

4 points by zck 4157 days ago | link

I'm going to have to go to bed soon, as I need to wake up in eight hours and twenty minutes, and I've promised myself I'm going to try to sleep enough, for once.

So I'll just explain what, in my mind, is the biggest difference -- how I want to use it. To run the anarki test-iso test, you execute the entire `(test-iso ..)` sexp. If you want to run a bunch of tests, you have to execute all the sexps.

That's kind of a hassle. Especially if you find a bug, have a bunch of tests that fail, then change a small thing in the function, and want to re-run all the tests.

In my unit-test.arc, all you have to do is call `(run-suites suite-name)`, and it'll run as many tests as you've got in `suite-name`. You don't have to copy a bunch of sexps into the repl or reload the file (and what if you want to run a subset of a file? You can't). Also -- and this is one of the features I'm currently working on (https://bitbucket.org/zck/unit-test.arc/issue/21/after-runni...), what if you run one hundred tests at once? Do you really want to parse -- with your eyes, like a bloody scribe -- every single line of output to find the seven tests that broke? And when you then make a fix, you're not going to want to parse them again, so you'll only run the seven that failed before. So if you broke something else, you won't find that out.

So, what falls out of my desire to run a set of tests easily and repeatably, and have summarized output? Some sort of grouping, with a single point of entry to run the tests -- that is to say, test suites.

Please correct me if I've missed any feature of Anarki's test framework. I did read its code and try it, but I didn't look into other files for supporting functionality.

-----

2 points by akkartik 4157 days ago | link

Thanks! You're absolutely right, I've had every single one of these problems, I just never focused on them. But I'd often comment out a bunch of tests in the middle of debugging just one.

(brianru also reminded me that arc has a whole new recent unit-test framework with suites: https://github.com/brianru/anarki/commit/b62a38ebcd via https://github.com/arclanguage/anarki/pull/15)

-----