Esempio n. 1
0
def _RunUIAutomatorTests(options, error_func, devices):
  """Subcommand of RunTestsCommands which runs uiautomator tests."""
  uiautomator_options = ProcessUIAutomatorOptions(options, error_func)

  runner_factory, tests = uiautomator_setup.Setup(uiautomator_options)

  results, exit_code = test_dispatcher.RunTests(
      tests, runner_factory, devices, shard=True, test_timeout=None,
      num_retries=options.num_retries)

  report_results.LogFull(
      results=results,
      test_type='UIAutomator',
      test_package=os.path.basename(options.test_jar),
      annotation=options.annotations,
      flakiness_server=options.flakiness_dashboard_server)

  return exit_code
Esempio n. 2
0
def _RunUIAutomatorTests(options, error_func):
    """Subcommand of RunTestsCommands which runs uiautomator tests."""
    uiautomator_options = ProcessUIAutomatorOptions(options, error_func)

    results = base_test_result.TestRunResults()
    exit_code = 0

    if options.run_java_tests:
        runner_factory, tests = uiautomator_setup.Setup(uiautomator_options)

        test_results, exit_code = test_dispatcher.RunTests(
            tests,
            runner_factory,
            False,
            options.test_device,
            shard=True,
            build_type=options.build_type,
            test_timeout=None,
            num_retries=options.num_retries)

        results.AddTestRunResults(test_results)

    if options.run_python_tests:
        test_results, test_exit_code = (
            python_dispatch.DispatchPythonTests(options))

        results.AddTestRunResults(test_results)

        # Only allow exit code escalation
        if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
            exit_code = test_exit_code

    report_results.LogFull(results=results,
                           test_type='UIAutomator',
                           test_package=os.path.basename(options.test_jar),
                           annotation=options.annotations,
                           build_type=options.build_type,
                           flakiness_server=options.flakiness_dashboard_server)

    return exit_code
def _RunUIAutomatorTests(args, devices):
    """Subcommand of RunTestsCommands which runs uiautomator tests."""
    uiautomator_options = ProcessUIAutomatorOptions(args)

    runner_factory, tests = uiautomator_setup.Setup(uiautomator_options,
                                                    devices)

    results, exit_code = test_dispatcher.RunTests(tests,
                                                  runner_factory,
                                                  devices,
                                                  shard=True,
                                                  test_timeout=None,
                                                  num_retries=args.num_retries)

    report_results.LogFull(results=results,
                           test_type='UIAutomator',
                           test_package=os.path.basename(args.test_jar),
                           annotation=args.annotations,
                           flakiness_server=args.flakiness_dashboard_server)

    if args.json_results_file:
        json_results.GenerateJsonResultsFile([results], args.json_results_file)

    return exit_code