def test_names_on_first_content_row(self):
     table = TestCaseTable(None)
     t = table.add('Test')
     t.add_step(['No op'])
     extractor = DataExtractor(lambda t,n: True)
     assert_equal(list(extractor._rows_from_indented_table(table)),
                   [['Test', 'No op']])
Ejemplo n.º 2
0
 def test_names_on_first_content_row(self):
     table = TestCaseTable(None)
     t = table.add('Test')
     t.add_step(['No op'])
     extractor = DataExtractor(lambda t, n: True)
     assert_equals(list(extractor._rows_from_indented_table(table)),
                   [['Test', 'No op']])
 def test_counting_column_widths(self):
     table = TestCaseTable(None)
     table.set_header(['test cases', 'col header', 'short'])
     assert_equal(ColumnAligner(18, table)._widths, [18, 10, 5])
     test = table.add('A test')
     test.add_step(['Some kw', 'a longer arg', 'another']    )
     assert_equal(ColumnAligner(18, table)._widths, [18, 10, 12, 7])
Ejemplo n.º 4
0
 def test_counting_column_widths(self):
     table = TestCaseTable(None)
     table.set_header(['test cases', 'col header', 'short'])
     assert_equals(ColumnAligner(18, table)._widths, [18, 10, 5])
     test = table.add('A test')
     test.add_step(['Some kw', 'a longer arg', 'another'])
     assert_equals(ColumnAligner(18, table)._widths, [18, 10, 12, 7])
Ejemplo n.º 5
0
 def test_counting_column_widths(self):
     table = TestCaseTable(None)
     table.set_header(["test cases", "col header", "short"])
     assert_equals(ColumnAligner(18, table)._widths, [18, 10, 5])
     test = table.add("A test")
     test.add_step(["Some kw", "a longer arg", "another"])
     assert_equals(ColumnAligner(18, table)._widths, [18, 10, 12, 7])
def create_test_case_file():
    data = TestCaseFile(source='foo.txt')
    table = TestCaseTable(data)
    data.testcase_table = table
    table.set_header(['test case', 'some', 'and other'])
    test = table.add('A test')
    test.add_step(['A kw', 'an arg'])
    return data
Ejemplo n.º 7
0
def create_test_case_file():
    data = TestCaseFile(source="foo.txt")
    table = TestCaseTable(data)
    data.testcase_table = table
    table.set_header(["test case", "some", "and other"])
    test = table.add("A test")
    test.add_step(["A kw", "an arg"])
    return data
Ejemplo n.º 8
0
def create_test_case_file():
    data = TestCaseFile(source='foo.txt')
    table = TestCaseTable(data)
    data.testcase_table = table
    table.set_header(['test case', 'some', 'and other'])
    test = table.add('A test')
    test.add_step(['A kw', 'an arg'])
    return data
Ejemplo n.º 9
0
 def test_aligned_header_cells_are_not_escaped(self):
     table = TestCaseTable(None)
     table.set_header(['test case', 'cus  tom', 'header'])
     table.add('Test case with a long name').add_step(
         ['keyword here', 'args'])
     assert_equals(self._formatter.format_header(table),
                   ['*** test case *** ', 'cus \\ tom   ', 'header'])
Ejemplo n.º 10
0
import unittest

from robot.parsing.model import VariableTable, TestCaseTable
from robot.utils.asserts import assert_equals
from robot.writer.dataextractor import DataExtractor

var_table = VariableTable(None)
var_table.add('${A scalar}', 'value', 'var comment')
var_table.add('', '', 'standalone comment')
var_table.add('@{A list}', ['v', 'a', 'lue'])

var_table_rows = [['${A scalar}', 'value', '# var comment'],
                  ['# standalone comment'], ['@{A list}', 'v', 'a', 'lue']]

test_table = TestCaseTable(None)
test = test_table.add('A test case')
test.add_step(['No Operation'])
test.add_step(['Log Many', 'bar', 'quux', '#comment'])
loop = test.add_for_loop(['${i}', 'IN RANGE', '10'])
loop.add_step(['Log', '${i}'])
test2 = test_table.add('Second test')
test2.add_step(['FAIL'])

test_table_rows = [['A test case'], ['', 'No Operation'],
                   ['', 'Log Many', 'bar', 'quux', '#comment'],
                   ['', ': FOR', '${i}', 'IN RANGE', '10'],
                   ['', '', 'Log', '${i}'], [], ['Second test'], ['', 'FAIL'],
                   []]


class DataExtractorTest(unittest.TestCase):
Ejemplo n.º 11
0
import unittest

from robot.parsing.model import VariableTable, TestCaseTable
from robot.utils.asserts import assert_equal
from robot.writer.dataextractor import DataExtractor

var_table = VariableTable(None)
var_table.add('${A scalar}', 'value', 'var comment')
var_table.add('', '', 'standalone comment')
var_table.add('@{A list}', ['v', 'a', 'lue'])

var_table_rows = [['${A scalar}', 'value', '# var comment'],
                  ['# standalone comment'],
                  ['@{A list}', 'v', 'a', 'lue']]

test_table = TestCaseTable(None)
test = test_table.add('A test case')
test.add_step(['No Operation'])
test.add_step(['Log Many', 'bar', 'quux', '#comment'])
loop = test.add_for_loop(['${i}', 'IN RANGE', '10'])
loop.add_step(['Log', '${i}'])
test2 = test_table.add('Second test')
test2.add_step(['FAIL'])

test_table_rows = [['A test case'],
                   ['', 'No Operation'],
                   ['', 'Log Many', 'bar', 'quux', '#comment'],
                   ['', 'FOR', '${i}', 'IN RANGE', '10'],
                   ['', '', 'Log', '${i}'],
                   ['', 'END'],
                   [],
Ejemplo n.º 12
0
 def _create_test_table(self, additional_headers=()):
     table = TestCaseTable(None)
     table.set_header(['Test Cases'] + list(additional_headers))
     return table
Ejemplo n.º 13
0
 def _create_test(self):
     test = TestCase(TestCaseTable(None), 'Test name')
     test.tags = Tags('Force Tags')
     test.tags.value = ['1', '2', '3']
     test.add_step(['Log', 'Foo'])
     return test
 def test_aligned_header_cells_are_not_escaped(self):
     table = TestCaseTable(None)
     table.set_header(['test case', 'cus  tom',  'header'])
     table.add('Test case with a long name').add_step(['keyword here', 'args'])
     assert_equal(self._formatter.format_header(table),
                  ['*** test case *** ', 'cus \\ tom   ', 'header'])
 def _create_test_table(self, additional_headers=()):
     table = TestCaseTable(None)
     table.set_header(['Test Cases'] + list(additional_headers))
     return table