Пример #1
0
        public void Should_format_xml_without_description_nor_label_nor_details()
        {
            var result = ReportFormatterTestData.GetFeatureResultWithoutDescriptionNorLabelNorDetails();
            var text   = FormatResults(result);

            TestContext.WriteLine(text);

            const string expectedText = @"<?xml version=""1.0"" encoding=""utf-8""?>
<TestResults>
  <Summary TestExecutionStart=""2014-09-23T19:21:58.055Z"" TestExecutionEnd=""2014-09-23T19:21:58.08Z"" TestExecutionTime=""PT0.025S"">
    <Features Count=""1"" />
    <Scenarios Count=""1"" Passed=""0"" Bypassed=""0"" Failed=""0"" Ignored=""1"" />
    <Steps Count=""2"" Passed=""1"" Bypassed=""0"" Failed=""0"" Ignored=""1"" NotRun=""0"" />
  </Summary>
  <Feature Name=""My feature"" RuntimeId=""33333333-3333-3333-3333-333333333333"">
    <Scenario Status=""Ignored"" Name=""name"" ExecutionStart=""2014-09-23T19:21:58.055Z"" ExecutionTime=""PT0.025S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""name"" />
      <Step Status=""Passed"" Number=""1"" Name=""step1"" ExecutionStart=""2014-09-23T19:21:59.055Z"" ExecutionTime=""PT0.02S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step1"" />
      </Step>
      <Step Status=""Ignored"" Number=""2"" Name=""step2"" ExecutionStart=""2014-09-23T19:22:00.055Z"" ExecutionTime=""PT0.005S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step2"" />
      </Step>
    </Scenario>
  </Feature>
</TestResults>";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
            ValidateWithSchema(text);
        }
Пример #2
0
        public void Should_format_feature_without_description_nor_label_nor_details()
        {
            var result = ReportFormatterTestData.GetFeatureResultWithoutDescriptionNorLabelNorDetails();
            var text   = FormatResults(result);

            TestContext.WriteLine(text);
            const string expectedText = @"Summary:
	Test execution start time       : 2014-09-23 19:21:58 UTC
	Test execution end time         : 2014-09-23 19:21:58 UTC
	Test execution time             : 25ms
	Test execution time (aggregated): 25ms
	Number of features              : 1
	Number of scenarios             : 1
	Passed scenarios                : 0
	Bypassed scenarios              : 0
	Failed scenarios                : 0
	Ignored scenarios               : 1
	Number of steps                 : 2
	Passed steps                    : 1
	Bypassed steps                  : 0
	Failed steps                    : 0
	Ignored steps                   : 1
	Not Run steps                   : 0

Feature: My feature

	Scenario: name - Ignored (25ms)
		Step 1: step1 - Passed (20ms)
		Step 2: step2 - Ignored (5ms)
";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
Пример #3
0
        public void Should_format_feature_with_description()
        {
            var result = ReportFormatterTestData.GetFeatureResultWithDescription();
            var text   = FormatResults(result);

            TestContext.WriteLine(text);
            const string expectedText = @"Summary:
	Test execution start time       : 2014-09-23 19:21:58 UTC
	Test execution end time         : 2014-09-23 19:23:00 UTC
	Test execution time             : 1m 02s
	Test execution time (aggregated): 1m 04s
	Number of features              : 1
	Number of scenarios             : 2
	Passed scenarios                : 0
	Bypassed scenarios              : 0
	Failed scenarios                : 1
	Ignored scenarios               : 1
	Number of steps                 : 9
	Passed steps                    : 3
	Bypassed steps                  : 1
	Failed steps                    : 1
	Ignored steps                   : 2
	Not Run steps                   : 2

Feature: My feature [Label 1]
	My feature
	long description

	Scenario: name [Label 2] - Ignored (1m 02s)
		Categories: categoryA
		Step 1: call step1 ""arg1"" - Passed (1m 01s)
		Step 2: step2 - Ignored (1s 100ms)
			Step 2.1: substep 1 - Passed (100ms)
			Step 2.2: substep 2 - Passed (1s)
			Step 2.3: substep 3 - Ignored (0ms)
				Step 2.3.1: sub-substep 1 - NotRun
		Details:
			Step 2: Not implemented yet
		Comments:
			Step 1: multiline
				comment
			Step 1: comment 2
			Step 2.3: sub-comment
			Step 2.3.1: sub-sub-multiline
				comment

	Scenario: name2 ""arg1"" - Failed (2s 157ms)
		Categories: categoryB, categoryC
		Step 1: step3 - Bypassed (2s 107ms)
		Step 2: step4 - Failed (50ms)
		Step 3: step5 - NotRun
		Details:
			Step 1: bypass reason
			Step 2: Expected: True
				  But was: False
";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
        public void Should_format_feature_with_description()
        {
            var result = ReportFormatterTestData.GetFeatureResultWithDescription();

            var text = FormatAndExtractText(result);

            TestContext.WriteLine(text);
            var expectedText = $@"Execution summary
Test execution start time: 2014-09-23 19:21:58 UTC
Test execution end time: 2014-09-23 19:23:00 UTC
Test execution time: 1m 02s
Test execution time (aggregated): 1m 04s
Number of features: 1
Number of scenarios: 2
Passed scenarios: 0
Bypassed scenarios: 0
Failed scenarios: 1 (see details)
Ignored scenarios: 1 (see details)
Number of steps: 5
Passed steps: 1
Bypassed steps: 1
Failed steps: 1
Ignored steps: 1
Not Run steps: 1
Feature summary
Feature Scenarios Passed Bypassed Failed Ignored Steps Passed Bypassed Failed Ignored Not Run Duration Aggregated Average
My feature [Label 1] 2 0 0 1 1 5 1 1 1 1 1 1m 02s 621000000 1m 04s 642570000 32s 128ms 321285000
Feature details[&#8734;link]
Toggle: Features Scenarios
Filter: Passed Bypassed Failed Ignored Not Run
Categories: -all- categoryA categoryB categoryC -without category-
[&#8734;filtered link]
My feature [Label 1][&#8734;link]
My feature
long description
Ignored name [Label 2] (1m 02s)[&#8734;link]
categoryA
Passed 1. call step1 ""arg1"" (1m 01s)
Ignored 2. step2 (1s 100ms)
Step 2: Not implemented yet
// Step 1: multiline
comment
// Step 1: comment 2
Failed name2 ""arg1"" (2s 157ms)[&#8734;link]
categoryB, categoryC
Bypassed 1. step3 (2s 107ms)
Failed 2. step4 (50ms)
NotRun 3. step5
Step 1: bypass reason
Step 2: Expected: True
	  But was: False
Generated with LightBDD v{GetExpectedLightBddVersion()}
initialize();";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
Пример #5
0
        public void Should_format_multiple_features()
        {
            var results = ReportFormatterTestData.GetMultipleFeatureResults();
            var text    = FormatAndExtractText(results);

            TestContext.WriteLine(text);
            var expectedText = $@"Execution summary
Test execution start time: 2014-09-23 19:21:58 UTC
Test execution end time: 2014-09-23 19:22:01 UTC
Test execution time: 3s 020ms
Test execution time (aggregated): 40ms
Number of features: 2
Number of scenarios: 2
Passed scenarios: 2
Bypassed scenarios: 0
Failed scenarios: 0
Ignored scenarios: 0
Number of steps: 2
Passed steps: 2
Bypassed steps: 0
Failed steps: 0
Ignored steps: 0
Not Run steps: 0
Feature summary
Feature Scenarios Passed Bypassed Failed Ignored Steps Passed Bypassed Failed Ignored Not Run Duration Aggregated Average
My feature 1 1 0 0 0 1 1 0 0 0 0 20ms 200000 20ms 200000 20ms 200000
My feature2 1 1 0 0 0 1 1 0 0 0 0 20ms 200000 20ms 200000 20ms 200000
Feature details[&#8734;link]
Toggle: Features Scenarios
Filter: Passed Bypassed Failed Ignored Not Run
Categories: -all- categoryA categoryB -without category-
[&#8734;filtered link]
My feature[&#8734;link]
Passed scenario1 (20ms)[&#8734;link]
categoryA
Passed 1. step1 (20ms)
My feature2[&#8734;link]
Passed scenario1 (20ms)[&#8734;link]
categoryB
Passed 1. step1 (20ms)
Generated with LightBDD v{GetExpectedLightBddVersion()}
initialize();";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
        public void Should_format_scenarios_in_order()
        {
            var results = ReportFormatterTestData.GetFeatureWithUnsortedScenarios();
            var text    = FormatAndExtractText(results);

            TestContext.WriteLine(text);
            string expectedText = $@"Execution summary
Test execution start time: 2014-09-23 19:21:57 UTC
Test execution end time: 2014-09-23 19:22:02 UTC
Test execution time: 5s
Test execution time (aggregated): 9s
Number of features: 1
Number of scenarios: 3
Passed scenarios: 3
Bypassed scenarios: 0
Failed scenarios: 0
Ignored scenarios: 0
Number of steps: 3
Passed steps: 3
Bypassed steps: 0
Failed steps: 0
Ignored steps: 0
Not Run steps: 0
Feature summary
Feature Scenarios Passed Bypassed Failed Ignored Steps Passed Bypassed Failed Ignored Not Run Duration Aggregated Average
My Feature 3 3 0 0 0 3 3 0 0 0 0 5s 50000000 9s 90000000 3s 30000000
Feature details[&#8734;link]
Toggle: Features Scenarios
Filter: Passed Bypassed Failed Ignored Not Run
[&#8734;filtered link]
My Feature[&#8734;link]
Passed scenario A [lab B] (2s)[&#8734;link]
Passed 1. step
Passed scenario B [lab C] (5s)[&#8734;link]
Passed 1. step
Passed scenario C [lab A] (2s)[&#8734;link]
Passed 1. step
Generated with LightBDD v{GetExpectedLightBddVersion()}
initialize();";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
Пример #7
0
        public void Should_format_scenarios_in_order()
        {
            var results = ReportFormatterTestData.GetFeatureWithUnsortedScenarios();

            var text = FormatResults(results);

            TestContext.WriteLine(text);
            const string expectedText = @"<?xml version=""1.0"" encoding=""utf-8""?>
<TestResults>
  <Summary TestExecutionStart=""2014-09-23T19:21:57.055Z"" TestExecutionEnd=""2014-09-23T19:22:02.055Z"" TestExecutionTime=""PT5S"">
    <Features Count=""1"" />
    <Scenarios Count=""3"" Passed=""3"" Bypassed=""0"" Failed=""0"" Ignored=""0"" />
    <Steps Count=""3"" Passed=""3"" Bypassed=""0"" Failed=""0"" Ignored=""0"" NotRun=""0"" />
  </Summary>
  <Feature Name=""My Feature"" RuntimeId=""33333333-3333-3333-3333-333333333333"">
    <Scenario Status=""Passed"" Name=""scenario A"" ExecutionStart=""2014-09-23T19:21:57.057Z"" ExecutionTime=""PT2S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""scenario A"" />
      <Label Name=""lab B"" />
      <Step Status=""Passed"" Number=""1"" Name=""step"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step"" />
      </Step>
    </Scenario>
    <Scenario Status=""Passed"" Name=""scenario B"" ExecutionStart=""2014-09-23T19:21:57.055Z"" ExecutionTime=""PT5S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""scenario B"" />
      <Label Name=""lab C"" />
      <Step Status=""Passed"" Number=""1"" Name=""step"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step"" />
      </Step>
    </Scenario>
    <Scenario Status=""Passed"" Name=""scenario C"" ExecutionStart=""2014-09-23T19:21:57.055Z"" ExecutionTime=""PT2S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""scenario C"" />
      <Label Name=""lab A"" />
      <Step Status=""Passed"" Number=""1"" Name=""step"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step"" />
      </Step>
    </Scenario>
  </Feature>
</TestResults>";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
            ValidateWithSchema(text);
        }
Пример #8
0
        public void Should_format_multiple_features()
        {
            var results = ReportFormatterTestData.GetMultipleFeatureResults();

            var text = FormatResults(results);

            TestContext.WriteLine(text);
            const string expectedText = @"Summary:
	Test execution start time       : 2014-09-23 19:21:58 UTC
	Test execution end time         : 2014-09-23 19:22:01 UTC
	Test execution time             : 3s 020ms
	Test execution time (aggregated): 40ms
	Number of features              : 2
	Number of scenarios             : 2
	Passed scenarios                : 2
	Bypassed scenarios              : 0
	Failed scenarios                : 0
	Ignored scenarios               : 0
	Number of steps                 : 2
	Passed steps                    : 2
	Bypassed steps                  : 0
	Failed steps                    : 0
	Ignored steps                   : 0
	Not Run steps                   : 0

Feature: My feature

	Scenario: scenario1 - Passed (20ms)
		Categories: categoryA
		Step 1: step1 - Passed (20ms)

Feature: My feature2

	Scenario: scenario1 - Passed (20ms)
		Categories: categoryB
		Step 1: step1 - Passed (20ms)
";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
Пример #9
0
        public void Should_format_feature_without_description_nor_label_nor_details()
        {
            var result = ReportFormatterTestData.GetFeatureResultWithoutDescriptionNorLabelNorDetails();

            var text = FormatAndExtractText(result);

            TestContext.WriteLine(text);
            var expectedText = $@"Execution summary
Test execution start time: 2014-09-23 19:21:58 UTC
Test execution end time: 2014-09-23 19:21:58 UTC
Test execution time: 25ms
Test execution time (aggregated): 25ms
Number of features: 1
Number of scenarios: 1
Passed scenarios: 0
Bypassed scenarios: 0
Failed scenarios: 0
Ignored scenarios: 1 (see details)
Number of steps: 2
Passed steps: 1
Bypassed steps: 0
Failed steps: 0
Ignored steps: 1
Not Run steps: 0
Feature summary
Feature Scenarios Passed Bypassed Failed Ignored Steps Passed Bypassed Failed Ignored Not Run Duration Aggregated Average
My feature 1 0 0 0 1 2 1 0 0 1 0 25ms 250000 25ms 250000 25ms 250000
Feature details[&#8734;link]
Toggle: Features Scenarios
Filter: Passed Bypassed Failed Ignored Not Run
[&#8734;filtered link]
My feature[&#8734;link]
Ignored name (25ms)[&#8734;link]
Passed 1. step1 (20ms)
Ignored 2. step2 (5ms)
Generated with LightBDD v{GetExpectedLightBddVersion()}
initialize();";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
Пример #10
0
        public void Should_format_scenarios_in_order()
        {
            var results = ReportFormatterTestData.GetFeatureWithUnsortedScenarios();

            var text = FormatResults(results);

            TestContext.WriteLine(text);
            const string expectedText = @"Summary:
	Test execution start time       : 2014-09-23 19:21:57 UTC
	Test execution end time         : 2014-09-23 19:22:02 UTC
	Test execution time             : 5s
	Test execution time (aggregated): 9s
	Number of features              : 1
	Number of scenarios             : 3
	Passed scenarios                : 3
	Bypassed scenarios              : 0
	Failed scenarios                : 0
	Ignored scenarios               : 0
	Number of steps                 : 3
	Passed steps                    : 3
	Bypassed steps                  : 0
	Failed steps                    : 0
	Ignored steps                   : 0
	Not Run steps                   : 0

Feature: My Feature

	Scenario: scenario A [lab B] - Passed (2s)
		Step 1: step - Passed

	Scenario: scenario B [lab C] - Passed (5s)
		Step 1: step - Passed

	Scenario: scenario C [lab A] - Passed (2s)
		Step 1: step - Passed
";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
        }
Пример #11
0
        public void Should_format_multiple_features()
        {
            var results = ReportFormatterTestData.GetMultipleFeatureResults();

            var text = FormatResults(results);

            TestContext.WriteLine(text);
            const string expectedText = @"<?xml version=""1.0"" encoding=""utf-8""?>
<TestResults>
  <Summary TestExecutionStart=""2014-09-23T19:21:58.055Z"" TestExecutionEnd=""2014-09-23T19:22:01.075Z"" TestExecutionTime=""PT3.02S"">
    <Features Count=""2"" />
    <Scenarios Count=""2"" Passed=""2"" Bypassed=""0"" Failed=""0"" Ignored=""0"" />
    <Steps Count=""2"" Passed=""2"" Bypassed=""0"" Failed=""0"" Ignored=""0"" NotRun=""0"" />
  </Summary>
  <Feature Name=""My feature"" RuntimeId=""33333333-3333-3333-3333-333333333333"">
    <Scenario Status=""Passed"" Name=""scenario1"" ExecutionStart=""2014-09-23T19:21:58.055Z"" ExecutionTime=""PT0.02S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""scenario1"" />
      <Category Name=""categoryA"" />
      <Step Status=""Passed"" Number=""1"" Name=""step1"" ExecutionStart=""2014-09-23T19:21:59.055Z"" ExecutionTime=""PT0.02S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step1"" />
      </Step>
    </Scenario>
  </Feature>
  <Feature Name=""My feature2"" RuntimeId=""33333333-3333-3333-3333-333333333333"">
    <Scenario Status=""Passed"" Name=""scenario1"" ExecutionStart=""2014-09-23T19:22:01.055Z"" ExecutionTime=""PT0.02S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""scenario1"" />
      <Category Name=""categoryB"" />
      <Step Status=""Passed"" Number=""1"" Name=""step1"" ExecutionStart=""2014-09-23T19:22:02.055Z"" ExecutionTime=""PT0.02S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step1"" />
      </Step>
    </Scenario>
  </Feature>
</TestResults>";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
            ValidateWithSchema(text);
        }
Пример #12
0
        public void Should_format_xml()
        {
            var result = ReportFormatterTestData.GetFeatureResultWithDescription();
            var text   = FormatResults(result);

            TestContext.WriteLine(text);

            const string expectedText = @"<?xml version=""1.0"" encoding=""utf-8""?>
<TestResults>
  <Summary TestExecutionStart=""2014-09-23T19:21:58.055Z"" TestExecutionEnd=""2014-09-23T19:23:00.155Z"" TestExecutionTime=""PT1M2.1S"">
    <Features Count=""1"" />
    <Scenarios Count=""2"" Passed=""0"" Bypassed=""0"" Failed=""1"" Ignored=""1"" />
    <Steps Count=""10"" Passed=""3"" Bypassed=""1"" Failed=""2"" Ignored=""2"" NotRun=""2"" />
  </Summary>
  <Feature Name=""My feature"" RuntimeId=""33333333-3333-3333-3333-333333333333"">
    <Label Name=""Label 1"" />
    <Description>My feature
long description</Description>
    <Scenario Status=""Ignored"" Name=""name"" ExecutionStart=""2014-09-23T19:21:58.055Z"" ExecutionTime=""PT1M2.1S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""name"" />
      <Label Name=""Label 2"" />
      <Category Name=""categoryA"" />
      <Step Status=""Passed"" Number=""1"" Name=""call step1 &quot;arg1&quot;"" ExecutionStart=""2014-09-23T19:21:59.055Z"" ExecutionTime=""PT1M1S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName StepType=""call"" Format=""step1 &quot;{0}&quot;"">
          <Parameter IsEvaluated=""true"">arg1</Parameter>
        </StepName>
        <Comment>multiline
comment</Comment>
        <Comment>comment 2</Comment>
      </Step>
      <Step Status=""Ignored"" Number=""2"" Name=""step2"" ExecutionStart=""2014-09-23T19:22:00.055Z"" ExecutionTime=""PT1.1S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StatusDetails>Not implemented yet</StatusDetails>
        <StepName Format=""step2"" />
        <SubStep Status=""Passed"" Number=""1"" Name=""substep 1"" ExecutionStart=""2014-09-23T19:22:00.055Z"" ExecutionTime=""PT0.1S"" GroupPrefix=""2."" RuntimeId=""11111111-1111-1111-1111-111111111111"">
          <StepName Format=""substep 1"" />
        </SubStep>
        <SubStep Status=""Passed"" Number=""2"" Name=""substep 2"" ExecutionStart=""2014-09-23T19:22:00.155Z"" ExecutionTime=""PT1S"" GroupPrefix=""2."" RuntimeId=""11111111-1111-1111-1111-111111111111"">
          <StepName Format=""substep 2"" />
        </SubStep>
        <SubStep Status=""Ignored"" Number=""3"" Name=""substep 3"" ExecutionStart=""2014-09-23T19:22:01.155Z"" ExecutionTime=""PT0S"" GroupPrefix=""2."" RuntimeId=""11111111-1111-1111-1111-111111111111"">
          <StatusDetails>Not implemented yet</StatusDetails>
          <StepName Format=""substep 3"" />
          <Comment>sub-comment</Comment>
          <SubStep Status=""Failed"" Number=""1"" Name=""sub-substep 1"" GroupPrefix=""2.3."" RuntimeId=""11111111-1111-1111-1111-111111111111"">
            <StepName Format=""sub-substep 1"" />
            <Parameter Name=""table1"">
              <Table Status=""Failure"" Message=""tabular message"">
                <Column Index=""0"" Name=""Key"" IsKey=""true"" />
                <Column Index=""1"" Name=""X"" IsKey=""false"" />
                <Column Index=""2"" Name=""Y"" IsKey=""false"" />
                <Row Status=""Success"" Type=""Matching"" Message=""row message"">
                  <Value Index=""0"" Status=""NotApplicable"" Value=""Key1"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""1"" Status=""NotApplicable"" Value=""1"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""2"" Status=""NotApplicable"" Value=""2"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                </Row>
                <Row Status=""Failure"" Type=""Matching"" Message=""row message"">
                  <Value Index=""0"" Status=""NotApplicable"" Value=""Key2"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""1"" Status=""Failure"" Value=""1"" Expectation=""2"" Message=""value message"" />
                  <Value Index=""2"" Status=""NotApplicable"" Value=""4"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                </Row>
                <Row Status=""Failure"" Type=""Missing"" Message=""row message"">
                  <Value Index=""0"" Status=""NotApplicable"" Value=""Key3"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""1"" Status=""Failure"" Value=""&lt;none&gt;"" Expectation=""3"" Message=""value message"" />
                  <Value Index=""2"" Status=""Failure"" Value=""&lt;none&gt;"" Expectation=""6"" Message=""value message"" />
                </Row>
                <Row Status=""Failure"" Type=""Surplus"" Message=""row message"">
                  <Value Index=""0"" Status=""NotApplicable"" Value=""Key4"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""1"" Status=""Failure"" Value=""3"" Expectation=""&lt;none&gt;"" Message=""value message"" />
                  <Value Index=""2"" Status=""Failure"" Value=""6"" Expectation=""&lt;none&gt;"" Message=""value message"" />
                </Row>
              </Table>
            </Parameter>
            <Parameter Name=""table2"">
              <Table Status=""NotApplicable"" Message=""tabular message"">
                <Column Index=""0"" Name=""Key"" IsKey=""true"" />
                <Column Index=""1"" Name=""X"" IsKey=""false"" />
                <Column Index=""2"" Name=""Y"" IsKey=""false"" />
                <Row Status=""NotApplicable"" Type=""Matching"" Message=""row message"">
                  <Value Index=""0"" Status=""NotApplicable"" Value=""Key1"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""1"" Status=""NotApplicable"" Value=""1"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""2"" Status=""NotApplicable"" Value=""2"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                </Row>
                <Row Status=""NotApplicable"" Type=""Matching"" Message=""row message"">
                  <Value Index=""0"" Status=""NotApplicable"" Value=""Key2"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""1"" Status=""NotApplicable"" Value=""2"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""2"" Status=""NotApplicable"" Value=""4"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                </Row>
                <Row Status=""NotApplicable"" Type=""Matching"" Message=""row message"">
                  <Value Index=""0"" Status=""NotApplicable"" Value=""Key3"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""1"" Status=""NotApplicable"" Value=""3"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                  <Value Index=""2"" Status=""NotApplicable"" Value=""6"" Expectation=""&lt;null&gt;"" Message=""value message"" />
                </Row>
              </Table>
            </Parameter>
            <Parameter Name=""inline"">
              <Value Status=""NotApplicable"" Value=""foo"" Message=""inline message"" />
            </Parameter>
            <Comment>sub-sub-multiline
comment</Comment>
          </SubStep>
          <SubStep Status=""NotRun"" Number=""2"" Name=""sub-substep 2"" GroupPrefix=""2.3."" RuntimeId=""11111111-1111-1111-1111-111111111111"">
            <StepName Format=""sub-substep 2"" />
          </SubStep>
        </SubStep>
      </Step>
      <StatusDetails>Step 2: Not implemented yet</StatusDetails>
    </Scenario>
    <Scenario Status=""Failed"" Name=""name2 &quot;arg1&quot;"" ExecutionStart=""2014-09-23T19:22:01.055Z"" ExecutionTime=""PT2.157S"" RuntimeId=""22222222-2222-2222-2222-222222222222"">
      <Name Format=""name2 &quot;{0}&quot;"">
        <Parameter IsEvaluated=""true"">arg1</Parameter>
      </Name>
      <Category Name=""categoryB"" />
      <Category Name=""categoryC"" />
      <Step Status=""Bypassed"" Number=""1"" Name=""step3"" ExecutionStart=""2014-09-23T19:22:02.055Z"" ExecutionTime=""PT2.107S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StatusDetails>bypass reason</StatusDetails>
        <StepName Format=""step3"" />
      </Step>
      <Step Status=""Failed"" Number=""2"" Name=""step4"" ExecutionStart=""2014-09-23T19:22:03.055Z"" ExecutionTime=""PT0.05S"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StatusDetails>  Expected: True
  But was: False</StatusDetails>
        <StepName Format=""step4"" />
      </Step>
      <Step Status=""NotRun"" Number=""3"" Name=""step5"" RuntimeId=""11111111-1111-1111-1111-111111111111"">
        <StepName Format=""step5"" />
      </Step>
      <StatusDetails>Step 1: bypass reason
Step 2: Expected: True
	  But was: False</StatusDetails>
    </Scenario>
  </Feature>
</TestResults>";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
            ValidateWithSchema(text);
        }
        public void Should_format_xml()
        {
            var result = ReportFormatterTestData.GetFeatureResultWithDescription();
            var text   = FormatResults(result);

            TestContext.WriteLine(text);

            const string expectedText = @"<?xml version=""1.0"" encoding=""utf-8""?>
<TestResults>
  <Summary TestExecutionStart=""2014-09-23T19:21:58.055Z"" TestExecutionEnd=""2014-09-23T19:23:00.155Z"" TestExecutionTime=""PT1M2.1S"">
    <Features Count=""1"" />
    <Scenarios Count=""2"" Passed=""0"" Bypassed=""0"" Failed=""1"" Ignored=""1"" />
    <Steps Count=""9"" Passed=""3"" Bypassed=""1"" Failed=""1"" Ignored=""2"" NotRun=""2"" />
  </Summary>
  <Feature Name=""My feature"">
    <Label Name=""Label 1"" />
    <Description>My feature
long description</Description>
    <Scenario Status=""Ignored"" Name=""name"" ExecutionStart=""2014-09-23T19:21:58.055Z"" ExecutionTime=""PT1M2.1S"">
      <Name Format=""name"" />
      <Label Name=""Label 2"" />
      <Category Name=""categoryA"" />
      <Step Status=""Passed"" Number=""1"" Name=""call step1 &quot;arg1&quot;"" ExecutionStart=""2014-09-23T19:21:59.055Z"" ExecutionTime=""PT1M1S"">
        <StepName StepType=""call"" Format=""step1 &quot;{0}&quot;"">
          <Parameter IsEvaluated=""true"">arg1</Parameter>
        </StepName>
        <Comment>multiline
comment</Comment>
        <Comment>comment 2</Comment>
      </Step>
      <Step Status=""Ignored"" Number=""2"" Name=""step2"" ExecutionStart=""2014-09-23T19:22:00.055Z"" ExecutionTime=""PT1.1S"">
        <StatusDetails>Not implemented yet</StatusDetails>
        <StepName Format=""step2"" />
        <SubStep Status=""Passed"" Number=""1"" Name=""substep 1"" ExecutionStart=""2014-09-23T19:22:00.055Z"" ExecutionTime=""PT0.1S"" GroupPrefix=""2."">
          <StepName Format=""substep 1"" />
        </SubStep>
        <SubStep Status=""Passed"" Number=""2"" Name=""substep 2"" ExecutionStart=""2014-09-23T19:22:00.155Z"" ExecutionTime=""PT1S"" GroupPrefix=""2."">
          <StepName Format=""substep 2"" />
        </SubStep>
        <SubStep Status=""Ignored"" Number=""3"" Name=""substep 3"" ExecutionStart=""2014-09-23T19:22:01.155Z"" ExecutionTime=""PT0S"" GroupPrefix=""2."">
          <StatusDetails>Not implemented yet</StatusDetails>
          <StepName Format=""substep 3"" />
          <Comment>sub-comment</Comment>
          <SubStep Status=""NotRun"" Number=""1"" Name=""sub-substep 1"" GroupPrefix=""2.3."">
            <StepName Format=""sub-substep 1"" />
            <Comment>sub-sub-multiline
comment</Comment>
          </SubStep>
        </SubStep>
      </Step>
      <StatusDetails>Step 2: Not implemented yet</StatusDetails>
    </Scenario>
    <Scenario Status=""Failed"" Name=""name2 &quot;arg1&quot;"" ExecutionStart=""2014-09-23T19:22:01.055Z"" ExecutionTime=""PT2.157S"">
      <Name Format=""name2 &quot;{0}&quot;"">
        <Parameter IsEvaluated=""true"">arg1</Parameter>
      </Name>
      <Category Name=""categoryB"" />
      <Category Name=""categoryC"" />
      <Step Status=""Bypassed"" Number=""1"" Name=""step3"" ExecutionStart=""2014-09-23T19:22:02.055Z"" ExecutionTime=""PT2.107S"">
        <StatusDetails>bypass reason</StatusDetails>
        <StepName Format=""step3"" />
      </Step>
      <Step Status=""Failed"" Number=""2"" Name=""step4"" ExecutionStart=""2014-09-23T19:22:03.055Z"" ExecutionTime=""PT0.05S"">
        <StatusDetails>  Expected: True
  But was: False</StatusDetails>
        <StepName Format=""step4"" />
      </Step>
      <Step Status=""NotRun"" Number=""3"" Name=""step5"">
        <StepName Format=""step5"" />
      </Step>
      <StatusDetails>Step 1: bypass reason
Step 2: Expected: True
	  But was: False</StatusDetails>
    </Scenario>
  </Feature>
</TestResults>";

            Assert.That(text.NormalizeNewLine(), Is.EqualTo(expectedText.NormalizeNewLine()));
            ValidateWithSchema(text);
        }