From a33163a3ddbb60a6c45340e436310f78044c1a7d Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Wed, 2 Feb 2011 00:49:33 +0000 Subject: Adds type_param and value_param as attributes to the XML report; also removes the comment() and test_case_comment() fields of TestInfo. Proposed and initally implemented by Joey Oravec. Re-implemented by Vlad Losev. git-svn-id: http://googletest.googlecode.com/svn/trunk@537 861a406c-534a-0410-8894-cb66d6ee9925 --- test/gtest_xml_output_unittest_.cc | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'test/gtest_xml_output_unittest_.cc') diff --git a/test/gtest_xml_output_unittest_.cc b/test/gtest_xml_output_unittest_.cc index 693ffb9..741a887 100644 --- a/test/gtest_xml_output_unittest_.cc +++ b/test/gtest_xml_output_unittest_.cc @@ -42,9 +42,13 @@ using ::testing::InitGoogleTest; using ::testing::TestEventListeners; +using ::testing::TestWithParam; using ::testing::UnitTest; +using ::testing::Test; +using ::testing::Types; +using ::testing::Values; -class SuccessfulTest : public testing::Test { +class SuccessfulTest : public Test { }; TEST_F(SuccessfulTest, Succeeds) { @@ -52,14 +56,14 @@ TEST_F(SuccessfulTest, Succeeds) { ASSERT_EQ(1, 1); } -class FailedTest : public testing::Test { +class FailedTest : public Test { }; TEST_F(FailedTest, Fails) { ASSERT_EQ(1, 2); } -class DisabledTest : public testing::Test { +class DisabledTest : public Test { }; TEST_F(DisabledTest, DISABLED_test_not_run) { @@ -91,7 +95,7 @@ TEST(InvalidCharactersTest, InvalidCharactersInMessage) { FAIL() << "Invalid characters in brackets [\x1\x2]"; } -class PropertyRecordingTest : public testing::Test { +class PropertyRecordingTest : public Test { }; TEST_F(PropertyRecordingTest, OneProperty) { @@ -134,6 +138,31 @@ TEST(NoFixtureTest, ExternalUtilityThatCallsRecordStringValuedProperty) { ExternalUtilityThatCallsRecordProperty("key_for_utility_string", "1"); } +// Verifies that the test parameter value is output in the 'value_param' +// XML attribute for value-parameterized tests. +class ValueParamTest : public TestWithParam {}; +TEST_P(ValueParamTest, HasValueParamAttribute) {} +TEST_P(ValueParamTest, AnotherTestThatHasValueParamAttribute) {} +INSTANTIATE_TEST_CASE_P(Single, ValueParamTest, Values(33, 42)); + +// Verifies that the type parameter name is output in the 'type_param' +// XML attribute for typed tests. +template class TypedTest : public Test {}; +typedef Types TypedTestTypes; +TYPED_TEST_CASE(TypedTest, TypedTestTypes); +TYPED_TEST(TypedTest, HasTypeParamAttribute) {} + +// Verifies that the type parameter name is output in the 'type_param' +// XML attribute for type-parameterized tests. +template class TypeParameterizedTestCase : public Test {}; +TYPED_TEST_CASE_P(TypeParameterizedTestCase); +TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {} +REGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute); +typedef Types TypeParameterizedTestCaseTypes; +INSTANTIATE_TYPED_TEST_CASE_P(Single, + TypeParameterizedTestCase, + TypeParameterizedTestCaseTypes); + int main(int argc, char** argv) { InitGoogleTest(&argc, argv); -- cgit v1.2.1