diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index cf1fe07f3..7f953131a 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -5375,6 +5375,62 @@ def clamav(parser, xml_parent, data): data.get('excludes', '')) +def testselector(parser, xml_parent, data): + """yaml: testselector + This plugin allows you to choose specific tests you want to run. + + Requires the Jenkins :jenkins-wiki:`Tests Selector Plugin + `. + + :arg str name: Environment variable in which selected tests are saved + (required) + :arg str description: Description + (default "") + :arg str properties-file: Contain all your tests + (required) + :arg str enable-field: Imply if the test is enabled or not + (default "") + :arg str groupby: Plugin will group the tests by + (default "") + :arg str field-sperator: Separate between the fields in the tests tree + (default "") + :arg str show-fields: Shown in the tests tree + (default "") + :arg str multiplicity-field: Amount of times the test should run + (default "") + + Example: + + .. literalinclude:: /../../tests/publishers/fixtures/testselector001.yaml + :language: yaml + """ + + testselector = XML.SubElement(xml_parent, 'il.ac.technion.jenkins.plugins' + 'TestExecuter') + try: + name = str(data['name']) + except KeyError as e: + raise MissingAttributeError(e.args[0]) + try: + propertiesfile = str(data['properties-file']) + except KeyError as e: + raise MissingAttributeError(e.args[0]) + XML.SubElement(testselector, 'name').text = name + XML.SubElement(testselector, 'description').text = data.get( + 'description', '') + XML.SubElement(testselector, 'propertiesFilePath').text = propertiesfile + XML.SubElement(testselector, 'enableField').text = data.get( + 'enable-field', '') + XML.SubElement(testselector, 'groupBy').text = data.get( + 'groupby', '') + XML.SubElement(testselector, 'fieldSeparator').text = data.get( + 'field-separator', '') + XML.SubElement(testselector, 'showFields').text = data.get( + 'show-fields', '') + XML.SubElement(testselector, 'multiplicityField').text = data.get( + 'multiplicity-field', '') + + def cloudformation(parser, xml_parent, data): """yaml: cloudformation Create cloudformation stacks before running a build and optionally diff --git a/tests/publishers/fixtures/testselector001.xml b/tests/publishers/fixtures/testselector001.xml new file mode 100644 index 000000000..81e27a504 --- /dev/null +++ b/tests/publishers/fixtures/testselector001.xml @@ -0,0 +1,15 @@ + + + + + tests + integration + example.properties + enabled + testgroup + . + testsuite,testcase + multiplicity + + + diff --git a/tests/publishers/fixtures/testselector001.yaml b/tests/publishers/fixtures/testselector001.yaml new file mode 100644 index 000000000..3652f710d --- /dev/null +++ b/tests/publishers/fixtures/testselector001.yaml @@ -0,0 +1,10 @@ +publishers: + - testselector: + name: tests + description: integration + properties-file: example.properties + enable-field: enabled + groupby: testgroup + field-separator: . + show-fields: testsuite,testcase + multiplicity-field: multiplicity