Skip to content

Commit

Permalink
Merge branch 'release-2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Rombauts committed Feb 26, 2016
2 parents 6f35f35 + 1f7a3a7 commit eaa338b
Show file tree
Hide file tree
Showing 149 changed files with 10,236 additions and 3,850 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ This project adheres to [Semantic Versioning](http://semver.org). We consider th

This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com).

## [Unreleased]

## [2.4.0] - 2016-02-26

### Added

- Support for the test result format of VsTest.Console.exe ([#280](https://github.com/picklesdoc/pickles/issues/280)) (by [@dirkrombauts](https://github.com/dirkrombauts)).

### Changed

- The MsTest test result provider is now able to give the result of individual examples in a scenario outline ([#285](https://github.com/picklesdoc/pickles/issues/285)) (by [@dirkrombauts](https://github.com/dirkrombauts)).
- The SpecFlow+ Runner (formerly SpecRun) test result provider is now able to give the result of individual examples in a scenario outline. See the [documentation](http://docs.picklesdoc.com/en/latest/IntegratingTestResultsFromSpecRun/) for an important caveat. ([#286](https://github.com/picklesdoc/pickles/issues/286)) (by [@dirkrombauts](https://github.com/dirkrombauts)).
- The Cucumber test result provider is now able to give the result of individual examples in a scenario outline ([#287](https://github.com/picklesdoc/pickles/issues/287)) (by [@dirkrombauts](https://github.com/dirkrombauts)).
- The GUI now uses a combobox to display the choice of test result formats ([#297](https://github.com/picklesdoc/pickles/issues/297)) (by [@dirkrombauts](https://github.com/dirkrombauts)).


### Fixed

- Word document is corrupt if a Feature has no description ([#261](https://github.com/picklesdoc/pickles/issues/261)) (by [@dirkrombauts](https://github.com/dirkrombauts)).
- The Cucumber JSON test result provider should deal with background steps correctly ([#293](https://github.com/picklesdoc/pickles/issues/293)) (by [@dirkrombauts](https://github.com/dirkrombauts) based on [an idea by MikeThomas64](https://github.com/picklesdoc/pickles/pull/251)).

## [2.3.0] - 2016-01-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Supported Test Runner Integrations
- xUnit (versions 1.x and 2.x)
- MSTest
- Cucumber JSON
- SpecRun
- SpecFlow+ Runner (formerly known as SpecRun)

Contributing
------------
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
set "picklesVersion=2.3.0"
set "picklesVersion=2.4.0"

cls

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Feature: Showing basic gherkin syntax
In order to see that gherkin is a very simple langauge
In order to see that gherkin is a very simple language
As a SpecFlow evangelist
I want to show that basic syntax

Expand Down
2 changes: 0 additions & 2 deletions src/Pickles/Pickles.ObjectModel/ObjectModel/ITestResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ namespace PicklesDoc.Pickles.ObjectModel
{
public interface ITestResults
{
bool SupportsExampleResults { get; }

TestResult GetFeatureResult(Feature feature);

TestResult GetScenarioOutlineResult(ScenarioOutline scenarioOutline);
Expand Down
81 changes: 18 additions & 63 deletions src/Pickles/Pickles.ObjectModel/ObjectModel/TestResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,81 +30,24 @@ public enum TestResult
Failed,
Passed
}
/*
public struct TestResult
{
private TestResult(bool wasExecuted, bool wasSuccessful)
{
this.WasExecuted = wasExecuted;
this.WasSuccessful = wasSuccessful;
}
public static TestResult Passed { get; } = new TestResult(wasExecuted: true, wasSuccessful: true);
public static TestResult Failed { get; } = new TestResult(wasExecuted: true, wasSuccessful: false);
public static TestResult Inconclusive { get; } = new TestResult(wasExecuted: false, wasSuccessful: false);
public bool WasExecuted { get; }
public bool WasSuccessful { get; }
public bool Equals(TestResult other)
{
return this.WasExecuted.Equals(other.WasExecuted) && this.WasSuccessful.Equals(other.WasSuccessful);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is TestResult && Equals((TestResult)obj);
}
public override int GetHashCode()
{
int hashCode = this.WasExecuted.GetHashCode();
hashCode = hashCode ^ this.WasSuccessful.GetHashCode();
return hashCode;
}
public override string ToString()
{
return $"WasExecuted: {this.WasExecuted}, WasSuccessful: {this.WasSuccessful}";
}
public static bool operator ==(TestResult left, TestResult right)
{
return left.Equals(right);
}
public static bool operator !=(TestResult left, TestResult right)
{
return !(left == right);
}
}
*/

public static class TestResultExtensions
{
public static TestResult Merge(this IEnumerable<TestResult> testResults)
public static TestResult Merge(this IEnumerable<TestResult> testResults, bool passedTrumpsInconclusive = false)
{
if (testResults == null)
{
throw new ArgumentNullException("testResults");
throw new ArgumentNullException(nameof(testResults));
}

TestResult[] items = testResults.ToArray();

if (!items.Any())
{
return new TestResult();
return TestResult.Inconclusive;
}

if (items.Count() == 1)
if (items.Length == 1)
{
return items.Single();
}
Expand All @@ -114,12 +57,24 @@ public static TestResult Merge(this IEnumerable<TestResult> testResults)
return TestResult.Failed;
}

if (items.Any(i => i == TestResult.Inconclusive))
if (passedTrumpsInconclusive)
{
if (items.Any(r => r == TestResult.Passed))
{
return TestResult.Passed;
}

return TestResult.Inconclusive;
}
else
{
if (items.Any(i => i == TestResult.Inconclusive))
{
return TestResult.Inconclusive;
}

return TestResult.Passed;
return TestResult.Passed;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<ProjectConfiguration>
<AutoDetectNugetBuildDependencies>true</AutoDetectNugetBuildDependencies>
<BuildPriority>1000</BuildPriority>
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
<AllowCodeAnalysis>false</AllowCodeAnalysis>
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
<RunPreBuildEvents>false</RunPreBuildEvents>
<RunPostBuildEvents>false</RunPostBuildEvents>
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
<InstrumentAssembly>true</InstrumentAssembly>
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<DetectStackOverflow>true</DetectStackOverflow>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration />
<UseBuildPlatform />
<ProxyProcessPath />
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<MSTestThreadApartmentState>STA</MSTestThreadApartmentState>
<BuildProcessArchitecture>x86</BuildProcessArchitecture>
</ProjectConfiguration>
14 changes: 12 additions & 2 deletions src/Pickles/Pickles.ObjectModel/TestResultsFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ public enum TestResultsFormat
/// <summary>
/// xUnit 1 format.
/// </summary>
xUnit,
XUnit,

/// <summary>
/// xUnit 1 format.
/// </summary>
XUnit1,

/// <summary>
/// Microsoft Test format.
Expand All @@ -60,6 +65,11 @@ public enum TestResultsFormat
/// <summary>
/// NUnit 3 format.
/// </summary>
NUnit3
NUnit3,

/// <summary>
/// The format produced by VsTest console.
/// </summary>
VsTest
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ public void Tables_are_formatted_as_list_items_with_tables_internal()
"Column 1"),
new XElement(
xmlns + "th",
"Column 2"))),
"Column 2"),
new XElement(
xmlns + "th",
" "))),
new XElement(
xmlns + "tbody",
new XElement(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="WordDescriptionFormatterTests.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;

using NFluent;

using NUnit.Framework;

using PicklesDoc.Pickles.DocumentationBuilders.Word;

namespace PicklesDoc.Pickles.Test.DocumentationBuilders.Word
{
[TestFixture]
public class WordDescriptionFormatterTests
{
[Test]
public void SplitDescription_NullArgument_DoesNotThrowException()
{
Check.ThatCode(() => WordDescriptionFormatter.SplitDescription(null))
.DoesNotThrow();
}

[Test]
public void SplitDescription_NullArgument_ReturnsEmptyArgument()
{
string[] descriptions = WordDescriptionFormatter.SplitDescription(null);

Check.That(descriptions.Length).IsEqualTo(0);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class HtmlScenarioOutlineFormatterTests : BaseFixture
public void Setup()
{
var fakeTestResults = new Mock<ITestResults>();
fakeTestResults.Setup(ftr => ftr.SupportsExampleResults).Returns(false);

this.formatter = new HtmlScenarioOutlineFormatter(
Container.Resolve<HtmlStepFormatter>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public string Setup()
};
configuration.AddTestResultFile(FileSystem.FileInfo.FromFileName(TestResultFilePath));

ITestResults testResults = new MsTestResults(configuration);
ITestResults testResults = new MsTestResults(configuration, new MsTestSingleResultLoader(), new MsTestScenarioOutlineExampleMatcher());
var jsonDocumentationBuilder = new JsonDocumentationBuilder(configuration, testResults, FileSystem);
jsonDocumentationBuilder.Build(features);
string content = FileSystem.File.ReadAllText(filePath);
Expand Down
1 change: 1 addition & 0 deletions src/Pickles/Pickles.Test/Pickles.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>FormattingAFeature.feature</DependentUpon>
</Compile>
<Compile Include="DocumentationBuilders\Word\WordDescriptionFormatterTests.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="ObjectModel\Factory.cs" />
<Compile Include="ObjectModel\Json\JsonScenarioTests.cs" />
Expand Down
34 changes: 30 additions & 4 deletions src/Pickles/Pickles.Test/WhenParsingCommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ public void ThenCanParseResultsFormatNunitWithShortFormSuccessfully()
Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.NUnit);
}

[Test]
public void ThenCanParseResultsFormatXunitWithShortFormSuccessfully()
{
var args = new[] { @"-trfmt=xunit" };

var configuration = new Configuration();
var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

Check.That(shouldContinue).IsTrue();
Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.XUnit);
}

[Test]
public void ThenCanParseResultsFormatXunitWithLongFormSuccessfully()
{
Expand All @@ -307,20 +320,33 @@ public void ThenCanParseResultsFormatXunitWithLongFormSuccessfully()
bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

Check.That(shouldContinue).IsTrue();
Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.xUnit);
Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.XUnit);
}

[Test]
public void ThenCanParseResultsFormatXunitWithShortFormSuccessfully()
public void ThenCanParseResultsFormatXunit1WithShortFormSuccessfully()
{
var args = new[] { @"-trfmt=xunit" };
var args = new[] { @"-trfmt=xunit1" };

var configuration = new Configuration();
var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

Check.That(shouldContinue).IsTrue();
Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.XUnit1);
}

[Test]
public void ThenCanParseResultsFormatXunit1WithLongFormSuccessfully()
{
var args = new[] { @"-test-results-format=xunit1" };

var configuration = new Configuration();
var commandLineArgumentParser = new CommandLineArgumentParser(FileSystem);
bool shouldContinue = commandLineArgumentParser.Parse(args, configuration, TextWriter.Null);

Check.That(shouldContinue).IsTrue();
Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.xUnit);
Check.That(configuration.TestResultsFormat).IsEqualTo(TestResultsFormat.XUnit1);
}

[Test]
Expand Down
Loading

0 comments on commit eaa338b

Please sign in to comment.