victorolinasc / junit-formatter

A JUnit XML report exporter for Elixir's ExUnit
https://hexdocs.pm/junit_formatter/
Apache License 2.0
111 stars 37 forks source link

JUnitFormatter is not used by ExUnit #21

Closed philippneugebauer closed 7 years ago

philippneugebauer commented 7 years ago

After following your Readme instructions, I still cannot get it working.

I additionally added JUnitFormatter to my mix file as in the following, but I always have the same output as before.

  defp deps do
    [
      {:junit_formatter, "~> 1.3", only: [:test]}
    ]
  end
MIX_ENV=test mix test
.............................

Finished in 0.09 seconds
29 tests, 0 failures

Randomized with seed 230960

Am I missing an essential point I just have overlooked?

cs-victor-nascimento commented 7 years ago

Hi @philippneugebauer!

The console output will not change. What will change is that after your runs an XML file will be produced in the _build directory of your project.

Check whether there is an xml file there. I'll leave this open until you reply back.

philippneugebauer commented 7 years ago

You're right. I just thought, that your output differed from mine and expected to get a feedback line in the beginning.

What do you think about changing your readme from:

Compiled lib/formatter.ex
Generated junit_formatter app
....

Finished in 0.1 seconds (0.07s on load, 0.08s on tests)
4 tests, 0 failures

Randomized with seed 600810

to

....

Finished in 0.1 seconds (0.07s on load, 0.08s on tests)
4 tests, 0 failures

Randomized with seed 600810

since that's what I actually get and why I was confused and expecting another output?

cs-victor-nascimento commented 7 years ago

I'm ok with that.

The compiled message will be shown in the first run of your tests if you did not call MIX_ENV=test mix deps.compile. Mix will compile deps per environment in the first run. So that's why I thought it would not be an issue.

If you think that omitting the compilation logs helps, I'll accept a PR.

philippneugebauer commented 7 years ago

I am not pretty sure anymore. Probably, I was more confused about the /tmp folder of the output where I have overlooked the /. I guess it's more intuitive, when the given output folder is inside your project folder, isn't it?

cs-victor-nascimento commented 7 years ago

In my opinion it should always be inside your project's build dir. That way it will be cleaned up automatically by mix with mix clean, it will not collide with other projects and things like that. If you want to generate the report in an outside directory, then I think you should guarantee the folder exists prior to running your tests.

philippneugebauer commented 7 years ago

I just agree and that's why I proposed the change. Your example configuration of the README led to the creation of the report in /tmp/ instead of /project/dir/tmp/:

config :junit_formatter,
  report_file: "report_file_test.xml",
  report_dir: "/tmp",
  print_report_file: true

So I proposed to remove the leading / to fix this issue.

cs-victor-nascimento commented 7 years ago

That is just to show that the option exists (it was actually requested by someone through an issue).

If the dir is there, it should work. Though it may be worth to mention it is not needed in the default configuration.

cs-victor-nascimento commented 7 years ago

Closing this as there is nothing to be done here. Please fell free to re-open if the discussion is not done.