Esempio n. 1
0
from testmaster import read_results
from testmaster.ndt_e2e_clientworker.client_wrapper import results

# The filename of a raw NDT result file.
RAW_RESULT_FILENAME = 'raw-result.json'
# The contents of the raw result file, represented as an NdtResult instance.
RAW_RESULT = results.NdtResult(
    browser='chrome',
    browser_version='50.0.2661.86',
    end_time=datetime.datetime(2016, 5, 24, 16, 55, 58, 756734, pytz.utc),
    client='ndt_js',
    client_version=None,
    os='OSX',
    os_version='10.11.3',
    start_time=datetime.datetime(2016, 5, 24, 16, 55, 22, 677309, pytz.utc),
    c2s_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 5, 24, 16, 55, 34, 74628, pytz.utc),
        end_time=datetime.datetime(2016, 5, 24, 16, 55, 46, 944071, pytz.utc),
        throughput=0.938),
    s2c_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 5, 24, 16, 55, 46, 944247,
                                     pytz.utc),
        end_time=datetime.datetime(2016, 5, 24, 16, 55, 58, 324334, pytz.utc),
        throughput=1.01),
    latency=564.0)
# The filename of a package of result files.
RESULT_PACKAGE_FILENAME = 'result-package.zip'
# A raw result file within the result package zip.
PACKAGED_RESULT_FILENAME = 'packaged-result.json'
# The contents of the packaged result, represented as an NdtResult instance.
PACKAGED_RESULT = results.NdtResult(
Esempio n. 2
0
import datetime
import unittest

import pytz

from testmaster import csv_convert
from testmaster.ndt_e2e_clientworker.client_wrapper import results

# An NDT result in which no errors occur and both s2c and c2s complete
# successfully.
NO_ERRORS_RESULT = results.NdtResult(
    end_time=datetime.datetime(2016, 5, 24, 16, 55, 58, 756734, pytz.utc),
    start_time=datetime.datetime(2016, 5, 24, 16, 55, 22, 677309, pytz.utc),
    c2s_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 5, 24, 16, 55, 34, 74628, pytz.utc),
        end_time=datetime.datetime(2016, 5, 24, 16, 55, 46, 944071, pytz.utc),
        throughput=0.938),
    s2c_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 5, 24, 16, 55, 46, 944247, pytz.utc),
        end_time=datetime.datetime(2016, 5, 24, 16, 55, 58, 324334, pytz.utc),
        throughput=1.01),
    latency=15.0)
# An NDT result in which s2c and c2s tests fail to complete and generate errors.
MISSING_FIELDS_RESULT = results.NdtResult(
    end_time=datetime.datetime(2016, 5, 24, 19, 18, 48, 173000, pytz.utc),
    start_time=datetime.datetime(2016, 5, 24, 19, 18, 3, 924000, pytz.utc),
    c2s_result=results.NdtSingleTestResult(start_time=datetime.datetime(
        2016, 5, 24, 19, 18, 35, 219000, pytz.utc)),
    s2c_result=results.NdtSingleTestResult(start_time=datetime.datetime(
        2016, 5, 24, 19, 18, 15, 991000, pytz.utc)),
    errors=[results.TestError('dummy s2c error'),
            results.TestError('dummy c2s error')])
import datetime
import unittest

import mock
import pytz

from testmaster import result_statistics
from testmaster.ndt_e2e_clientworker.client_wrapper import results

# Mock NDT results from which to calculate aggregate statistics.
RESULTS_A = results.NdtResult(
    start_time=datetime.datetime(2016, 1, 1, 0, 0, 0, 0, pytz.utc),
    end_time=datetime.datetime(2016, 1, 1, 0, 0, 23, 0, pytz.utc),
    c2s_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 1, 1, 0, 0, 1, 0, pytz.utc),
        end_time=datetime.datetime(2016, 1, 1, 0, 0, 11, 0, pytz.utc),
        throughput=1.0),
    s2c_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 1, 1, 0, 0, 12, 0, pytz.utc),
        end_time=datetime.datetime(2016, 1, 1, 0, 0, 22, 500000, pytz.utc),
        throughput=5.0),
    latency=10.0)
RESULTS_B = results.NdtResult(
    start_time=datetime.datetime(2016, 1, 1, 0, 0, 0, 0, pytz.utc),
    end_time=datetime.datetime(2016, 1, 1, 0, 0, 25, 0, pytz.utc),
    c2s_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 1, 1, 0, 0, 1, 0, pytz.utc),
        end_time=datetime.datetime(2016, 1, 1, 0, 0, 13, 0, pytz.utc),
        throughput=97.6),
    s2c_result=results.NdtSingleTestResult(
        start_time=datetime.datetime(2016, 1, 1, 0, 0, 13, 0, pytz.utc),
        end_time=datetime.datetime(2016, 1, 1, 0, 0, 23, 0, pytz.utc),
 def test_s2c_duration_is_None_for_incomplete_s2c_test(self):
     result = results.NdtResult(s2c_result=results.NdtSingleTestResult(
         start_time=datetime.datetime(2016, 6, 8, 12, 0, 0, 0, pytz.utc)))
     self.assertIsNone(result_metrics.s2c_duration(result))
 def test_s2c_duration_is_correct_for_completed_s2c_test(self):
     result = results.NdtResult(s2c_result=results.NdtSingleTestResult(
         start_time=datetime.datetime(2016, 6, 8, 12, 0, 0, 0, pytz.utc),
         end_time=datetime.datetime(2016, 6, 8, 12, 0, 11, 927345,
                                    pytz.utc)))
     self.assertAlmostEqual(11.927345, result_metrics.s2c_duration(result))
 def test_total_duration_is_None_on_incomplete_result(self):
     result = results.NdtResult(
         start_time=datetime.datetime(2016, 6, 8, 12, 0, 0, 0, pytz.utc))
     self.assertIsNone(result_metrics.total_duration(result))
 def test_total_duration_is_correct_for_completed_result(self):
     result = results.NdtResult(
         start_time=datetime.datetime(2016, 6, 8, 12, 0, 0, 0, pytz.utc),
         end_time=datetime.datetime(2016, 6, 8, 12, 0, 35, 700000, pytz.utc))
     self.assertAlmostEqual(35.7, result_metrics.total_duration(result))