Exemplo n.º 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)
Exemplo n.º 2
0
    def test_all_fail_subtest__fail_in_subtest(self):
        test_rec = yield htf.Test(
            phase0,
            htf.Subtest(
                'sub', phase1, fail_phase,
                phase_branches.PhaseFailureCheckpoint.all_previous(
                    'all_fail_subtest', action=htf.PhaseResult.FAIL_SUBTEST),
                skip0), phase2)

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

        self.assertEqual([
            test_record.CheckpointRecord(
                name='all_fail_subtest',
                action=htf.PhaseResult.FAIL_SUBTEST,
                conditional=phase_branches.PreviousPhases.ALL,
                subtest_name='sub',
                result=phase_executor.PhaseExecutionOutcome(
                    htf.PhaseResult.FAIL_SUBTEST),
                evaluated_millis=htf_test.VALID_TIMESTAMP),
        ], test_rec.checkpoints)
Exemplo n.º 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)
Exemplo n.º 4
0
    def test_last_fail_subtest__early_fail_in_subtest(self):
        test_rec = yield htf.Test(
            phase0,
            htf.Subtest(
                'sub', fail_phase, phase1,
                phase_branches.PhaseFailureCheckpoint.last(
                    'last_fail_subtest', action=htf.PhaseResult.FAIL_SUBTEST),
                phase2), phase3)

        self.assertTestFail(test_rec)
        self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec,
                                       'phase0', 'phase1', 'phase2', 'phase3')
        self.assertPhasesOutcomeByName(test_record.PhaseOutcome.FAIL, test_rec,
                                       'fail_phase')

        self.assertEqual([
            test_record.CheckpointRecord(
                name='last_fail_subtest',
                action=htf.PhaseResult.FAIL_SUBTEST,
                conditional=phase_branches.PreviousPhases.LAST,
                subtest_name='sub',
                result=phase_executor.PhaseExecutionOutcome(
                    htf.PhaseResult.CONTINUE),
                evaluated_millis=htf_test.VALID_TIMESTAMP),
        ], test_rec.checkpoints)