We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrated from rt.cpan.org #128350 (status was 'new')
Requestors:
From [email protected] on 2019-01-25 07:58:28 :
Hi, Mr.Graham
Today @randomguy on stackoverflow.com asked me how to create skipped testcase using your TAP::Formatter::JUnit.
At first glance, I noticed your package haven't implemented SKIP directive function yet, so I created a patch to do the job. Please take a look.
TBH, I'm not familier with JUnit report XML and I couldn't even find its specification that I should refer. Let me know if I missed anything.
Thanks,
See also: https://metacpan.org/author/SKJM https://stackoverflow.com/questions/52953305/how-to-convert-a-generated-text-file-to-junit-formatxml-using-perl?noredirect=1#comment95534416_52953305
lib/TAP/Formatter/JUnit/Result.pm | 1 + lib/TAP/Formatter/JUnit/Session.pm | 13 +++++++++++++ t/data/tap/junit/skip | 5 ++++- t/data/tap/junit/skip_nomsg | 5 ++++- t/data/tests/junit/skip | 5 ++++- t/data/tests/junit/skip_nomsg | 5 ++++- 6 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/lib/TAP/Formatter/JUnit/Result.pm b/lib/TAP/Formatter/JUnit/Result.pm index 5803334..a95a585 100644 --- a/lib/TAP/Formatter/JUnit/Result.pm +++ b/lib/TAP/Formatter/JUnit/Result.pm @@ -23,6 +23,7 @@ has 'result' => ( is_plan is_unplanned is_ok
has_skip todo_passed explanation
diff --git a/lib/TAP/Formatter/JUnit/Session.pm b/lib/TAP/Formatter/JUnit/Session.pm index fb7dca3..33683e6 100644 --- a/lib/TAP/Formatter/JUnit/Session.pm +++ b/lib/TAP/Formatter/JUnit/Session.pm @@ -142,6 +142,12 @@ sub close_test { }, $cdata ); }
# create a skipped element if the test was skipped
my $skipped;
if ($result->has_skip()) {
$skipped = $xml->skipped();
}
# add this test to the XML stream my $case = $xml->testcase( {
@@ -151,6 +157,7 @@ sub close_test { ), }, $failure,
$skipped, ); $self->add_testcase($case);
@@ -203,6 +210,7 @@ sub close_test { my $testsrun = $parser->tests_run() || 0; my $time = $parser->end_time() - $parser->start_time(); my $failures = $parser->failed();
my $skipped = $parser->skipped() || 0;
my $noplan = $parser->plan() ? 0 : 1; my $planned = $parser->tests_planned() || 0; @@ -233,6 +241,9 @@ sub close_test { ( $timer_enabled ? ('time' => $time) : () ),
(
$skipped > 0 ? ('skipped' => $skipped) : ()
),
); my $testsuite = $xml->testsuite(%attrs, @tests, $sys_out, $sys_err, $suite_err); $self->formatter->add_testsuite($testsuite); @@ -283,6 +294,8 @@ sub _check_for_test_bogosity { my $self = shift; my $result = shift;
return if $result->has_skip();
if ($result->todo_passed() && !$self->passing_todo_ok()) { return { level => 'error', diff --git a/t/data/tap/junit/skip b/t/data/tap/junit/skip index 4ad97aa..761a3e0 100644 --- a/t/data/tap/junit/skip +++ b/t/data/tap/junit/skip @@ -1,10 +1,13 @@
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Migrated from rt.cpan.org #128350 (status was 'new')
Requestors:
From [email protected] on 2019-01-25 07:58:28
:
Signed-off-by: Shin Kojima [email protected]
Hi, Mr.Graham
Today @randomguy on stackoverflow.com asked me how to create skipped
testcase using your TAP::Formatter::JUnit.
At first glance, I noticed your package haven't implemented SKIP
directive function yet, so I created a patch to do the job.
Please take a look.
TBH, I'm not familier with JUnit report XML and I couldn't even find
its specification that I should refer.
Let me know if I missed anything.
Thanks,
See also:
https://metacpan.org/author/SKJM
https://stackoverflow.com/questions/52953305/how-to-convert-a-generated-text-file-to-junit-formatxml-using-perl?noredirect=1#comment95534416_52953305
lib/TAP/Formatter/JUnit/Result.pm | 1 +
lib/TAP/Formatter/JUnit/Session.pm | 13 +++++++++++++
t/data/tap/junit/skip | 5 ++++-
t/data/tap/junit/skip_nomsg | 5 ++++-
t/data/tests/junit/skip | 5 ++++-
t/data/tests/junit/skip_nomsg | 5 ++++-
6 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/lib/TAP/Formatter/JUnit/Result.pm b/lib/TAP/Formatter/JUnit/Result.pm
index 5803334..a95a585 100644
--- a/lib/TAP/Formatter/JUnit/Result.pm
+++ b/lib/TAP/Formatter/JUnit/Result.pm
@@ -23,6 +23,7 @@ has 'result' => (
is_plan
is_unplanned
is_ok
diff --git a/lib/TAP/Formatter/JUnit/Session.pm b/lib/TAP/Formatter/JUnit/Session.pm
index fb7dca3..33683e6 100644
--- a/lib/TAP/Formatter/JUnit/Session.pm
+++ b/lib/TAP/Formatter/JUnit/Session.pm
@@ -142,6 +142,12 @@ sub close_test {
}, $cdata );
}
@@ -151,6 +157,7 @@ sub close_test {
),
},
$failure,
@@ -203,6 +210,7 @@ sub close_test {
my $testsrun = $parser->tests_run() || 0;
my $time = $parser->end_time() - $parser->start_time();
my $failures = $parser->failed();
my $skipped = $parser->skipped() || 0;
my $noplan = $parser->plan() ? 0 : 1;
my $planned = $parser->tests_planned() || 0;
@@ -233,6 +241,9 @@ sub close_test {
(
$timer_enabled ? ('time' => $time) : ()
),
);
my $testsuite = $xml->testsuite(%attrs, @tests, $sys_out, $sys_err, $suite_err);
$self->formatter->add_testsuite($testsuite);
@@ -283,6 +294,8 @@ sub _check_for_test_bogosity {
my $self = shift;
my $result = shift;
return if $result->has_skip();
if ($result->todo_passed() && !$self->passing_todo_ok()) {
return {
level => 'error',
diff --git a/t/data/tap/junit/skip b/t/data/tap/junit/skip
index 4ad97aa..761a3e0 100644
--- a/t/data/tap/junit/skip
+++ b/t/data/tap/junit/skip
@@ -1,10 +1,13 @@
The text was updated successfully, but these errors were encountered: