stackvana / hook.io

Open-Source Microservice Hosting Platform
https://hook.io
Other
1.27k stars 118 forks source link

Integrated tests #27

Open Bartvds opened 9 years ago

Bartvds commented 9 years ago

The hooks are currently self-contained files with integrated schema. Maybe a next step could be to integrate micro tests to automatically run whenever a hook gets updated.

Of course we can already test the hooks easily with the web-interface, but it is not quite the same as running some assertions from code.

Minimum requirements: async, multiple cases, labels, and maybe setup/teardown.

A nice way could be to let module['exports'].test be a function that returns the micro suite, like a one-level deep Vows or Expresso.

Could also be fun to do it with Tap(e): every hook could get a dedicated endpoint /test that publishes a TAP stream other hooks can consume.

Marak commented 9 years ago

Adding tests for Hooks is pretty important.

module['exports'].test would be where the suite gets attached to.

At this point, I haven't put a lot of thought into exactly how Hook tests would look or work. If you can come up with a working solution, that would be a good way to get this started.

Dedicated endpoint doesn't sound good. I'd think about adding an additional response format test. This gives us three response formats, raw, friendly, test.

Leaving this open for now. Marking as medium priority for feature pipeline.