Giter Site home page Giter Site logo

Comments (8)

yochannah avatar yochannah commented on June 1, 2024 2

@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.

use-cases:

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).

advanced - unit tests

check directly against the mongo DB that:

  • POST to /instances - does the POST get added to the DB correctly?
  • POST to /instances - if a namespace already exists, does the api return an error? namespaces should be unique.
  • GET to /instances - should return the correct number of results WHEN
    • there are no params (should return all intermine instances)
    • param: q=flymine
    • param: mines=dev should not return any intermines with "isProduction": true
    • param: mines=prod should not return any intermines with "isProduction": false
    • param: mines=all should return a count of intermines that is sum of the total of dev and prod intermines.
  • PUT to /instances should update the given instance, and only the given instance.
  • PUT to /instances shouldn't allow a namespace to be changed
  • DELETE to /instances should delete the given instance and only the given instance

Even more advanced - UI-based tests

ideally using cypress.

[TODO, ADD DETAILS AT SOME POINT] :)

from intermine-registry.

harshil1712 avatar harshil1712 commented on June 1, 2024 1

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.

from intermine-registry.

harshil1712 avatar harshil1712 commented on June 1, 2024 1

It would be great if I could get some help. I have a few questions.

  • Is there any preferred testing library that we should use?
  • Can you please give examples of the use cases that require the test?

As I mentioned I am new with testing, and there might be a lot of questions coming from my end. 😅

from intermine-registry.

yochannah avatar yochannah commented on June 1, 2024

@harshil1712 that sounds amazing! Do you know where you'd plan to start or would you like to chat first?

from intermine-registry.

harshil1712 avatar harshil1712 commented on June 1, 2024

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).

from intermine-registry.

yochannah avatar yochannah commented on June 1, 2024

@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

from intermine-registry.

harshil1712 avatar harshil1712 commented on June 1, 2024

@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.

from intermine-registry.

dmahajan980 avatar dmahajan980 commented on June 1, 2024

@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.

from intermine-registry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.