Example #1
0
class TestStep(IterAttachmentsMixin,
               xmlfied('step',
                       name=Element(),
                       title=Element().if_(lambda x: x),
                       attachments=WrappedMany(Nested()),
                       steps=WrappedMany(Nested()),
                       start=Attribute(),
                       stop=Attribute(),
                       status=Attribute())):
    pass
Example #2
0
class TestSuite(
        xmlfied('test-suite',
                namespace=ALLURE_NAMESPACE,
                name=Element(),
                title=Element().if_(lambda x: x),
                description=Element().if_(lambda x: x),
                tests=WrappedMany(Nested(), name='test-cases'),
                labels=WrappedMany(Nested()),
                start=Attribute(),
                stop=Attribute())):
    pass
Example #3
0
class TestCase(
        IterAttachmentsMixin,
        xmlfied(
            'test-case',
            id=Ignored(),  # internal field, see AllureTestListener
            name=Element(),
            title=Element().if_(lambda x: x),
            description=Element().if_(lambda x: x),
            failure=Nested().if_(lambda x: x),
            steps=WrappedMany(Nested()),
            attachments=WrappedMany(Nested()),
            labels=WrappedMany(Nested()),
            status=Attribute(),
            start=Attribute(),
            stop=Attribute())):
    pass
Example #4
0
def test_many_elements():
    Box = xmlfied('box', foos=WrappedMany(Element(name='foo')))

    box = Box(foos=['a', 'b', 'c'])

    assert_that(get_xml_string(box.toxml()), all_of(
        string_contains_in_order('<box>', '<foos>', '<foo>', 'a', '</foo>', '</foos>', '</box>'),
        string_contains_in_order('<box>', '<foos>', '<foo>', 'b', '</foo>', '</foos>', '</box>'),
        string_contains_in_order('<box>', '<foos>', '<foo>', 'c', '</foo>', '</foos>', '</box>')
    ))
Example #5
0
def test_many_nested():
    Item = xmlfied('item', value=Element())
    Box = xmlfied('box', items=WrappedMany(Nested()))

    box = Box(items=[])
    box.items.append(Item('a'))
    box.items.append(Item('a'))
    box.items.append(Item('a'))

    assert_that(
        etree.tostring(box.toxml()),
        all_of(
            string_contains_in_order('<box>', '<items>', '<item>', 'a',
                                     '</item>', '<item>', 'a', '</item>',
                                     '<item>', 'a', '</item>', '</items>',
                                     '</box>'), ))
Example #6
0
from allure.rules import xmlfied, Attribute, Element, WrappedMany, Nested, Many
from allure.constants import ALLURE_NAMESPACE, COMMON_NAMESPACE

Attach = xmlfied('attachment',
                 source=Attribute(),
                 title=Attribute(),
                 type=Attribute())

Failure = xmlfied('failure', message=Element(), trace=Element('stack-trace'))

TestCase = xmlfied('test-case',
                   name=Element(),
                   title=Element().if_(lambda x: x),
                   description=Element().if_(lambda x: x),
                   failure=Nested().if_(lambda x: x),
                   steps=WrappedMany(Nested()),
                   attachments=WrappedMany(Nested()),
                   labels=WrappedMany(Nested()),
                   status=Attribute(),
                   start=Attribute(),
                   stop=Attribute())

TestSuite = xmlfied('test-suite',
                    namespace=ALLURE_NAMESPACE,
                    name=Element(),
                    title=Element().if_(lambda x: x),
                    description=Element().if_(lambda x: x),
                    tests=WrappedMany(Nested(), name='test-cases'),
                    labels=WrappedMany(Nested()),
                    start=Attribute(),
                    stop=Attribute())