mmport80
I am sketching out how to test a CRUD API.
My idea is to create a simplified model / FSM, generate different states and test for properties based on the model.
E.g. assuming everything’s successful,
- GET /users
- POST /create/id/9
- DELETE /delete/id/9
- GET /users
users from 1. and 4. should be the same
Then do the a similar test when
- GET /users
- POST /create/id/8
- GET /users
3.'s users should have one more entry etc.
or when
- GET /users
- POST /create/id/11
- DELETE /delete/id/54 //:error
- GET /users
Again 4’s users should have one more entry.
basically, setting properties for as many cases I can, and then testing with random test-cases.
Problem is, I cannot find much material online, I am sure it is pretty standard esp. as CRUD APIs are pretty standard.. (?)
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
idi527
I think https://propertesting.com/ is pretty good.
mmport80
I really like what I have read also - just wondering whether there is a canonical “this is how you property test a CRUD API” - these are the properties to look out for, no matter the language etc.
dimitarvp
For a server-side rendered CRUD website I’d concentrate on making
StreamDatagenerators of controller parameters – omit mandatory fields, send fields with invalid data in them, try and update or delete non-existing IDs, send fields that your app isn’t at all expecting.StreamDatacan be really alien at start but when you experiment with it for a weekend you can do some seriously powerful data generators with it!mmport80
I ended up following the book’s recommendations (https://propertesting.com/) e.g. create an ‘oracle’ state machine.
Basically, you create random states by interacting with your API and keep a record in your oracle.
You compare both oracle state and results from your API, and make sure they are always the same.
You’d be surprised the bugs you catch.. I really need to try and bundle this into a library, am sure you could test lots of apps pretty easily with one library..
axelson
Can you explain more about how you create the oracle state machine.
david_ex
From What is a Property (online version of the book, prior to having been edited):