magpie-ea / magpie-modules

the reusable front-end bits in the _magpie modules
MIT License
7 stars 1 forks source link

Tests #3

Open x-ji opened 5 years ago

x-ji commented 5 years ago

Would be nice to also have some tests in this project. For example, check that the error message is correctly displayed upon unsuccessful submission/timeout etc.

x-ji commented 5 years ago

My idea is that some parts more worthy of testing might be where interactions with the server occurs/where it's easy for exceptions to happen. For example, does the error message show up correctly when there's no response from the server, or when the response code is other than 200, etc.

Because in the dev environment those things normally don't happen, so we might just trust the code to work, but it can be better to actually test to see if they actually work as imagined.

It's not a top priority but might be worth keeping an eye on if there's extra time. Apparently last time it also happened that the submission URL was specified wrong and the participants couldn't submit the results.

x-ji commented 5 years ago

Tests should be an integral part to any project. @JannisBush would you have some time to look into it in the future? Apparently a lot of functionalities related to localServer deployment method are already broken as nobody tested them whatsoever.

x-ji commented 5 years ago

For example, we should expect that the data to be submitted are produced by the same function and have the same expected format, under all submission methods. Currently the code in babe-submit.js is a bit messy. Tests also help refactoring a lot.

JannisBush commented 5 years ago

Sure, tests are important and I'll try to add some soon.

Unluckily, I have no experience with testing in JavaScript. Do you suggest any JavaScript testing framework or should we just write a simple framework ourselves ?

x-ji commented 5 years ago

I think for unit testing Mocha and Jest are the most popular ones. We might want to also focus heavily on simulating user interactions with the app, using for example Selenium and PhantomJS/Pupeteer.