Test framework for the future?


#1

Is there any plan for unit test integration in a near future? Most of my dev are done using TDD approach and such amazing collaborative approach can be greatest if such tests can be designed and executed … but how?


#2

Hi d-plaindoux,

We love TDD and we use it for developing this product as it allows the whole team to collaborate with greater confidence in code we may not be totally familiar with.

With this project we decided to gauge the interest in TDD before embarking on it, especially because we believe one of the great things is how speedy it is to Just Code and have it Just Run. Tests take time to run and the question we haven’t answered for our selves is how long running tests may effect the value experience of seeing your code Just Run as fast as we can make it.

We would love to hear what you think and how tests would impact what you find great about HyperWeb.

Please keep the feedback coming - it’s what we need to keep delivering what our community needs!

Richard


#3

Here’s an example project made by Emanuele, which adds Mocha tests before deploy - https://hyperdev.com/#!/project/blossom-scorpion


#4

Really simple with an immediate feedback when doing some tests … :thumbsup:


#5

I’m going to try that out, thanks for posting it.

Any idea if the server code can access the client code so I can test client-side Javascript?

If not, I guess I could set up a client-side test runner to run in the browser.


#6

I figured out how to test client-side code, but it’s a little hacky. I remixed Emanuele’s code with a test of some client-side code. My version adds a client-side library called analysis.js that analyses the dream text. Then I imported that code and tested it in the server-side tests. The hacky part is that I imported it and executed it with eval(). Anybody know of a cleaner way to import it?

var assert = require('chai').assert,
    fs = require('fs');

eval(fs.readFileSync('public/analysis.js', 'utf-8'));

One minor annoyance is that changing the client-side code doesn’t trigger a redeploy, so doesn’t trigger the tests. You have to go and touch something server-side.

It also looks like you could run jQuery server side for testing, but I didn’t try it.