[Proposal] Access to test result in on_exit

38 views
Skip to first unread message

Lars Vonk

unread,
Oct 16, 2017, 7:26:27 AM10/16/17
to elixir-lang-core
Hi,

I was looking for a way to access the test result of the failing test in the on_exit hook and found https://github.com/elixir-lang/elixir/issues/2969, but could not find any follow 
up.

What I am trying to achieve is to create a screenshot for each failing browser test (e.g. using Hound), this helps in trying to understand why a certain test failed. 

Basically this could look like:

setup context do

  on_exit
(context, fn ->
   
if context.test_failed
      take_screenshot
("./tmp/#{context.test}.png")
   
end
 
end

 
:ok
end


So this something you would consider, or is there already a way to implement this?

Thanks in advance,
Lars Vonk

José Valim

unread,
Oct 16, 2017, 8:01:50 AM10/16/17
to elixir-l...@googlegroups.com
Please open up an issue, we can definitely consider it. We may need to change some of the internals though if you want the failure reason in there.
--


José Valim
Founder and 
Director of R&D

Lars Vonk

unread,
Oct 16, 2017, 8:38:52 AM10/16/17
to elixir-lang-core
Thanks for the quick reply. Created https://github.com/elixir-lang/elixir/issues/6938

I do not see a reason for adding the failure reason (yet). Typically the assertion failure says enough. The screenshot just helps in assessing what the screen looked like during the failure.
Reply all
Reply to author
Forward
0 new messages