class TestKeywordTable(unittest.TestCase):

    def setUp(self):
        self.table = TestCaseFile().keyword_table
        self.kw = UserKeyword(None, 'name')

    def test_init(self):
        assert_equal(self.table.keywords, [])

    def test_add_keyword(self):
        kw = self.table.add('My name')
        assert_true(len(self.table.keywords), 1)
        assert_true(self.table.keywords[0] is kw)
        assert_equal(kw.name, 'My name')

    def test_settings(self):
        assert_true(isinstance(self.kw.doc, Documentation))
        assert_true(isinstance(self.kw.args, Arguments))
        assert_true(isinstance(self.kw.return_, Return))
        assert_true(isinstance(self.kw.timeout, Timeout))
        assert_true(isinstance(self.kw.teardown, Fixture))

    def test_set_settings(self):
        self.kw.doc.populate('My coooool doc')
        self.kw.args.populate(['${args}', 'are not', 'validated'])
        assert_equal(self.kw.doc.value, 'My coooool doc')
        assert_equal(self.kw.args.value, ['${args}', 'are not', 'validated'])

    def test_add_step(self):
        step = self.kw.add_step(['Keyword', 'arg1', 'arg2'])
        assert_equal(self.kw.steps, [step])
        assert_equal(step.name, 'Keyword')
        assert_equal(step.args, ['arg1', 'arg2'])

    def test_add_for_loop(self):
        loop = self.kw.add_for_loop(['${var}', 'IN', 'value'])
        assert_equal(self.kw.steps, [loop])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['keywords', 'Action', 'Arg', 'Argument'])
        assert_equal(self.table.header, ['keywords'])

    def test_len(self):
        self.table.set_header(['Keywords'])
        assert_equal(len(self.table), 0)
        self.table.add('A kw')
        self.table.add('B keyword')
        assert_equal(len(self.table), 2)
class TestTestCaseTable(unittest.TestCase):

    def setUp(self):
        self.table = TestCaseFile().testcase_table
        self.test = TestCase(None, 'name')

    def test_init(self):
        assert_equal(self.table.tests, [])

    def test_add_test(self):
        test = self.table.add('My name')
        assert_true(len(self.table.tests), 1)
        assert_true(self.table.tests[0] is test)
        assert_equal(test.name, 'My name')

    def test_settings(self):
        assert_true(isinstance(self.test.doc, Documentation))
        assert_true(isinstance(self.test.tags, Tags))
        assert_true(isinstance(self.test.setup, Fixture))
        assert_true(isinstance(self.test.teardown, Fixture))
        assert_true(isinstance(self.test.timeout, Timeout))

    def test_set_settings(self):
        self.test.doc.populate('My coooool doc')
        self.test.tags.populate(['My', 'coooool', 'tags'])
        assert_equal(self.test.doc.value, 'My coooool doc')
        assert_equal(self.test.tags.value, ['My', 'coooool', 'tags'])

    def test_add_step(self):
        step = self.test.add_step(['Keyword', 'arg1', 'arg2'])
        assert_equal(self.test.steps, [step])
        assert_equal(step.name, 'Keyword')
        assert_equal(step.args, ['arg1', 'arg2'])

    def test_add_for_loop(self):
        loop = self.test.add_for_loop(['${var}', 'IN', 'value'])
        assert_equal(self.test.steps, [loop])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['test case', 'Action', 'Arg', 'Argument'])
        assert_equal(self.table.header, ['test case'])

    def test_len(self):
        self.table.set_header(['Test Case'])
        assert_equal(len(self.table), 0)
        self.table.add('A test')
        self.table.add('B test')
        assert_equal(len(self.table), 2)
示例#3
0
class TestKeywordTable(unittest.TestCase):

    def setUp(self):
        self.table = TestCaseFile().keyword_table
        self.kw = UserKeyword(None, 'name')

    def test_init(self):
        assert_equal(self.table.keywords, [])

    def test_add_keyword(self):
        kw = self.table.add('My name')
        assert_true(len(self.table.keywords), 1)
        assert_true(self.table.keywords[0] is kw)
        assert_equal(kw.name, 'My name')

    def test_settings(self):
        assert_true(isinstance(self.kw.doc, Documentation))
        assert_true(isinstance(self.kw.args, Arguments))
        assert_true(isinstance(self.kw.return_, Return))
        assert_true(isinstance(self.kw.timeout, Timeout))
        assert_true(isinstance(self.kw.teardown, Fixture))

    def test_set_settings(self):
        self.kw.doc.populate('My coooool doc')
        self.kw.args.populate(['${args}', 'are not', 'validated'])
        assert_equal(self.kw.doc.value, 'My coooool doc')
        assert_equal(self.kw.args.value, ['${args}', 'are not', 'validated'])

    def test_add_step(self):
        step = self.kw.add_step(['Keyword', 'arg1', 'arg2'])
        assert_equal(self.kw.steps, [step])
        assert_equal(step.name, 'Keyword')
        assert_equal(step.args, ['arg1', 'arg2'])

    def test_add_for_loop(self):
        loop = self.kw.add_for_loop(['${var}', 'IN', 'value'])
        assert_equal(self.kw.steps, [loop])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['keywords', 'Action', 'Arg', 'Argument'])
        assert_equal(self.table.header, ['keywords'])

    def test_len(self):
        self.table.set_header(['Keywords'])
        assert_equal(len(self.table), 0)
        self.table.add('A kw')
        self.table.add('B keyword')
        assert_equal(len(self.table), 2)
示例#4
0
class TestTestCaseTable(unittest.TestCase):

    def setUp(self):
        self.table = TestCaseFile().testcase_table
        self.test = TestCase(None, 'name')

    def test_init(self):
        assert_equal(self.table.tests, [])

    def test_add_test(self):
        test = self.table.add('My name')
        assert_true(len(self.table.tests), 1)
        assert_true(self.table.tests[0] is test)
        assert_equal(test.name, 'My name')

    def test_settings(self):
        assert_true(isinstance(self.test.doc, Documentation))
        assert_true(isinstance(self.test.tags, Tags))
        assert_true(isinstance(self.test.setup, Fixture))
        assert_true(isinstance(self.test.teardown, Fixture))
        assert_true(isinstance(self.test.timeout, Timeout))

    def test_set_settings(self):
        self.test.doc.populate('My coooool doc')
        self.test.tags.populate(['My', 'coooool', 'tags'])
        assert_equal(self.test.doc.value, 'My coooool doc')
        assert_equal(self.test.tags.value, ['My', 'coooool', 'tags'])

    def test_add_step(self):
        step = self.test.add_step(['Keyword', 'arg1', 'arg2'])
        assert_equal(self.test.steps, [step])
        assert_equal(step.name, 'Keyword')
        assert_equal(step.args, ['arg1', 'arg2'])

    def test_add_for_loop(self):
        loop = self.test.add_for_loop(['${var}', 'IN', 'value'])
        assert_equal(self.test.steps, [loop])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['test case', 'Action', 'Arg', 'Argument'])
        assert_equal(self.table.header, ['test case'])

    def test_len(self):
        self.table.set_header(['Test Case'])
        assert_equal(len(self.table), 0)
        self.table.add('A test')
        self.table.add('B test')
        assert_equal(len(self.table), 2)
示例#5
0
class TestVariableTable(unittest.TestCase):
    def setUp(self):
        self.table = TestCaseFile().variable_table

    def test_init(self):
        assert_equal(self.table.variables, [])

    def test_add_variables(self):
        self.table.add('${SCALAR}', ['hello'])
        self.table.add('${S2} =', 'hello as string')
        self.table.add('@{LIST}', ['hello', 'world'])
        assert_equal(len(self.table.variables), 3)
        assert_equal(self.table.variables[0].name, '${SCALAR}')
        assert_equal(self.table.variables[0].value, ['hello'])
        assert_equal(self.table.variables[1].name, '${S2}')
        assert_equal(self.table.variables[1].value, ['hello as string'])
        assert_equal(self.table.variables[2].name, '@{LIST}')
        assert_equal(self.table.variables[2].value, ['hello', 'world'])

    def test_empty_value(self):
        self.table.add('${V1}', [])
        self.table.add('${V2}', '')
        assert_equal(self.table.variables[0].value, [''])
        assert_equal(self.table.variables[1].value, [''])

    def test_variable_syntax_is_not_verified(self):
        self.table.add('not var', 'the value')
        assert_equal(self.table.variables[0].name, 'not var')
        assert_equal(self.table.variables[0].value, ['the value'])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['Variable', 'value', 'Value'])
        assert_equal(self.table.header, ['Variable'])

    def test_len(self):
        self.table.set_header(['Variable', 'value', 'Value'])
        assert_equal(len(self.table), 0)
        self.table.add('${a var}', 'some')
        self.table.add('@{b var}', 's', 'ome')
        assert_equal(len(self.table), 2)
class TestVariableTable(unittest.TestCase):

    def setUp(self):
        self.table = TestCaseFile().variable_table

    def test_init(self):
        assert_equal(self.table.variables, [])

    def test_add_variables(self):
        self.table.add('${SCALAR}', ['hello'])
        self.table.add('${S2} =', 'hello as string')
        self.table.add('@{LIST}', ['hello', 'world'])
        assert_equal(len(self.table.variables), 3)
        assert_equal(self.table.variables[0].name, '${SCALAR}')
        assert_equal(self.table.variables[0].value, ['hello'])
        assert_equal(self.table.variables[1].name, '${S2}')
        assert_equal(self.table.variables[1].value, ['hello as string'])
        assert_equal(self.table.variables[2].name, '@{LIST}')
        assert_equal(self.table.variables[2].value, ['hello', 'world'])

    def test_empty_value(self):
        self.table.add('${V1}', [])
        self.table.add('${V2}', '')
        assert_equal(self.table.variables[0].value, [''])
        assert_equal(self.table.variables[1].value, [''])

    def test_variable_syntax_is_not_verified(self):
        self.table.add('not var', 'the value')
        assert_equal(self.table.variables[0].name, 'not var')
        assert_equal(self.table.variables[0].value, ['the value'])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['Variable', 'value', 'Value'])
        assert_equal(self.table.header, ['Variable'])

    def test_len(self):
        self.table.set_header(['Variable', 'value', 'Value'])
        assert_equal(len(self.table), 0)
        self.table.add('${a var}', 'some')
        self.table.add('@{b var}', 's', 'ome')
        assert_equal(len(self.table), 2)