def testCreateJUnitTestConfig(self):
        """Test creating test config for AndroidJUnitTest.
    """
        with open(self.manifest_file, 'w') as f:
            f.write(MANIFEST_JUNIT_TEST)

        argv = [
            self.config_file, self.manifest_file, EMPTY_TEST_CONFIG,
            INSTRUMENTATION_TEST_CONFIG_TEMPLATE
        ]
        auto_gen_test_config.main(argv)
        with open(self.config_file) as config_file:
            self.assertEqual(config_file.read(), EXPECTED_JUNIT_TEST_CONFIG)
示例#2
0
  def testCreateJUnitTestConfig(self):
    """Test creating test config for AndroidJUnitTest.
    """
    with open(self.manifest_file, 'w') as f:
      f.write(MANIFEST_JUNIT_TEST)

    argv = [self.config_file,
            self.manifest_file,
            EMPTY_TEST_CONFIG,
            INSTRUMENTATION_TEST_CONFIG_TEMPLATE]
    auto_gen_test_config.main(argv)
    with open(self.config_file) as config_file:
      self.assertEqual(config_file.read(), EXPECTED_JUNIT_TEST_CONFIG)
    def testInvalidManifest(self):
        """An empty test config should be generated if AndroidManifest is invalid.
    """
        with open(self.manifest_file, 'w') as f:
            f.write(MANIFEST_INVALID)

        argv = [
            self.config_file, self.manifest_file, EMPTY_TEST_CONFIG,
            INSTRUMENTATION_TEST_CONFIG_TEMPLATE
        ]
        auto_gen_test_config.main(argv)
        with open(self.config_file) as config_file:
            with open(EMPTY_TEST_CONFIG) as empty_config:
                self.assertEqual(config_file.read(), empty_config.read())
示例#4
0
  def testInvalidManifest(self):
    """An empty test config should be generated if AndroidManifest is invalid.
    """
    with open(self.manifest_file, 'w') as f:
      f.write(MANIFEST_INVALID)

    argv = [self.config_file,
            self.manifest_file,
            EMPTY_TEST_CONFIG,
            INSTRUMENTATION_TEST_CONFIG_TEMPLATE]
    auto_gen_test_config.main(argv)
    with open(self.config_file) as config_file:
      with open(EMPTY_TEST_CONFIG) as empty_config:
        self.assertEqual(config_file.read(), empty_config.read())