如何使用Eunit:test()生成一个xml文件,其中包含一些编译信息 [英] How to use Eunit:test() generate a xml file which include some compling info
问题描述
我有一些erlang文件(.erl),然后编译它们.现在,我想使用一些函数来生成一个有关这些文件的编译信息的xml.
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.
这里是地址, http://www.erlang.org/doc/apps/eunit/eunit.pdf
在此pdf文件中,有一个函数eunit:test/2可以生成xml文件.
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,."}]}}]]).
eunit:test([fib, eunit_examples], [{report,{eunit_surefire,[{dir,"."}]}}]).
但是我不知道这些参数代表什么.我只知道fib = modulename dir =生成位置.eunit_examples?,report?,eunit_surefire是什么?
But i don't know these parameters represent. I just know fib = modulename dir = generate location.What about eunit_examples? ,report? ,eunit_surefire?
推荐答案
我不太确定这是您要寻找的功能. Eunit是一个测试框架,因此是功能
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.
如果确实希望以XML格式生成有关这些测试的报告,则只需使用以下格式:
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, "."}]}}]).
其中,MODULES
是您要测试的所有模块的列表,其他所有内容都保持不变(例如,fib
和eunit_examples
是您提供的示例中正在测试的两个模块) )
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.)
report
原子表示您要生成报告,而eunit_surefire
原子表示生成报告所采用的格式.除了使用eunit_surefire
之外,我不确定是否还有其他方法可以使用XML生成报告.
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
.
这篇关于如何使用Eunit:test()生成一个xml文件,其中包含一些编译信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!