locopati
I have a test case with a setup and multiple tests. I want to run the exact same tests a couple times, changing a variable each time. In Rspec, this is trivial with let and shared_examples. ExUnit.Parameterized looks like it applies to individual test cases but not to the entire set of tests. What’s the right way to accomplish this in ExUnit?
I’m fairly new to Elixir for what that’s worth.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
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
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
The way I usually do this is like this:
For some more complex input values, you might need to
unquote(Macro.escape(…)), but you’ll figure this one out as soon as ecto barfs at you because its unable to unquote something.axelson
Depending on your inputs you might also want to just put these all in a single test
Although you could also extend @NobbZ approach to all the tests in the file by including multiple
testdeclarations inside theEnum.eachNobbZ
I do not like having many asserts in a single test.
Especially for such things. If you to a
--traceor otherwise try to get a list of slow test, than very simple tests with a lot of different input might appear as slow tests, but in fact its not one slow test, but thousand fast ones.But I think this is really a matter of personal taste.
Qqwy
It might also make sense to assign them to a local variable first in those cases.
I agree about the amount of asserts per test: Another problem is that later asserts will not be tested against once the first one fails.