Ejemplo n.º 1
0
    def test_implementation_error_in_setup_main_step(self):
        test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
            .add(PartialPhase.SETUP,
                 test.setup_phase_instruction_that(
                     main=do_raise(test.ImplementationErrorTestException())))
        self._check(
            Arrangement(test_case,
                        act_executor_execute=execute_action_that_returns_exit_code(5)),
            Expectation(
                asrt_result.matches2(
                    PartialExeResultStatus.IMPLEMENTATION_ERROR,
                    asrt_result.has_sds(),
                    asrt_result.has_no_action_to_check_outcome(),
                    ExpectedFailureForInstructionFailure.new_with_exception(
                        phase_step.SETUP__MAIN,
                        test_case.the_extra(PartialPhase.SETUP)[0].source,
                        test.ImplementationErrorTestException),
                ),
                [phase_step.ACT__PARSE] +

                SYMBOL_VALIDATION_STEPS__TWICE +
                PRE_SDS_VALIDATION_STEPS__TWICE +
                [phase_step.SETUP__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
                 ],
            ))
Ejemplo n.º 2
0
 def test_hard_error_in_setup_main_step(self):
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(PartialPhase.SETUP,
              test.setup_phase_instruction_that(
                  main=do_return(sh.new_sh_hard_error('hard error msg from setup'))))
     self._check(
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 PartialExeResultStatus.HARD_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.SETUP__MAIN,
                     test_case.the_extra(PartialPhase.SETUP)[0].source,
                     'hard error msg from setup'),
             ),
             [phase_step.ACT__PARSE] +
             SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE +
             [phase_step.SETUP__MAIN,
              (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
              (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
              ],
         ))
Ejemplo n.º 3
0
 def test_internal_error(self):
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(PartialPhase.SETUP,
              test.setup_phase_instruction_that(
                  main=do_raise(test.ImplementationErrorTestException())))
     self._check(
         Arrangement(test_case,
                     atc_execute=execute_action_that_returns_exit_code(5)),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.INTERNAL_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_exception(
                     phase_step.SETUP__MAIN,
                     test_case.the_extra(PartialPhase.SETUP)[0].source,
                     test.ImplementationErrorTestException),
             ),
             [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE + [
                 phase_step.SETUP__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
             ],
         ))
Ejemplo n.º 4
0
    def runTest(self):
        conf = self.configuration
        defined_symbol = data_symbol_utils.string_symbol_definition('symbol_name')
        error_message_for_failed_restriction = 'error message'
        reference_with_restriction_failure = SymbolReference(
            defined_symbol.name,
            ReferenceRestrictionsOnDirectAndIndirect(
                direct=value_restriction_that_is_unconditionally_unsatisfied(error_message_for_failed_restriction)))

        test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
            .add(PartialPhase.SETUP,
                 setup_phase_instruction_that(symbol_usages=do_return([defined_symbol]))) \
            .add(conf.phase,
                 conf.instruction_that_returns([reference_with_restriction_failure]))

        execute_test_case_with_recording(
            self,
            Arrangement(test_case),
            Expectation(
                asrt_result.matches2(
                    PartialExeResultStatus.VALIDATION_ERROR,
                    asrt_result.has_no_sds(),
                    asrt_result.has_no_action_to_check_outcome(),
                    ExpectedFailureForInstructionFailure.new_with_phase_and_message_assertion(
                        conf.step,
                        asrt.equals(error_message_for_failed_restriction)),
                ),
                conf.expected_steps_before_failing_instruction,
            )
        )
Ejemplo n.º 5
0
 def test_hard_error_in_setup_main_step(self):
     py_pgm_setup = PyProgramSetup('some output to stdout',
                                   'some output to stderr',
                                   72)
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr(
         act_phase_source=py_pgm_setup.as_line_sequence()) \
         .add(PartialPhase.SETUP,
              test.setup_phase_instruction_that(
                  main=do_return(sh.new_sh_hard_error('hard error msg from setup'))))
     self._check(
         arr_for_py3_source(test_case),
         Expectation(
             asrt_result.matches2(
                 PartialExeResultStatus.HARD_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.SETUP__MAIN,
                     test_case.the_extra(PartialPhase.SETUP)[0].source,
                     'hard error msg from setup'),
             ),
             atc_stdout_output=asrt.equals(''),
             atc_stderr_output=asrt.equals(''),
             step_recordings=
             [phase_step.ACT__PARSE] +
             SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE +
             [phase_step.SETUP__MAIN,
              (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
              (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
              ],
         ))
Ejemplo n.º 6
0
 def test_hard_error_in_setup_main_step(self):
     py_pgm_setup = PyProgramSetup('some output to stdout',
                                   'some output to stderr', 72)
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr(
         act_phase_source=py_pgm_setup.as_line_sequence()) \
         .add(PartialPhase.SETUP,
              test.setup_phase_instruction_that(
                  main=do_return(sh.new_sh_hard_error__str('hard error msg from setup'))))
     self._check(
         arr_for_py3_source(test_case),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.HARD_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.SETUP__MAIN,
                     test_case.the_extra(PartialPhase.SETUP)[0].source,
                     'hard error msg from setup'),
             ),
             atc_stdout_output=asrt.equals(''),
             atc_stderr_output=asrt.equals(''),
             step_recordings=[phase_step.ACT__PARSE] +
             SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE + [
                 phase_step.SETUP__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
             ],
         ))
Ejemplo n.º 7
0
 def test_with_internal_error(self):
     test_case = test_case_with_two_instructions_in_each_phase() \
         .add(phase_identifier.CONFIGURATION,
              test.ConfigurationPhaseInstructionThatSetsExecutionMode(TestCaseStatus.FAIL)) \
         .add(phase_identifier.CLEANUP,
              test.cleanup_phase_instruction_that(
                  main=do_raise(test.ImplementationErrorTestException())))
     self._check(
         Arrangement(
             test_case,
             execute_test_action=execute_action_that_returns_exit_code(
                 128)),
         Expectation(
             asrt_result.matches2(
                 FullExeResultStatus.INTERNAL_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_action_to_check_outcome_with_exit_code(
                     128),
                 ExpectedFailureForInstructionFailure.new_with_exception(
                     phase_step.CLEANUP__MAIN,
                     test_case.the_extra(
                         phase_identifier.CLEANUP)[0].source,
                     test.ImplementationErrorTestException),
             ),
             [
                 phase_step.CONFIGURATION__MAIN,
                 phase_step.CONFIGURATION__MAIN
             ] + [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE + [
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ACT__PREPARE,
                 phase_step.ACT__EXECUTE,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
             ],
         ))
Ejemplo n.º 8
0
    def test_with_implementation_error(self):
        test_case = test_case_with_two_instructions_in_each_phase() \
            .add(phase_identifier.CONFIGURATION,
                 test.ConfigurationPhaseInstructionThatSetsExecutionMode(TestCaseStatus.FAIL)) \
            .add(phase_identifier.CLEANUP,
                 test.cleanup_phase_instruction_that(
                     main=do_raise(test.ImplementationErrorTestException())))
        self._check(
            Arrangement(test_case,
                        execute_test_action=execute_action_that_returns_exit_code(128)),
            Expectation(
                asrt_result.matches2(
                    FullExeResultStatus.IMPLEMENTATION_ERROR,
                    asrt_result.has_sds(),
                    asrt_result.has_action_to_check_outcome_with_exit_code(128),
                    ExpectedFailureForInstructionFailure.new_with_exception(
                        phase_step.CLEANUP__MAIN,
                        test_case.the_extra(phase_identifier.CLEANUP)[0].source,
                        test.ImplementationErrorTestException),
                ),
                [phase_step.CONFIGURATION__MAIN,
                 phase_step.CONFIGURATION__MAIN] +
                [phase_step.ACT__PARSE] +
                SYMBOL_VALIDATION_STEPS__TWICE +
                PRE_SDS_VALIDATION_STEPS__TWICE +
                [phase_step.SETUP__MAIN,
                 phase_step.SETUP__MAIN,

                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,

                 phase_step.ACT__PREPARE,
                 phase_step.ACT__EXECUTE,

                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
                 ],
            ))
Ejemplo n.º 9
0
    def test_with_assert_phase_that_fails(self):
        test_case = test_case_with_two_instructions_in_each_phase() \
            .add(phase_identifier.CONFIGURATION,
                 test.ConfigurationPhaseInstructionThatSetsExecutionMode(TestCaseStatus.FAIL)) \
            .add(phase_identifier.ASSERT,
                 test.assert_phase_instruction_that(
                     main=do_return(pfh.new_pfh_fail('fail message'))))
        self._check(Arrangement(test_case,
                                execute_test_action=execute_action_that_returns_exit_code(11)),
                    Expectation(
                        asrt_result.matches2(
                            FullExeResultStatus.XFAIL,
                            asrt_result.has_sds(),
                            asrt_result.has_action_to_check_outcome_with_exit_code(11),
                            ExpectedFailureForInstructionFailure.new_with_message(
                                phase_step.ASSERT__MAIN,
                                test_case.the_extra(phase_identifier.ASSERT)[0].source,
                                'fail message'),
                        ),
                        [phase_step.CONFIGURATION__MAIN,
                         phase_step.CONFIGURATION__MAIN] +
                        [phase_step.ACT__PARSE] +
                        SYMBOL_VALIDATION_STEPS__TWICE +
                        PRE_SDS_VALIDATION_STEPS__TWICE +
                        [phase_step.SETUP__MAIN,
                         phase_step.SETUP__MAIN,

                         phase_step.SETUP__VALIDATE_POST_SETUP,
                         phase_step.SETUP__VALIDATE_POST_SETUP,
                         phase_step.ACT__VALIDATE_POST_SETUP,
                         phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                         phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                         phase_step.ASSERT__VALIDATE_POST_SETUP,
                         phase_step.ASSERT__VALIDATE_POST_SETUP,

                         phase_step.ACT__PREPARE,
                         phase_step.ACT__EXECUTE,

                         phase_step.BEFORE_ASSERT__MAIN,
                         phase_step.BEFORE_ASSERT__MAIN,
                         phase_step.ASSERT__MAIN,
                         (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
                         (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
                         ],
                    ))
Ejemplo n.º 10
0
 def test_with_assert_phase_that_fails(self):
     test_case = test_case_with_two_instructions_in_each_phase() \
         .add(phase_identifier.CONFIGURATION,
              test.ConfigurationPhaseInstructionThatSetsExecutionMode(TestCaseStatus.FAIL)) \
         .add(phase_identifier.ASSERT,
              test.assert_phase_instruction_that(
                  main=do_return(pfh.new_pfh_fail__str('fail message'))))
     self._check(
         Arrangement(
             test_case,
             execute_test_action=execute_action_that_returns_exit_code(11)),
         Expectation(
             asrt_result.matches2(
                 FullExeResultStatus.XFAIL,
                 asrt_result.has_sds(),
                 asrt_result.has_action_to_check_outcome_with_exit_code(11),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.ASSERT__MAIN,
                     test_case.the_extra(phase_identifier.ASSERT)[0].source,
                     'fail message'),
             ),
             [
                 phase_step.CONFIGURATION__MAIN,
                 phase_step.CONFIGURATION__MAIN
             ] + [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE + [
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ACT__PREPARE,
                 phase_step.ACT__EXECUTE,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
             ],
         ))
Ejemplo n.º 11
0
 def test_hard_error_in_configuration_phase(self):
     test_case_generator = test_case_with_two_instructions_in_each_phase() \
         .add(phase_identifier.CONFIGURATION,
              test.configuration_phase_instruction_that(do_return(sh.new_sh_hard_error('hard error msg'))))
     self._check(
         Arrangement(test_case_generator),
         Expectation(
             asrt_result.matches2(
                 FullExeResultStatus.HARD_ERROR,
                 asrt_result.has_no_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.CONFIGURATION__MAIN,
                     test_case_generator.the_extra(phase_identifier.CONFIGURATION)[
                         0].source,
                     'hard error msg')
             ),
             [phase_step.CONFIGURATION__MAIN],
         ))
Ejemplo n.º 12
0
 def runTest(self):
     conf = self.configuration
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(conf.phase,
              conf.instruction_that_raises(hard_error_ex('Error message from hard error exception')))
     execute_test_case_with_recording(
         self, Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.HARD_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     conf.step,
                     test_case.the_extra(conf.phase)[0].source,
                     'Error message from hard error exception'),
             ),
             conf.expected_steps,
         ))
Ejemplo n.º 13
0
 def runTest(self):
     conf = self.configuration
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(conf.phase,
              conf.instruction_that_returns(svh.new_svh_validation_error__str('validation error message')))
     execute_test_case_with_recording(
         self, Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.VALIDATION_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     conf.step,
                     test_case.the_extra(conf.phase)[0].source,
                     'validation error message'),
             ),
             conf.expected_steps,
         ))
Ejemplo n.º 14
0
 def runTest(self):
     conf = self.configuration
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(conf.phase,
              conf.instruction_that_raises(test.ImplementationErrorTestException()))
     execute_test_case_with_recording(
         self, Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.INTERNAL_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_exception(
                     conf.step,
                     test_case.the_extra(conf.phase)[0].source,
                     test.ImplementationErrorTestException),
             ),
             conf.expected_steps,
         ))
Ejemplo n.º 15
0
 def test_implementation_error_in_configuration_phase(self):
     test_case = test_case_with_two_instructions_in_each_phase() \
         .add(phase_identifier.CONFIGURATION,
              test.configuration_phase_instruction_that(
                  main=do_raise(test.ImplementationErrorTestException())))
     self._check(
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 FullExeResultStatus.IMPLEMENTATION_ERROR,
                 asrt_result.has_no_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_exception(
                     phase_step.CONFIGURATION__MAIN,
                     test_case.the_extra(phase_identifier.CONFIGURATION)[0].source,
                     test.ImplementationErrorTestException),
             ),
             [phase_step.CONFIGURATION__MAIN],
         ))
Ejemplo n.º 16
0
    def test_hard_error_in_cleanup_main_step(self):
        test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
            .add(PartialPhase.CLEANUP,
                 test.cleanup_phase_instruction_that(
                     main=do_return(sh.new_sh_hard_error('hard error msg from CLEANUP'))))
        self._check(
            Arrangement(test_case,
                        act_executor_execute=execute_action_that_returns_exit_code(3)),
            Expectation(
                asrt_result.matches2(
                    PartialExeResultStatus.HARD_ERROR,
                    asrt_result.has_sds(),
                    asrt_result.has_action_to_check_outcome_with_exit_code(3),
                    ExpectedFailureForInstructionFailure.new_with_message(
                        phase_step.CLEANUP__MAIN,
                        test_case.the_extra(PartialPhase.CLEANUP)[0].source,
                        'hard error msg from CLEANUP'),
                ),
                [phase_step.ACT__PARSE] +

                SYMBOL_VALIDATION_STEPS__TWICE +
                PRE_SDS_VALIDATION_STEPS__TWICE +
                [phase_step.SETUP__MAIN,
                 phase_step.SETUP__MAIN,

                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,

                 phase_step.ACT__PREPARE,
                 phase_step.ACT__EXECUTE,

                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
                 ],
            ))
Ejemplo n.º 17
0
 def test_execution_mode_skipped_but_failing_instruction_in_configuration_phase_after_setting_execution_mode(self):
     test_case = test_case_with_two_instructions_in_each_phase() \
         .add(phase_identifier.CONFIGURATION,
              test.ConfigurationPhaseInstructionThatSetsExecutionMode(
                  TestCaseStatus.SKIP)) \
         .add(phase_identifier.CONFIGURATION,
              test.configuration_phase_instruction_that(do_return(sh.new_sh_hard_error('hard error msg'))))
     self._check(
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 FullExeResultStatus.HARD_ERROR,
                 asrt_result.has_no_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.CONFIGURATION__MAIN,
                     test_case.the_extra(phase_identifier.CONFIGURATION)[1].source,
                     'hard error msg')),
             [phase_step.CONFIGURATION__MAIN],
         ))
Ejemplo n.º 18
0
 def runTest(self):
     conf = self.configuration
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(conf.phase,
              conf.instruction_that_raises(test.ImplementationErrorTestException()))
     execute_test_case_with_recording(
         self,
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 PartialExeResultStatus.IMPLEMENTATION_ERROR,
                 asrt_result.has_no_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_exception(
                     conf.step,
                     test_case.the_extra(conf.phase)[0].source,
                     test.ImplementationErrorTestException),
             ),
             conf.expected_steps_before_failing_instruction,
         ))
Ejemplo n.º 19
0
 def test_execution_mode_skipped_but_failing_instruction_in_configuration_phase_after_setting_execution_mode(self):
     test_case = test_case_with_two_instructions_in_each_phase() \
         .add(phase_identifier.CONFIGURATION,
              test.ConfigurationPhaseInstructionThatSetsExecutionMode(
                  TestCaseStatus.SKIP)) \
         .add(phase_identifier.CONFIGURATION,
              test.configuration_phase_instruction_that(do_return(svh.new_svh_hard_error__str('hard error msg'))))
     self._check(
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 FullExeResultStatus.HARD_ERROR,
                 asrt_result.has_no_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.CONFIGURATION__MAIN,
                     test_case.the_extra(phase_identifier.CONFIGURATION)[1].source,
                     'hard error msg')),
             [phase_step.CONFIGURATION__MAIN],
         ))
Ejemplo n.º 20
0
 def runTest(self):
     conf = self.configuration
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(conf.phase,
              conf.instruction_that_returns(svh.new_svh_hard_error('Error message from hard error')))
     execute_test_case_with_recording(
         self,
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 PartialExeResultStatus.HARD_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     conf.step,
                     test_case.the_extra(conf.phase)[0].source,
                     'Error message from hard error'),
             ),
             conf.expected_steps,
         ))
Ejemplo n.º 21
0
 def runTest(self):
     conf = self.configuration
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(conf.phase,
              conf.instruction_that_returns([element_reference('undefined symbol')]))
     execute_test_case_with_recording(
         self,
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 PartialExeResultStatus.VALIDATION_ERROR,
                 asrt_result.has_no_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message_assertion(
                     conf.step,
                     test_case.the_extra(conf.phase)[0].source,
                     asrt.is_instance(str)),
             ),
             conf.expected_steps_before_failing_instruction,
         )
     )
Ejemplo n.º 22
0
 def test_hard_error_exception(self):
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(PartialPhase.CLEANUP,
              test.cleanup_phase_instruction_that(
                  main=do_raise(hard_error_ex('hard error exception msg from CLEANUP'))))
     self._check(
         Arrangement(test_case,
                     atc_execute=execute_action_that_returns_exit_code(3)),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.HARD_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_action_to_check_outcome_with_exit_code(3),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.CLEANUP__MAIN,
                     test_case.the_extra(PartialPhase.CLEANUP)[0].source,
                     'hard error exception msg from CLEANUP'),
             ),
             [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE + [
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_EXE_INPUT,
                 phase_step.ACT__PREPARE,
                 phase_step.ACT__EXECUTE,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
             ],
         ))
Ejemplo n.º 23
0
 def test_fail(self):
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(PartialPhase.ASSERT,
              test.assert_phase_instruction_that(
                  main=do_return(pfh.new_pfh_fail__str('fail msg from ASSERT'))))
     self._check(
         Arrangement(test_case,
                     atc_execute=execute_action_that_returns_exit_code(5)),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.FAIL,
                 asrt_result.has_sds(),
                 asrt_result.has_action_to_check_outcome_with_exit_code(5),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.ASSERT__MAIN,
                     test_case.the_extra(PartialPhase.ASSERT)[0].source,
                     'fail msg from ASSERT'),
             ),
             [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE + [
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__MAIN,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.SETUP__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.BEFORE_ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ASSERT__VALIDATE_POST_SETUP,
                 phase_step.ACT__VALIDATE_EXE_INPUT,
                 phase_step.ACT__PREPARE,
                 phase_step.ACT__EXECUTE,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.BEFORE_ASSERT__MAIN,
                 phase_step.ASSERT__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
                 (phase_step.CLEANUP__MAIN, PreviousPhase.ASSERT),
             ],
         ))
Ejemplo n.º 24
0
 def test_hard_error_exception(self):
     test_case = TestCaseGeneratorWithExtraInstrsBetweenRecordingInstr() \
         .add(PartialPhase.SETUP,
              test.setup_phase_instruction_that(
                  main=do_raise(hard_error_ex('hard error exception msg from setup'))))
     self._check(
         Arrangement(test_case),
         Expectation(
             asrt_result.matches2(
                 ExecutionFailureStatus.HARD_ERROR,
                 asrt_result.has_sds(),
                 asrt_result.has_no_action_to_check_outcome(),
                 ExpectedFailureForInstructionFailure.new_with_message(
                     phase_step.SETUP__MAIN,
                     test_case.the_extra(PartialPhase.SETUP)[0].source,
                     'hard error exception msg from setup'),
             ),
             [phase_step.ACT__PARSE] + SYMBOL_VALIDATION_STEPS__TWICE +
             PRE_SDS_VALIDATION_STEPS__TWICE + [
                 phase_step.SETUP__MAIN,
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
                 (phase_step.CLEANUP__MAIN, PreviousPhase.SETUP),
             ],
         ))