Example #1
0
    def test_fail_ratio_with_half_failures(self):
        REQUEST_COUNT = 10
        FAILURE_COUNT = 5
        EXPECTED_FAIL_RATIO = 0.5

        s = StatsEntry(self.stats, "/", "GET")
        s.num_requests = REQUEST_COUNT
        s.num_failures = FAILURE_COUNT

        self.assertAlmostEqual(s.fail_ratio, EXPECTED_FAIL_RATIO)
        output_fields = self.parse_string_output(str(s))
        self.assertEqual(output_fields['request_count'], REQUEST_COUNT)
        self.assertEqual(output_fields['failure_count'], FAILURE_COUNT)
        self.assertAlmostEqual(output_fields['failure_precentage'], EXPECTED_FAIL_RATIO*100)
Example #2
0
 def test_fail_ratio_with_failures(self):
     s = StatsEntry(self.stats, "/", "GET")
     s.num_requests = 10
     s.num_failures = 5
     self.assertAlmostEqual(s.fail_ratio, 0.5)
Example #3
0
 def test_fail_ratio_with_failures(self):
     s = StatsEntry(self.stats, "/", "GET")
     s.num_requests = 10
     s.num_failures = 5
     self.assertAlmostEqual(s.fail_ratio, 0.5)