예제 #1
0
 def test_comment(self):
     self.test.execute(ChangeCellValue(0, 0, self.keyword1.name))
     self.test.execute(ChangeCellValue(0, 1, '# I have something to say'))
     self.test.execute(ChangeCellValue(0, 2, 'to you my friend'))
     self._verify_cell_info(0, 0, ContentType.USER_KEYWORD, CellType.KEYWORD)
     self._verify_cell_info(0, 1, ContentType.COMMENTED, CellType.MANDATORY)
     self._verify_cell_info(0, 2, ContentType.COMMENTED, CellType.OPTIONAL)
예제 #2
0
 def test_variable_is_known_when_defining_it(self):
     self.test.execute(ChangeCellValue(0, 0, '${var}='))
     self.test.execute(ChangeCellValue(0, 1, 'Set Variable'))
     self.test.execute(ChangeCellValue(0, 2, '${var}'))
     self._verify_cell_info(0, 0, ContentType.VARIABLE, CellType.ASSIGN)
     self._verify_cell_info(0, 2, ContentType.UNKNOWN_VARIABLE,
                            CellType.OPTIONAL)
예제 #3
0
 def test_new_for_loop_with_existing_comment(self):
     test = self.project.datafiles[1].tests[16]
     test.execute(ChangeCellValue(0, 0, 'FOR'))
     test.execute(ChangeCellValue(0, 2, '# comment'))  #idented comments del
     self.assertEqual(test.steps[0].as_list(), ['FOR', '', '# comment'])
     test.execute(DeleteCell(0, 0))
     self.assertEqual(test.steps[0].as_list(), ['', '# comment'])
예제 #4
0
 def test_variable_setting(self):
     self.test.execute(ChangeCellValue(0, 0, '${my cool var}='))
     self._verify_cell_info(0, 0, ContentType.VARIABLE, CellType.ASSIGN)
     self.test.execute(ChangeCellValue(0, 1, 'Set Variable'))
     self._verify_cell_info(0, 1, ContentType.LIBRARY_KEYWORD,
                            CellType.KEYWORD)
     self._verify_string_change(0, 2, CellType.OPTIONAL)
예제 #5
0
 def test_celltype_is_unknown_if_dict_var_given(self):
     self.test.execute(ChangeCellValue(0, 0, self.keyword1.name))
     self.test.execute(ChangeCellValue(0, 1, '&{vars}'))
     self._verify_cell_info(0, 0, ContentType.USER_KEYWORD, CellType.KEYWORD)
     self._verify_cell_info(0, 1, ContentType.UNKNOWN_VARIABLE, CellType.UNKNOWN)
     self._verify_cell_info(0, 2, ContentType.EMPTY, CellType.UNKNOWN)
     self._verify_cell_info(0, 3, ContentType.EMPTY, CellType.UNKNOWN)
예제 #6
0
 def test_new_for_loop(self):
     test = self.project.datafiles[1].tests[10]
     test.execute(ChangeCellValue(0, 0, 'FOR'))
     test.execute(ChangeCellValue(0, 1, '${i}'))
     test.execute(ChangeCellValue(0, 2, 'IN RANGE'))
     test.execute(ChangeCellValue(0, 3, '100'))
     self.assertEqual(test.steps[0].as_list(), ['FOR', '${i}', 'IN RANGE', '100'])
     self.assertEqual(type(test.steps[0]), ForLoopStepController)
예제 #7
0
 def test_adding_comment(self):
     test = self.project.datafiles[1].tests[14]
     test.execute(ChangeCellValue(1, 2, '#UnChanged comment'))
     self.assertEqual(test.steps[1].as_list(), ['', 'No Operation', '#UnChanged comment'])
     test.execute(ChangeCellValue(1, 2, '# comment UnChanged'))
     self.assertEqual(test.steps[1].as_list(), ['', 'No Operation', '# comment UnChanged'])
     test.execute(ChangeCellValue(1, 2, '##comment UnChanged'))
     self.assertEqual(test.steps[1].as_list(), ['', 'No Operation', '##comment UnChanged'])
예제 #8
0
 def test_comment_keyword(self):
     self.test.execute(ChangeCellValue(0, 0, 'I have nothing to say'))
     self.test.execute(ChangeCellValue(0, 1, 'to the void of darkness'))
     self.test.step(0).comment()
     self._verify_cell_info(0, 0, ContentType.LIBRARY_KEYWORD, CellType.KEYWORD)
     self._verify_cell_info(0, 1, ContentType.COMMENTED, CellType.OPTIONAL)
     self._verify_cell_info(0, 2, ContentType.COMMENTED, CellType.OPTIONAL)
     self._verify_cell_info(0, 3, ContentType.COMMENTED, CellType.OPTIONAL)
 def setUp(self):
     self.res_path = datafilereader.SIMPLE_TEST_SUITE_PATH
     self.res_name = 'new_resource_for_test_creating_and_importing_resource.txt'
     self.res_full_name = os.path.join(self.res_path, self.res_name)
     self.new_keyword_name = 'My Keywordian'
     self.ctrl = datafilereader.construct_project(
         datafilereader.SIMPLE_TEST_SUITE_PATH)
     self.suite = datafilereader.get_ctrl_by_name('TestSuite1',
                                                  self.ctrl.datafiles)
     self.test = self.suite.tests[0]
     self.test.execute(ChangeCellValue(0, 0, self.new_keyword_name))
     self.test.execute(ChangeCellValue(0, 1, 'value'))
예제 #10
0
 def test_keyword_with_optional_and_list_arguments(self):
     self.test.execute(ChangeCellValue(0, 0, self.keyword4.name))
     self._verify_cell_info(0, 0, ContentType.USER_KEYWORD, CellType.KEYWORD)
     self._verify_string_change(0, 1, CellType.OPTIONAL)
     self._verify_string_change(0, 2, CellType.OPTIONAL)
     self._verify_string_change(0, 3, CellType.OPTIONAL)
     self._verify_string_change(0, 4, CellType.OPTIONAL)
예제 #11
0
 def test_keyword_with_varargs(self):
     self.test.execute(ChangeCellValue(0, 0, self.keyword2.name))
     self._verify_cell_info(0, 0, ContentType.USER_KEYWORD,
                            CellType.KEYWORD)
     self._verify_string_change(0, 1, CellType.OPTIONAL)
     self._verify_string_change(0, 2, CellType.OPTIONAL)
     self._verify_string_change(0, 3, CellType.OPTIONAL)
예제 #12
0
 def test_keyword_with_mandatory_and_optional_arguments(self):
     self.test.execute(ChangeCellValue(0, 0, self.keyword1.name))
     self._verify_cell_info(0, 0, ContentType.USER_KEYWORD,
                            CellType.KEYWORD)
     self._verify_string_change(0, 1, CellType.MANDATORY)
     self._verify_string_change(0, 2, CellType.OPTIONAL)
     self._verify_string_change(0, 3, CellType.MUST_BE_EMPTY)
예제 #13
0
 def test_known_extended_variable_syntax(self):
     self.test.execute(ChangeCellValue(0, 0, '${var}='))
     self.test.execute(ChangeCellValue(0, 1, 'Set Variable'))
     self.test.execute(ChangeCellValue(0, 2, 'something'))
     self.test.execute(ChangeCellValue(1, 0, 'log'))
     self.test.execute(ChangeCellValue(1, 2, '${var.lower()}'))
     self.test.execute(ChangeCellValue(2, 0, 'log'))
     self.test.execute(ChangeCellValue(2, 2, '${var+"moi"}'))
     self.test.execute(ChangeCellValue(3, 0, 'log'))
     self.test.execute(ChangeCellValue(3, 2, '${var[1:]}'))
     self._verify_cell_info(1, 2, ContentType.VARIABLE, CellType.OPTIONAL)
     self._verify_cell_info(2, 2, ContentType.VARIABLE, CellType.OPTIONAL)
     self._verify_cell_info(3, 2, ContentType.VARIABLE, CellType.OPTIONAL)
예제 #14
0
 def write_cell_data(self):
     value = self._random.choice([
         '# something', 'foobar', ': FOR', '${var}', 'No Operation', '\\',
         'zoo%d' % self._rand(),
         '${%d}' % self._rand()
     ])
     self._macro_execute(
         ChangeCellValue(self._rand_row(), self._rand_col(), value))
예제 #15
0
 def test_create_and_remove_keyword(self):
     kw_name = 'Super Keyword'
     self.test.execute(ChangeCellValue(0, 0, kw_name))
     self._verify_cell_info(0, 0, ContentType.STRING, CellType.KEYWORD)
     self.test.execute(AddKeyword(kw_name, '${argh}'))
     self._verify_cell_info(0, 0, ContentType.USER_KEYWORD, CellType.KEYWORD)
     self._verify_cell_info(0, 1, ContentType.EMPTY, CellType.MANDATORY)
     self.test.execute(Undo())
     self._verify_cell_info(0, 0, ContentType.STRING, CellType.KEYWORD)
     self._verify_cell_info(0, 1, ContentType.EMPTY, CellType.UNKNOWN)
예제 #16
0
 def test_for_loop_change_and_purify(self):
     test = self.project.datafiles[1].tests[13]
     test.execute(ChangeCellValue(1, 2, ''))
     test.execute(Purify())
     self._steps_are_in_for_loop(test, 2)
예제 #17
0
 def test_for_loop_shift_left(self):
     test = self.project.datafiles[1].tests[12]
     test.execute(ChangeCellValue(0, 0, 'FOR'))
     test.execute(DeleteCell(0,0))
     self.assertEqual(type(test.steps[0]), StepController)
예제 #18
0
 def test_for_loop_creation_and_steps(self):
     test = self.project.datafiles[1].tests[11]
     test.execute(ChangeCellValue(0, 0, 'FOR'))
     self._steps_are_in_for_loop(test, 1, 2, 3)
예제 #19
0
 def test_empty_normal_step_first_cell(self):
     test = self.project.datafiles[1].tests[9]
     test.execute(ChangeCellValue(0, 0, ''))
     self._steps_are_not_in_for_loop(test, 0)
예제 #20
0
 def test_modify_last_step_so_that_it_should_be_empty_and_not_part_of_for_loop(self):
     test = self.project.datafiles[1].tests[8]
     test.execute(ChangeCellValue(2, 0, ''))
     self._steps_are_not_in_for_loop(test, 2)
예제 #21
0
 def cell_value_edited(self, row, col, value):
     self._execute(ChangeCellValue(row, col, value))
예제 #22
0
 def _add_step(self, keyword):
     self.test_ctrl.execute(ChangeCellValue(100, 100, keyword))
     self._steps_have_changed = False
예제 #23
0
 def test_adding_new_for_loop(self):
     test2 = self.project.datafiles[1].tests[1]
     test2.execute(ChangeCellValue(0, 0, 'FOR'))
     self.assertTrue(isinstance(test2.step(0), ForLoopStepController),
         'wrong type of step type (%s)' % type(test2.step(0)))
예제 #24
0
 def test_modifying_step_in_for_loop(self):
     test = self.project.datafiles[1].tests[0]
     test.execute(ChangeCellValue(3, 1, 'Something again'))
     self.assertEqual(type(test.step(3)), IntendedStepController)
예제 #25
0
 def test_adding_step_to_for_loop(self):
     test = self.project.datafiles[1].tests[0]
     test.execute(ChangeCellValue(4, 1, 'No Operation'))
     self.assertTrue(isinstance(test.step(4), IntendedStepController),
         'wrong type of step type (%s)' % type(test.step(4)))
예제 #26
0
 def _verify_string_change(self, row, col, celltype):
     self._verify_cell_info(row, col, ContentType.EMPTY, celltype)
     self.test.execute(ChangeCellValue(row, col, 'diipadaapa'))
     self._verify_cell_info(row, col, ContentType.STRING, celltype)