Best Python code snippet using Kiwi_python
test_data.py
Source:test_data.py
...13 cls.empty_test_run = TestRunFactory(manager=cls.tester, default_tester=cls.tester,14 plan=cls.plan)15 cls.statuss = TestExecutionStatus.objects.all().order_by('pk')16 def test_get_from_empty_case_runs(self):17 data = self.empty_test_run.stats_executions_status(self.statuss)18 subtotal = dict((status.pk, [0, status])19 for status in self.statuss)20 self.assertEqual(subtotal, data.StatusSubtotal)21 self.assertEqual(0, data.CaseRunsTotalCount)22 self.assertEqual(.0, data.CompletedPercentage)23 self.assertEqual(.0, data.FailurePercentage)24class TestGetCaseRunsStatsByStatus(BasePlanCase):25 @classmethod26 def setUpTestData(cls):27 super(TestGetCaseRunsStatsByStatus, cls).setUpTestData()28 cls.statuss = TestExecutionStatus.objects.all().order_by('pk')29 cls.status_idle = TestExecutionStatus.objects.filter(weight=0).first()30 cls.status_failed = TestExecutionStatus.objects.filter(weight__lt=0).first()31 cls.status_waived = TestExecutionStatus.objects.filter(weight__gt=0).first()32 cls.test_run = TestRunFactory(product_version=cls.version, plan=cls.plan,33 manager=cls.tester, default_tester=cls.tester)34 for case, status in ((cls.case_1, cls.status_idle),35 (cls.case_2, cls.status_failed),36 (cls.case_3, cls.status_failed),37 (cls.case_4, cls.status_waived),38 (cls.case_5, cls.status_waived),39 (cls.case_6, cls.status_waived)):40 TestExecutionFactory(assignee=cls.tester, tested_by=cls.tester,41 run=cls.test_run, case=case, status=status)42 def test_get_stats(self):43 data = self.test_run.stats_executions_status(self.statuss)44 subtotal = dict((status.pk, [0, status])45 for status in self.statuss)46 subtotal[self.status_idle.pk][0] = 147 subtotal[self.status_failed.pk][0] = 248 subtotal[self.status_waived.pk][0] = 349 expected_completed_percentage = 5.0 * 100 / 650 expected_failure_percentage = 2.0 * 100 / 651 self.assertEqual(subtotal, data.StatusSubtotal)52 self.assertEqual(6, data.CaseRunsTotalCount)53 self.assertEqual(expected_completed_percentage, data.CompletedPercentage)54 self.assertEqual(expected_failure_percentage, data.FailurePercentage)55class TestGetExecutionComments(BaseCaseRun):56 """Test TestExecutionDataMixin.get_caseruns_comments57 There are two test runs created already, cls.test_run and cls.test_run_1....
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!