mardi 6 décembre 2016

Handling JavaScript testing for VanillaJS, dropzone.js and Django project

I'm working on a project that at this point mostly involves custom code written in VanillaJS to communicate with a Django backend.

I'm very new to software testing in general, so I am a bit at a loss as to how to best handle unit testing or generally just testing the JavaScript code I've written. Is there even a case for unit testing here, because currently I mostly just hook to different dropzone.js event handlers and get my code ran. For example, there's this:

custom_dropzone.on('removedfile', function(file) {
    removeFileFromServer(file);
});

or this:

custom_dropzone.on('success', function(file, response) { file.id = response.id; });

The removeFileFromServer(file) function is something that surely COULD be unit tested, but it would require a lot of digging in the original dropzone.js code to get all the necessary attributes right for 'file' and then a way to trigger it.

The backend is at the time quite extensively tested and I trust that if anything strange starts to happen, it will be quickly caught in either the backend test suite or by exploratory testing.

Maybe Selenium and functional tests could be a better way forwards? I feel I've been so deeply convinced to "test all the things" by what I've read that I might be trying too hard to get a unit test running at every nook and cranny that it's bordering to non-productive.

What's your take?

Aucun commentaire:

Enregistrer un commentaire