public void CanGenerateOutput()
        {
            var scenario = new SbeScenario {
                Title = "Scenario Title", Outcome = Outcome.Passed
            };
            var feature = new SbeFeature(title: "Feature Title", scenarios: new[] { scenario });

            var collectedTests = new SbeAssembly[]
            {
                new SbeAssembly(
                    name: "some.strange.assembly",
                    epics: new[] { new SbeEpic(name: "Some Epic", features: new[] { feature }) })
            };

            string outputFileName = null;
            string outputContent  = null;

            var generator = new JsonSummaryGenerator((file, json) => { outputFileName = file; outputContent = json; });

            generator.Generate(collectedTests);

            Assert.That(outputFileName, Is.EqualTo("\\some.strange.assembly.summary.sbe.json"), "FileName");

            var output = JObject.Parse(outputContent);

            Assert.That(output["epics"].HasValues, Is.True, "Should contain epics");
        }
示例#2
0
        internal static void RegisterScenario(SbeScenario scenario, SpecflowContextWrapper specflowContext)
        {
            var assembly = GetCurrentAssembly(scenario.AssemblyName);
            var epic     = GetCurrentEpic(assembly, specflowContext);
            var feature  = GetCurrentFeature(epic, specflowContext);

            feature.Scenarios.Add(scenario);
        }
示例#3
0
 private void WriteScenario(SbeScenario scenario)
 {
     xml.StartElement("scenario");
     xml.AttributeString("success", scenario.Success().ToString());
     xml.AttributeString("outcome", scenario.Outcome.ToString());
     xml.CDataElementString("title", scenario.Title);
     WriteTags(scenario.Tags);
     xml.EndElement();
 }
        public void CanGeneratePdf()
        {
            var scenario = new SbeScenario {
                Title = "Scenario Title", Outcome = Outcome.Passed
            };
            var feature = new SbeFeature(title: "Feature Title", scenarios: new[] { scenario });

            feature.FeatureText = @"@current
Feature: Implemented Feature
	Some description

Scenario: Add two numbers for implemented calculator
	Given I have entered 50 into the calculator
	And I have entered 70 into the calculator
	When I press add
	Then the result should be 120 on the screen"    ;

            var collectedTests = new SbeAssembly[]
            {
                new SbeAssembly(
                    name: "some.strange.assembly",
                    epics: new[] { new SbeEpic(name: "Some Epic", features: new[] { feature }) })
            };

            string outputFileName = null;

            byte[] outputContent = null;

            var generator = new PdfGenerator("testing", OutputFilter.All, (file, bytes) => { outputFileName = file; outputContent = bytes; });

            generator.Generate(collectedTests);

            Assert.That(outputFileName, Is.EqualTo("\\some.strange.assembly.testing.sbe.pdf"), "FileName");

            var firstFourBytes = Convert.ToBase64String(outputContent.Take(4).ToArray());

            Assert.That(firstFourBytes, Is.EqualTo("JVBERg=="));
        }