Ejemplo n.º 1
0
def main():
    parser = optparse.OptionParser()
    parser.add_option(
        '',
        '--chromedriver_path',
        type='string',
        default=None,
        help='Path to a build of the chromedriver library(REQUIRED!)')
    parser.add_option('',
                      '--chrome_path',
                      type='string',
                      default=None,
                      help='Path to a build of the chrome binary')
    parser.add_option(
        '',
        '--filter',
        type='string',
        default=None,
        help='Filter for specifying what tests to run, "*" will run all. E.g., '
        + 'AppCacheTest,ElementFindingTest#testShouldReturnTitleOfPageIfSet.')
    options, args = parser.parse_args()

    if (options.chromedriver_path is None
            or not os.path.exists(options.chromedriver_path)):
        parser.error(
            'chromedriver_path is required or the given path is invalid.' +
            'Please run "%s --help" for help' % __file__)

    # Run passed tests when filter is not provided.
    test_filter = options.filter
    if test_filter is None:
        passed_java_tests_file = open(
            os.path.join(_THIS_DIR, 'passed_java_tests.txt'))
        passed_java_tests = [
            line.strip('\n') for line in passed_java_tests_file
        ]
        passed_java_tests_file.close()
        test_filter = ','.join(passed_java_tests)

    java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test',
                                      'chromedriver', 'third_party',
                                      'java_tests')
    if (not os.path.exists(java_tests_src_dir)
            or not os.listdir(java_tests_src_dir)):
        print(
            '"%s" is empty or it doesn\'t exist.' % java_tests_src_dir +
            'Should add "deps/third_party/webdriver" to source checkout config'
        )
        return 1

    return PrintTestResults(
        _Run(src_dir=chrome_paths.GetSrc(),
             java_tests_src_dir=java_tests_src_dir,
             test_filter=test_filter,
             chromedriver_path=options.chromedriver_path,
             chrome_path=options.chrome_path))
Ejemplo n.º 2
0
def main():
  parser = optparse.OptionParser()
  parser.add_option(
      '', '--filter', type='string', default=None,
      help='Filter for specifying what tests to run. E.g., ' +
           'ElementFindingTest#testShouldReturnTitleOfPageIfSet.')
  options, args = parser.parse_args()

  print '@@@BUILD_STEP java_continuous_tests@@@'
  # We use the latest revision in the continuous archive instead of the
  # extracted build for two reasons:
  # 1) Builds are only archived if they have passed some set of tests. This
  #    results in less false failures.
  # 2) I don't want to add chromedriver to the chromium_builder_tests target in
  #    all.gyp, since that will probably add a minute or so to every build.
  revision = continuous_archive.GetLatestRevision()
  print '@@@STEP_TEXT@r%s@@@' % revision
  temp_dir = util.MakeTempDir()

  chrome_path = continuous_archive.DownloadChrome(revision, temp_dir)
  chromedriver_path = continuous_archive.DownloadChromeDriver(
      revision, temp_dir)

  PrintTestResults(java_tests.Run(
      src_dir=chrome_paths.GetSrc(),
      test_filter=options.filter,
      chromedriver_path=chromedriver_path,
      chrome_path=chrome_path))

  print '@@@BUILD_STEP java_stable_tests@@@'
  print '@@@STEP_TEXT@chromedriver r%s@@@' % revision
  PrintTestResults(java_tests.Run(
      src_dir=chrome_paths.GetSrc(),
      test_filter=options.filter,
      chromedriver_path=chromedriver_path,
      chrome_path=None))
Ejemplo n.º 3
0
def main():
  parser = optparse.OptionParser()
  parser.add_option(
      '', '--verbose', action="store_true", default=False,
      help='Whether output should be verbose')
  parser.add_option(
      '', '--debug', action="store_true", default=False,
      help='Whether to wait to be attached by a debugger')
  parser.add_option(
      '', '--chromedriver', type='string', default=None,
      help='Path to a build of the chromedriver library(REQUIRED!)')
  parser.add_option(
      '', '--chrome', type='string', default=None,
      help='Path to a build of the chrome binary')
  parser.add_option(
      '', '--chrome-version', default='HEAD',
      help='Version of chrome. Default is \'HEAD\'')
  parser.add_option(
      '', '--android-package', type='string', default=None,
      help='Name of Chrome\'s Android package')
  parser.add_option(
      '', '--filter', type='string', default=None,
      help='Filter for specifying what tests to run, "*" will run all. E.g., '
           '*testShouldReturnTitleOfPageIfSet')
  options, args = parser.parse_args()

  if options.chromedriver is None or not os.path.exists(options.chromedriver):
    parser.error('chromedriver is required or the given path is invalid.' +
                 'Please run "%s --help" for help' % __file__)

  if options.android_package is not None:
    if options.chrome_version != 'HEAD':
      parser.error('Android does not support the --chrome-version argument.')
    environment = test_environment.AndroidTestEnvironment()
  else:
    environment = test_environment.DesktopTestEnvironment(
        options.chrome_version)

  try:
    environment.GlobalSetUp()
    # Run passed tests when filter is not provided.
    test_filter = options.filter
    if test_filter is None:
      test_filter = environment.GetPassedJavaTestFilter()

    java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test',
                                      'chromedriver', 'third_party',
                                      'java_tests')
    if (not os.path.exists(java_tests_src_dir) or
        not os.listdir(java_tests_src_dir)):
      print ('"%s" is empty or it doesn\'t exist.' % java_tests_src_dir +
          'Should add "deps/third_party/webdriver" to source checkout config')
      return 1

    return PrintTestResults(_Run(
        java_tests_src_dir=java_tests_src_dir,
        test_filter=test_filter,
        chromedriver_path=options.chromedriver,
        chrome_path=options.chrome,
        android_package=options.android_package,
        verbose=options.verbose,
        debug=options.debug))
  finally:
    environment.GlobalTearDown()