def testRemoveTypeParametersFromGTestName(self):
        test_name = '1/FixedCommandTest/4.InvalidCommand'
        self.assertEqual(
            'FixedCommandTest.InvalidCommand',
            test_name_util.RemoveParametersFromGTestName(test_name))

        test_name = '1/FixedCommandTest/bcd.InvalidCommand'
        self.assertEqual(
            'FixedCommandTest.InvalidCommand',
            test_name_util.RemoveParametersFromGTestName(test_name))
    def testRemoveValueParametersWithoutInstantiationName(self):
        test_name = 'ColorSpaceTest.testNullTransform/12'
        self.assertEqual(
            'ColorSpaceTest.testNullTransform',
            test_name_util.RemoveParametersFromGTestName(test_name))

        test_name = 'ColorSpaceTest.testNullTransform/bcd'
        self.assertEqual(
            'ColorSpaceTest.testNullTransform',
            test_name_util.RemoveParametersFromGTestName(test_name))
Exemple #3
0
    def NormalizeTestName(test_name, step_name=None):
        """Normalizes test names by removing parameters and queries.

    Removes prefixes and parameters from test names if they are gtests. For
    example, 'A/ColorSpaceTest.PRE_PRE_testNullTransform/137' maps to
    'ColorSpaceTest.testNullTransform'.

    Removes queries from test names if they are webkit_layout_tests. For
    example, 'external/wpt/editing/run/inserttext.html?2001-last' maps to
    'external/wpt/editing/run/inserttext.html'

    step_name is an optional argument to help identify the type of the tests.
    If not given, goes through all normalizers for different types of tests.
    Note that without step name, this function is not perfect, for example,
    a/suite/c.html can be both a type parameterized version of suite.html gtest
    or a webkit_layout_tests.

    Args:
      test_name: Any test name, and it can be original test name containing
                 parameters, normalized test name (no-op) or a test label name
                 with masks.
      step_name: The original step name, needed to identify the type of the
                 test, such as webkit_layout_tests, gtests.

    Returns:
      Normalized version of the given test name.
    """
        if step_name and 'webkit_layout_tests' in step_name:
            return test_name_util.RemoveSuffixFromWebkitLayoutTestName(
                test_name_util.RemoveVirtualLayersFromWebkitLayoutTestName(
                    test_name))

        test_name = test_name_util.RemoveAllPrefixesFromGTestName(
            test_name_util.RemoveParametersFromGTestName(test_name))

        return test_name_util.RemoveSuffixFromWebkitLayoutTestName(
            test_name_util.RemoveVirtualLayersFromWebkitLayoutTestName(
                test_name))
 def testRemoveMaskedValueParametersFromGTestNames(self):
     test_name = '*/ColorSpaceTest.testNullTransform/*'
     self.assertEqual(
         'ColorSpaceTest.testNullTransform',
         test_name_util.RemoveParametersFromGTestName(test_name))
 def testRemoveMaskedTypeParametersWithoutInstantiationName(self):
     test_name = 'FixedCommandTest/*.InvalidCommand'
     self.assertEqual(
         'FixedCommandTest.InvalidCommand',
         test_name_util.RemoveParametersFromGTestName(test_name))