Skip to content

How to make Unit Testing inside Parse Server #4310

Closed

Description

How we can make unit testing with Parse, in each Cloud Code Function I have multiples query it is difficult to test actually,

How we can make unit test with Parse Query ?

Activity

  1. acinader commented on Oct 31, 2017

    @acinader
    Contributor

    My suggestion is to take a look at how unit testing is done on the parse-server repo itself.

    https://github.com/parse-community/parse-server/blob/master/package.json#L75

    is the command that runs the tests. Which looks complicated, but basically its just invoking jasmine.

    The jasmine config: https://github.com/parse-community/parse-server/blob/master/spec/support/jasmine.json

    The helper.js that sets up and tears down the database and the parse-server:

    https://github.com/parse-community/parse-server/blob/master/spec/helper.js

    the helper has a lot of legacy code in it.

    And finally, here's an example of a test of cloud code:

    https://github.com/parse-community/parse-server/blob/master/spec/CloudCode.spec.js#L79

  2. flovilmart commented on Oct 31, 2017

    @flovilmart
    Contributor

    There is also this test runner that we wrote:

    https://github.com/AmpMe/parse-server-test-runner

    It will connect to a local database and you can cleanup data at will.

  3. acinader commented on Oct 31, 2017

    @acinader
    Contributor

    look at that! nice.

  4. flovilmart commented on Oct 31, 2017

    @flovilmart
    Contributor

    We use it extensively for everything, that's very nice to test e2e cloud functions etc...

  5. ZacharyKhan commented on Dec 9, 2017

    @ZacharyKhan

    Just came across this, very interesting! How would I implement something like the Parse-Server-test-runner?

    If I’m able to grasp it and get it working, I’d love to contribute to the README or WIKI with instructions for others to use this. I think it’s super useful!

    EDIT: I see there’s an example in the Repo for the test runner. I’m not familiar with the language as I write in Swift mostly, but I will play with this and see how far I can get using the example provided.

  6. flovilmart commented on Dec 9, 2017

    @flovilmart
    Contributor

    Open an issue on the test runner if you need an example :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions