2016-12-27 1 views
12

, 내가어떻게 Elixir 믹스 테스트 출력을 좀 더 상세하게 만들 수 있습니까? 내 비약/피닉스 응용 프로그램에서

mix test 

내가 같은 출력을 얻을 실행 성공 각 시험 점

$ mix test 
.... 

Finished in 0.09 seconds 
4 tests, 0 failures 

.

대신 성공한 테스트의 이름을 어떻게 출력합니까? 내가처럼 보였다 디렉토리에 .rspec 파일을 사용하여이 작업을 수행하는 데 사용 RSpec에와 레일에서

:

$ cat .rspec 
--color 
-fd 
--tty 

는 비약에 해당하는이 있습니까? 도움이 https://hexdocs.pm/mix/Mix.Tasks.Test.html

희망 :

답변

18

통과 테스트의 이름을 인쇄하려면 --trace 인수를 mix test에 전달하면됩니다. 또한 test_helper.exsExUnit.start 라인을 변경하여 기본적으로 true로이 옵션을 설정할 수 있습니다

$ mix test --trace 

HTTPoisonTest 
Starting HTTParrot on port 8080 
Starting HTTParrot on port 8433 (SSL) 
Starting HTTParrot on unix socket httparrot.sock 
    * test post binary body (97.1ms) 
    * test https scheme (57.8ms) 
    * test option follow redirect relative url (4.0ms) 
    * test option follow redirect absolute url (2.6ms) 
    * test put (0.6ms) 
    * test request headers as a map (0.5ms) 
    * test get (1.5ms) 
    * test head (0.5ms) 
    * test delete (1.5ms) 
    * test asynchronous redirected get request (2.3ms) 
    * test send cookies (4.9ms) 
    * test post charlist body (0.7ms) 
    * test patch (0.5ms) 
    * test post form data (0.6ms) 
    * test exception (6.0ms) 
    * test get with params (2.8ms) 
    * test asynchronous request (0.5ms) 
    * test explicit http scheme (0.5ms) 
    * test put without body (0.8ms) 
    * test multipart upload (8.5ms) 
    * test options (0.5ms) 
    * test basic_auth hackney option (1.6ms) 
    * test http+unix scheme (4.4ms) 
    * test asynchronous request with explicit streaming using [async: :once] (304.1ms) 
    * test cached request (2.1ms) 
    * test post streaming body (3.8ms) 
    * test char list URL (0.7ms) 

HTTPoisonBaseTest 
    * test request body using ExampleDefp (124.1ms) 
    * test passing ssl option (110.9ms) 
    * test passing connect_timeout option (109.9ms) 
    * test passing recv_timeout option (103.4ms) 
    * test passing proxy option (106.6ms) 
    * test passing follow_redirect option (105.3ms) 
    * test passing proxy option with proxy_auth (106.9ms) 
    * test request raises error tuple (104.9ms) 
    * test passing max_redirect option (115.6ms) 
    * test request body using Example (111.6ms) 


Finished in 2.0 seconds 
37 tests, 0 failures 

Randomized with seed 264353 

:

ExUnit.start(trace: true) 

예를 들어, 여기 httpoison 패키지의 현재 마스터 분기에 mix test --trace의 출력입니다 완전히 사용자 정의 출력을 원한다면 자신 만의 포맷터를 구현할 수 있습니다 (예제는 https://github.com/elixir-lang/elixir/blob/master/lib/ex_unit/lib/ex_unit/cli_formatter.ex, 기본 포맷터 임).

ExUnit.start(formatters: [YourFormatterModule]) 
2

--trace 당신이 찾고있는 옵션입니다!

관련 문제