def test_010_create_master_detail_app(self): actual = PerfUtils.get_average_time(lambda: Tns.create( app_name=APP_NAME, template=Template.MASTER_DETAIL_NG.local_package, update=False), retry_count=RETRY_COUNT) expected = EXPECTED_RESULTS['master-detail-ng']['create'] assert PerfUtils.is_value_in_range( actual, expected, TOLERANCE), 'MasterDetailNG project create time is not OK.'
def test_002_create_ng_app(self): actual = PerfUtils.get_average_time( lambda: Tns.create(app_name=APP_NAME, template=Template.HELLO_WORLD_NG.local_package, update=False), retry_count=RETRY_COUNT) expected = EXPECTED_RESULTS['hello-world-ng']['create'] assert PerfUtils.is_value_in_range( actual, expected, TOLERANCE), 'NG Hello Word project create time is not OK.'
def test_302_prepare_with_doctor_do_not_make_it_much_slower(self): pa_d_time = PerfUtils.get_average_time( lambda: Tns.prepare_android(app_name=APP_NAME), retry_count=RETRY_COUNT) pi_d_time = PerfUtils.get_average_time( lambda: Tns.prepare_ios(app_name=APP_NAME), retry_count=RETRY_COUNT) os.environ['NS_SKIP_ENV_CHECK'] = 'true' pa_nd_time = PerfUtils.get_average_time( lambda: Tns.prepare_android(app_name=APP_NAME), retry_count=RETRY_COUNT) pi_nd_time = PerfUtils.get_average_time( lambda: Tns.prepare_ios(app_name=APP_NAME), retry_count=RETRY_COUNT) android_diff = pa_d_time - pa_nd_time ios_diff = pi_d_time - pi_nd_time assert PerfUtils.is_value_in_range( android_diff, 3, tolerance=1.0), 'Prepare android with common is slower.' assert PerfUtils.is_value_in_range( ios_diff, 6, tolerance=0.5), 'Prepare ios with common is slower.'
def test_20_get_average_time(self): ls_time = PerfUtils.get_average_time(lambda: run(cmd='ifconfig'), retry_count=5) assert 0.003 <= ls_time <= 0.03, "Command not executed in acceptable time. Actual value: " + str(ls_time)
def test_301_doctor_performance_inside_project(self): time = PerfUtils.get_average_time( lambda: Tns.doctor(app_name=APP_NAME), retry_count=RETRY_COUNT) assert PerfUtils.is_value_in_range( actual=time, expected=10.73), 'Doctor exec time is not OK.'
def test_300_doctor_performance_outside_project(self): time = PerfUtils.get_average_time(lambda: Tns.doctor(), retry_count=RETRY_COUNT) assert PerfUtils.is_value_in_range( actual=time, expected=9.63), 'Doctor exec time is not OK.'