Commit 980ae4af authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'parse-skipped-specs-from-junit-reports' into 'master'

Detect skipped specs in JUnit reports and set TestCase status

See merge request gitlab-org/gitlab!28053
parents 4000aba0 a748f054
---
title: Detect skipped specs in JUnit reports and set TestCase status
merge_request: 28053
author:
type: fixed
......@@ -47,13 +47,16 @@ module Gitlab
end
def create_test_case(data, args)
if data['failure']
if data.key?('failure')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_FAILED
system_output = data['failure']
attachment = attachment_path(data['system_out'])
elsif data['error']
elsif data.key?('error')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_ERROR
system_output = data['error']
elsif data.key?('skipped')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_SKIPPED
system_output = data['skipped']
else
status = ::Gitlab::Ci::Reports::TestCase::STATUS_SUCCESS
system_output = nil
......
......@@ -104,6 +104,20 @@ describe Gitlab::Ci::Parsers::Test::Junit do
'Some error'
end
context 'and has skipped' do
let(:testcase_content) { '<skipped/>' }
it_behaves_like '<testcase> XML parser',
::Gitlab::Ci::Reports::TestCase::STATUS_SKIPPED, nil
context 'with an empty double-tag' do
let(:testcase_content) { '<skipped></skipped>' }
it_behaves_like '<testcase> XML parser',
::Gitlab::Ci::Reports::TestCase::STATUS_SKIPPED, nil
end
end
context 'and has an unknown type' do
let(:testcase_content) { '<foo>Some foo</foo>' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment