So I'm having to figure out a way of acceptance/specification testing a program that makes restful web requests and then invokes other programs.
Now, the former is pretty easy to test. Just create some mocha tests that run via node.js, and have that spin up it's own server that fakes the request/responses and invokes the client program.
There's libraries for that and it decouples the client testing from needing a real server which is always good. Then you can verify the requests were made and the behaviour was as expected.
Hooooowever, the latter is more difficult. I'm having some internal debates about how to do it. I could accept the dependencies will exist and just look for the side-effects of invocation of those programs, but that means some things are more or less impossible or incredibly difficult to test. It strongly ties the specification to those tools, which isn't nice.
So I'm thinking instead the client can take via config files the programs it needs to execute. So config can say "MAKE=make" or "MAKE=mingw32-make" and the client will invoke that program. Then, the tests can have config files that say something like "MAKE=node mockprogram.js make", and that mockprogram.js will then log the invocation, working directory and command line arguments before running a javascript function that runs the stub make implementation. Then I can inspect the log of invocations to assert that the expected invocations were made.
Does anybody know of any tools for this, or am I going to have to eventually break this code out into a library and publish it so that there are?
