Question

I would like to know what is supposed to be the proper way to test Foxx applications in ArangoDB. My project structure (simplified) is something like the following:

/frontend /* AngularJS webapp */
/backend  /* Foxx controllers, models and repositories */
manifest.json

For the frontend I am using Karma/Jasmine with success but I am having issues when trying to test the Foxx controllers.

More concretely, what I would like to achieve is testing some endpoints and verify they do what they are meant to, basically CRUD operations. For that, I would really need to have access to the ArangoDB instance for multiple reasons: clean the test database, prepopulate it with testing data, etc.

What should be the way to go in this case? Is this even possible?

Was it helpful?

Solution

There are two ways to handle this:

  1. Do a full stack HTTP API test of the Foxx app
  2. Do unit tests of the different parts of the Foxx app

The first thing is possible and I've already done that for Foxx apps. I would suggest doing that as the API is the contract between your frontend and backend. I think it also is closer to what you have described.

The second thing is not really possible right now, but the Foxx team is working on that and it will be possible in the near future.

For a web API test I personally use Cucumber using the Ruby driver Ashikawa::Core for truncating the collections before running the test suite. It is however possible to test the API in any test framework you like if you combine it with an HTTP client.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top