コード例 #1
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'])
コード例 #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']])
コード例 #3
0
 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])
コード例 #4
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_equal(list(extractor._rows_from_indented_table(table)),
                   [['Test', 'No op']])
コード例 #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])
コード例 #6
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])
コード例 #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
コード例 #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
コード例 #9
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
コード例 #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):
コード例 #11
0
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'],
                   [],
                   ['Second test'],
コード例 #12
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_equal(self._formatter.format_header(table),
                  ['*** test case *** ', 'cus \\ tom   ', 'header'])