aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Amsenius <[email protected]>2012-10-18 10:26:26 +0200
committerRichard Carlsson <[email protected]>2014-12-21 22:18:27 +0100
commit783a9ff7515c45fe6ca91d55600c33c6727d4b61 (patch)
treeb9dac72c7a2f341661097e37e1339b6fdd113887
parentd306a3a99907adbdd5419090df2781c2773acf1b (diff)
downloadotp-783a9ff7515c45fe6ca91d55600c33c6727d4b61.tar.gz
otp-783a9ff7515c45fe6ca91d55600c33c6727d4b61.tar.bz2
otp-783a9ff7515c45fe6ca91d55600c33c6727d4b61.zip
Improve surefire xml <testcase> element
Remove the 'description' attribute. It is not generated by Apache Ant or Maven Surefire and probably ignored by all other Surefire tools. Confirmed for Jenkins. Add testcase description (if there is one) to the 'name' attribute. Change format of 'name' attribute to look more like the output from running eunit with verbose. Line number and arity was quite obscure and arity is not useful as it is always 0.
-rw-r--r--lib/eunit/src/eunit_surefire.erl11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/eunit/src/eunit_surefire.erl b/lib/eunit/src/eunit_surefire.erl
index 2d1f0b1497..c0931588ae 100644
--- a/lib/eunit/src/eunit_surefire.erl
+++ b/lib/eunit/src/eunit_surefire.erl
@@ -203,9 +203,9 @@ handle_cancel(test, Data, St) ->
testcases=[TestCase|TestSuite#testsuite.testcases] },
St#state{testsuites=store_suite(NewTestSuite, TestSuites)}.
-format_name({Module, Function, Arity}, Line) ->
- lists:flatten([atom_to_list(Module), ":", atom_to_list(Function), "/",
- integer_to_list(Arity), "_", integer_to_list(Line)]).
+format_name({Module, Function, _Arity}, Line) ->
+ lists:flatten([atom_to_list(Module), ":", integer_to_list(Line), " ",
+ atom_to_list(Function)]).
format_desc(undefined) ->
"";
format_desc(Desc) when is_binary(Desc) ->
@@ -334,12 +334,11 @@ write_testcase(
FileDescriptor) ->
DescriptionAttr = case Description of
[] -> [];
- _ -> [<<" description=\"">>, escape_attr(Description), <<"\"">>]
+ _ -> [<<" (">>, escape_attr(Description), <<")">>]
end,
StartTag = [
?INDENT, <<"<testcase time=\"">>, format_time(Time),
- <<"\" name=\"">>, escape_attr(Name), <<"\"">>,
- DescriptionAttr],
+ <<"\" name=\"">>, escape_attr(Name), DescriptionAttr, <<"\"">>],
ContentAndEndTag = case {Result, Output} of
{ok, <<>>} -> [<<"/>">>, ?NEWLINE];
_ -> [<<">">>, ?NEWLINE, format_testcase_result(Result), format_testcase_output(Output), ?INDENT, <<"</testcase>">>, ?NEWLINE]