summaryrefslogtreecommitdiff
path: root/test/gtest_xml_output_unittest_.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-02-02 00:49:33 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-02-02 00:49:33 +0000
commita33163a3ddbb60a6c45340e436310f78044c1a7d (patch)
treed2072cc7bdd2f9df2f35f85258d8c0e10e80691a /test/gtest_xml_output_unittest_.cc
parent15f3ae05e214688e834f622d00b6a02b64ce6d53 (diff)
downloadgoogletest-a33163a3ddbb60a6c45340e436310f78044c1a7d.tar.gz
Adds type_param and value_param as <testcase> 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
Diffstat (limited to 'test/gtest_xml_output_unittest_.cc')
-rw-r--r--test/gtest_xml_output_unittest_.cc37
1 files changed, 33 insertions, 4 deletions
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<int> {};
+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 <typename T> class TypedTest : public Test {};
+typedef Types<int, long> 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 <typename T> class TypeParameterizedTestCase : public Test {};
+TYPED_TEST_CASE_P(TypeParameterizedTestCase);
+TYPED_TEST_P(TypeParameterizedTestCase, HasTypeParamAttribute) {}
+REGISTER_TYPED_TEST_CASE_P(TypeParameterizedTestCase, HasTypeParamAttribute);
+typedef Types<int, long> TypeParameterizedTestCaseTypes;
+INSTANTIATE_TYPED_TEST_CASE_P(Single,
+ TypeParameterizedTestCase,
+ TypeParameterizedTestCaseTypes);
+
int main(int argc, char** argv) {
InitGoogleTest(&argc, argv);