How to use Eunit:test() generate a xml file which include some compling info

荒凉一梦 提交于 2019-12-12 02:08:18

问题


I have some erlang file(.erl).And I compile them. Now I want to use some function to generate a xml which is about the compling info of these files.

Here is a address, http://www.erlang.org/doc/apps/eunit/eunit.pdf

In this pdf,There is a function eunit:test/2 which can generate a xml file.

eunit:test([fib, eunit_examples], [{report,{eunit_surefire,[{dir,"."}]}}]).

But i don't know these parameters represent. I just know fib = modulename dir = generate location.What about eunit_examples? ,report? ,eunit_surefire?


回答1:


I'm not really sure this is the function you are looking for. Eunit is a testing framework, and thus the function

eunit:test(...).

will give you information about any testing functions you have written within the modules.


If indeed you are looking to generate reports on those tests, in XML format, you simply use the form:

eunit:test([MODULES], [{report, {eunit_surefire, [{dir, "."}]}}]).

where MODULES is a list of any modules you want to do testing of, and everything else stays the same (for example, fib and eunit_examples are the two modules that are being tested in the example you gave.)

The report atom says that you want to generate a report, and the eunit_surefire atom says what format to generate the report with. I'm not sure there are any other ways to generate the reports with XML besides using eunit_surefire.



来源:https://stackoverflow.com/questions/7720919/how-to-use-eunittest-generate-a-xml-file-which-include-some-compling-info

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!