Open yochannah opened 5 years ago
Hey @yochannah I would like to take this. I have very little experience with writing tests, but this seems the right opportunity to get started.
@harshil1712 that sounds amazing! Do you know where you'd plan to start or would you like to chat first?
It would be great if I could get some help. I have a few questions.
As I mentioned I am new with testing, and there might be a lot of questions coming from my end. :sweat_smile:
@harshil1712 okay, here's a mega response - I'd suggest working through these in order. Just the basic use case alone would be amazing.
testing library: how about jest? this will align with some other intermine-based tools.
This won't require a testing library, probably just a travis yml file, possibly with a shell script as well. if the script completes = success, if it errors out partway = failure.
check directly against the mongo DB that:
"isProduction": true
"isProduction": false
ideally using cypress.
[TODO, ADD DETAILS AT SOME POINT] :)
Hey @yochannah, I've added the travis.yml file in my forked repo. But I am not sure how do I add checks for the setup scripts? To check that, won't we need a testing library?
basic
This won't require a testing library, probably just a travis yml file, possibly with a shell script as well. if the script completes = success, if it errors out partway = failure.
does the setup scripting work correctly? (e.g. following the readme docs, set up a mongo, run the initregistry script and the createuser script).
@harshil1712 if you know a way to do this with a testing library, go ahead!
I was thinking something along the lines of a shell script - an example is here: https://github.com/intermine/bluegenes/blob/dev/.travis.yml#L30
@yochannah thank you for the link. It helped me understand the approach better.
My .travis.yml
file contains the following line of code
language: node_js
node_js:
- "node"
services: mongodb
script:
# Install packages
- npm install
- export MONGODB_URL=mongodb://localhost:27017/registry
# Running createUser.js
- node createUser.js
# Populating the instance
- node initRegistry.js
# Start server
- npm start
This seems to work until the node createUser.js
is ran, since it asks for a username and a password, and since we cannot provide an input, the next step is not executed .
And we are using this username and password in the initRegister.js
file as well. Hence updating this file is also not possible with this approach, as per my understanding.
I am not sure if there's a way to do this apart from writing tests.
Please guide me for my next step.
@yochannah I would like to work on this issue if it's still available. I haven't written any tests prior to this, so it will help me to learn more about writing tests.
It would be nice to have some basic tests hooked into Travis to test the following things:
The reason I say this is I managed to merge a PR without testing one method, and then had to revert it when I realised that one method had broken :(