Commit a748f054 authored by drew cimino's avatar drew cimino

Detect skipped specs in JUnit reports and set TestCase status

parent 4000aba0
---
title: Detect skipped specs in JUnit reports and set TestCase status
merge_request: 28053
author:
type: fixed
...@@ -47,13 +47,16 @@ module Gitlab ...@@ -47,13 +47,16 @@ module Gitlab
end end
def create_test_case(data, args) def create_test_case(data, args)
if data['failure'] if data.key?('failure')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_FAILED status = ::Gitlab::Ci::Reports::TestCase::STATUS_FAILED
system_output = data['failure'] system_output = data['failure']
attachment = attachment_path(data['system_out']) attachment = attachment_path(data['system_out'])
elsif data['error'] elsif data.key?('error')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_ERROR status = ::Gitlab::Ci::Reports::TestCase::STATUS_ERROR
system_output = data['error'] system_output = data['error']
elsif data.key?('skipped')
status = ::Gitlab::Ci::Reports::TestCase::STATUS_SKIPPED
system_output = data['skipped']
else else
status = ::Gitlab::Ci::Reports::TestCase::STATUS_SUCCESS status = ::Gitlab::Ci::Reports::TestCase::STATUS_SUCCESS
system_output = nil system_output = nil
......
...@@ -104,6 +104,20 @@ describe Gitlab::Ci::Parsers::Test::Junit do ...@@ -104,6 +104,20 @@ describe Gitlab::Ci::Parsers::Test::Junit do
'Some error' 'Some error'
end 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 context 'and has an unknown type' do
let(:testcase_content) { '<foo>Some foo</foo>' } 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