mercredi 29 janvier 2020

Laravel - Testing API with data dependencies

I'm working on a Laravel application with authentication. The application also has an API. Now I want to test all the API endpoints of the application. The Problem is, that the some Endpoints Need data in the database to "work" with.

How is it possible to test such an application? Do I have to test the application in the correct order to archieve something like that?  

For example:  

  1. create user
  2. create new post
  3. edit new post
  4. create new user
  5. comment post of user 1
  6. login with user 1
  7. see comments of post
  8. delete post

Or is it possible to simulate stuff like this so I don't Need a specific order?

I saw that Laravel has build in HTTP testing, but I don‘t know how to handle the data dependencies.   Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire