Closed nelsonic closed 7 years ago
Didn't succeed in running the single test. (decided to move on with the Phoenix tutorial ...)
But would still like to know if/how to do it if anyone else
fiugres it out.
if you know how to run a single test file, please share/comment. thanks! π
I managed to run tests by following this
You need to create a test_helper.exs
file (these are generated from running mix new .
)
The file is automatically run when you run tests and it includes the ExUnit.start()
script
To get a single test running do the following:
cd Desktop
mix new testing
cd testing
touch test/basic-test.exs
paste the above into test/basic-test.exs
Then run:
mix test test/basic-test.exs
And it should work
@shouston3 yeah, I should have clarified that I was trying to avoid creating a new project using mix
but you're right, that's the simplest way of making progress with this. π
(thanks for being on-the-ball and taking the time to reply. hope you're having a good weekend.)
In that case you could run:
elixir -e "ExUnit.start()" -r basic-test.exs
Having a good weekend thanks, hope you're having a great one too
@nelsonic happy for you to close this π
@shouston3 my next PR will close it. π
Tried using the code in the book on p.131. (copied verbatim):
tried to run the individual file in the terminal.
But got the following error:
Screenshot:
Looked at https://hexdocs.pm/ex_unit/ExUnit.Case.html but no luck. Also looked at https://elixirschool.com/lessons/basics/testing and didn't get much enlightenment...
I'm trying to execute a single test file ... looked at: http://stackoverflow.com/questions/26150146/how-can-i-make-mix-run-only-specific-tests-from-my-suite-of-tests Tried
mix test basic-test.exs
andmix test --only basic-test.exs
This question might be more appropriate in https://github.com/dwyl/learn-elixir ... but I figured that given its from the "Programming Phoenix" book, other people might find it here....