Skip to content

How to make Unit Testing inside Parse Server #4310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Oct 31, 2017 · 7 comments
Closed

How to make Unit Testing inside Parse Server #4310

ghost opened this issue Oct 31, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Oct 31, 2017

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 ?

@acinader
Copy link
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

@flovilmart
Copy link
Contributor

flovilmart commented Oct 31, 2017

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.

@acinader
Copy link
Contributor

look at that! nice.

@flovilmart
Copy link
Contributor

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

@ghost
Copy link
Author

ghost commented Nov 16, 2017

Thank you for you answer, I'll take a look at this

@ZacharyKhan
Copy link

ZacharyKhan commented Dec 9, 2017

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.

@flovilmart
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants