jamesmintram
What I was looking for was a way to run a bunch of tests against a staging environment using “real” HTTP requests.
How would someone go about organising code in a Phoenix project for something like that? I am assuming it wouldn’t go under the standard test folder, as these tests are ran very seldom (and require a “real” webserver to test against) but I would like to use ExUnit to manage them.
An ideal solution for me would be something like:
mix test.acceptance http://staging-url
Is there something already like that?
Any suggestions or comments would be greatly appreciated.
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
Hi everyone.
My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
How Can I Optimise Compile Time Dependencies
I have been building an elixir application for about 2 years now. Many modules and files ha...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
Other Trending Topics
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #hex










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
stefanchrobot
This totally sounds like something doable. Wouldn’t just using ExUnit with any HTTP client do the job for you?
On a side note, I would wonder what do you want to achieve, really. I would assume that you’re writing controller tests, so aren’t you duplicating the work? In a previous project we had controller tests and some “integration” tests written using Postman. The idea was that Postman could generate API docs out of the tests suites. The downside was that Postman’s project sync was a real pain and there was a lot of duplication between tests.
jamesmintram
Thanks stefan.
Wouldn’t just using ExUnit with any HTTP client do the job for you?
That’s what I was thinking (and wondered if other people did the same) but I am not sure how best to integrate that into a phoenix project. My thoughts were to create a special mix command for running them.
On a side note, I would wonder what do you want to achieve, really.
I did think about this. The idea of these tests would be a sort of smoke test. They would test client journeys that contain a sequence of actions a client may carry out against the service, for example:
These steps would test high level functionality across many facets of the service in 1 test, only communicating via the REST interface. They test the happy path. I believe I first saw this idea in “Growing Object Orientated Software”.
stefanchrobot
So it looks like you want to bundle a suite of smoke tests with your app so that when you deploy it you can run it on the server. Did it get that right? If that’s the case, then using HTTP client with ExUnit’s assertions wrapped in a mix task makes sense.
Otherwise I’m not sure why you’d like to integrate those tests with your Phoenix project. The tests can be a totally separate Elixir project. I’d also consider using a different technology for that.
jamesmintram
So it looks like you want to bundle a suite of smoke tests with your app so that when you deploy it you can run it on the server. Did it get that right?
Yes. Although the tests don’t need to ship with the app. (They can be left out when doing a prod build)
Otherwise I’m not sure why you’d like to integrate those tests with your Phoenix project.
My reasoning is to keep the tests and project together. I’d rather manage 1 repository than 2. Also, the changeset history will all remain in 1 timeline.
I’d also consider using a different technology for that.
I have done that in the past, using Python + HTTPie. It was OK, but you end up needing two environments on your machine, and you are dealing with switching between two languages. I would much prefer everything in 1 language.
using HTTP client with ExUnit’s assertions wrapped in a mix task makes sense.
OK, that’s great. I will probably create a separate Elixir project next to the existing one. That way they share nothing and I can keep them versioned together.
Thanks.
devonestes
I’ve used Wallaby for that in the past, since it spins up an actual server. That, plus tagging those tests as acceptance tests or something, can totally do what you’re looking for.