Пример #1
0
    def test_subtest_fail(self):
        test_rec = yield htf.Test(
            add_set_diag,
            htf.Subtest(
                'subtest', phase0,
                phase_branches.DiagnosisCheckpoint(
                    'diag_subtest_pass',
                    phase_branches.DiagnosisCondition.on_all(
                        BranchDiagResult.SET),
                    action=htf.PhaseResult.FAIL_SUBTEST), skip0), phase1)

        self.assertTestFail(test_rec)
        self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec,
                                       'add_set_diag', 'phase0', 'phase1')
        self.assertPhasesOutcomeByName(test_record.PhaseOutcome.SKIP, test_rec,
                                       'skip0')

        self.assertEqual([
            test_record.CheckpointRecord(
                name='diag_subtest_pass',
                action=htf.PhaseResult.FAIL_SUBTEST,
                conditional=phase_branches.DiagnosisCondition(
                    phase_branches.ConditionOn.ALL, (BranchDiagResult.SET, )),
                subtest_name='subtest',
                result=phase_executor.PhaseExecutionOutcome(
                    htf.PhaseResult.FAIL_SUBTEST),
                evaluated_millis=htf_test.VALID_TIMESTAMP),
        ], test_rec.checkpoints)
Пример #2
0
    def test_fail(self):
        test_rec = yield htf.Test(
            add_set_diag,
            phase_branches.DiagnosisCheckpoint(
                'diag_fail',
                phase_branches.DiagnosisCondition.on_all(
                    BranchDiagResult.SET)), error_phase)

        self.assertTestFail(test_rec)
        self.assertPhasesOutcomeByName(
            test_record.PhaseOutcome.PASS,
            test_rec,
            'add_set_diag',
        )

        self.assertEqual([
            test_record.CheckpointRecord(
                name='diag_fail',
                action=htf.PhaseResult.STOP,
                conditional=phase_branches.DiagnosisCondition(
                    phase_branches.ConditionOn.ALL, (BranchDiagResult.SET, )),
                subtest_name=None,
                result=phase_executor.PhaseExecutionOutcome(
                    htf.PhaseResult.STOP),
                evaluated_millis=htf_test.VALID_TIMESTAMP),
        ], test_rec.checkpoints)
Пример #3
0
    def test_subtest_pass(self):
        test_rec = yield htf.Test(
            phase0,
            htf.Subtest(
                'subtest', phase1,
                phase_branches.DiagnosisCheckpoint(
                    'diag_subtest_pass',
                    phase_branches.DiagnosisCondition.on_all(
                        BranchDiagResult.NOT_SET),
                    action=htf.PhaseResult.FAIL_SUBTEST), phase2), phase3)

        self.assertTestPass(test_rec)
        self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec,
                                       'phase0', 'phase1', 'phase2', 'phase1')

        self.assertEqual([
            test_record.CheckpointRecord(
                name='diag_subtest_pass',
                action=htf.PhaseResult.FAIL_SUBTEST,
                conditional=phase_branches.DiagnosisCondition(
                    phase_branches.ConditionOn.ALL,
                    (BranchDiagResult.NOT_SET, )),
                subtest_name='subtest',
                result=phase_executor.PhaseExecutionOutcome(
                    htf.PhaseResult.CONTINUE),
                evaluated_millis=htf_test.VALID_TIMESTAMP),
        ], test_rec.checkpoints)
Пример #4
0
 def test_asdict(self):
     checkpoint = phase_branches.DiagnosisCheckpoint(
         'checkpoint',
         phase_branches.DiagnosisCondition.on_any(BranchDiagResult.SET),
         action=htf.PhaseResult.FAIL_SUBTEST)
     self.assertEqual(
         {
             'name': 'checkpoint',
             'action': htf.PhaseResult.FAIL_SUBTEST,
             'diag_condition': {
                 'condition': phase_branches.ConditionOn.ANY,
                 'diagnosis_results': [BranchDiagResult.SET],
             },
         }, checkpoint._asdict())