Hey cheers for the quick response
I’ve done my best to reduce the bumber of apps starting up.

—no-start prevents mimic from starting up so i cant actually run any tests
A hacky `Application.ensure_all_started(:mimic)` in the test_helper.exs got it 
running

Many tests often touch the DB so even if mimic could start up, I’d have to 
start up the app to start up the ecto repo, which would trigger a cascade start 
of the app anyway.
Makes me wonder what the intention was for ExUnit and what tests should be 
written using it.
But being restricted to pure unit only is very restrictive. Low key integration 
tests are really needed in a lot of cases.

> You could also explore having a dedicated unit_test env to aid this perhaps

How are you thinking this should be approached? As in custom MIX_ENV value? Or 
ExUnit tags? Is this documented anywhere?

> On 24/07/2022, at 2:07 AM, Adam Lancaster <a...@a-corp.co.uk> wrote:
> 
> If the tests are unit tests I wonder if you need to start the app at all?
> 
> Could you run them with `mix test —no-start` ?
> 
> You could also explore having a dedicated unit_test env to aid this perhaps
> 
> Best
> 
> Adam
> 
>> On 23 Jul 2022, at 14:57, Dylan Chong <dylanchon...@gmail.com 
>> <mailto:dylanchon...@gmail.com>> wrote:
>> 
>> I’ll start off by stating the problem that I’m having.
>> 
>> Basically, unit tests take too long to start up for a ideally superfast TDD 
>> cycle. This is because, in our umbrella app, we have many micro services , 
>> Each being their own app, and each standing up various other applications 
>> like Phoenix endpoints, Prometheus metrics, Various libraries doing things 
>> as their app starts up.
>> 
>> 
>> 
>> 
>> I have already done my best to reduce the amount of work being done at 
>> applications that up time, but there is still a delay of about six seconds 
>> (plus compilation times) for a single hello world test to run.
>> 
>> I have noticed that these two ways of running the test are not equal, 
>> especially in terms of speed.
>> 
>> mix test apps/utils/test/hello.exs
>> cd apps; mix test test/hello.exs
>> 
>> In my umbrella app at work, the first will take about six seconds to run 
>> (after repeated runs, to ignore compilation times) but the second will take 
>> 1.5. This is because the second option does not start up other umbrella apps
>> 
>> So why not always just do option two? Firstly, umbrella app dependencies 
>> Will not be seen unless mix is run from the top level umbrella - dependency 
>> overrides for Erlang libraries will appear to be unresolved, and mix 
>> test.watch will be unavailable if defined in the top level umbrella mix file.
>> 
>> possible solution: When running tests in an umbrella app, don’t start up 
>> other umbrella apps until running a test that is either inside it or depends 
>> on it via the test app’s mix file. If this is possible, it would still 
>> optimise test start up times when running mix test with —stale or —failed 
>> options
>> 
>> Looking forward to hearing thoughts!
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "elixir-lang-core" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elixir-lang-core+unsubscr...@googlegroups.com 
>> <mailto:elixir-lang-core+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elixir-lang-core/2e3515d8-055b-4dbe-9a2e-2c1e4cfd2a1fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elixir-lang-core/2e3515d8-055b-4dbe-9a2e-2c1e4cfd2a1fn%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "elixir-lang-core" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/elixir-lang-core/oaEMVC1uFtU/unsubscribe 
> <https://groups.google.com/d/topic/elixir-lang-core/oaEMVC1uFtU/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> elixir-lang-core+unsubscr...@googlegroups.com 
> <mailto:elixir-lang-core+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elixir-lang-core/0F010B35-5F78-4F4B-AC85-F25384F3766C%40a-corp.co.uk
>  
> <https://groups.google.com/d/msgid/elixir-lang-core/0F010B35-5F78-4F4B-AC85-F25384F3766C%40a-corp.co.uk?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/53B886FC-9D0C-418C-AC9B-3FB105740101%40gmail.com.

Reply via email to