forked from x97mdr/pickles
-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update solution to run on non-windows platform
* Update tests to launch on non-windows platform Update filesystem abstraction nuget package System.IO Make related changes to tests: use IDirectoryInfo instead of DirectoryInfoBase, IFileSystemInfo instead of FileSystemInfoBase, IFileInfo instead of FileInfoBase Update DocumentFormat.OpenXML package, but still have xml-related error on MacOS during unit tests Use filesystem to build paths Do not use Windows-specific filepaths like "c:\file" Use Environment.NewLine instead of \r\n Update NFluent to compare strings thinking less of different line endings on different platforms #609 * Update cucumber json report format to match official json schema Produce test result value according to https://github.com/cucumber/cucumber-json-schema Update existing cucumber tests to run on non-windows platform #609 * Add feature uri to cucumer json report Add feature base uri parameter to command line * Add feature and step id, hidden field to Cucumber json report * Make Pickles.CommandLine packable as dotnet tool Update csproj to not use deprecated fields
- Loading branch information
Andrey Leskov
authored
Sep 22, 2021
1 parent
9a33c3f
commit 83fb8f3
Showing
80 changed files
with
1,463 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,3 +99,5 @@ node_modules/ | |
#include output docs | ||
!docs/Output/ | ||
src/Pickles/.vs/config/applicationhost.config | ||
|
||
nupkg*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 107 additions & 54 deletions
161
src/Pickles/Pickles.CommandLine.UnitTests/WhenParsingCommandLineArguments.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
src/Pickles/Pickles.DocumentationBuilders.Cucumber.UnitTests/App.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...les/Pickles.DocumentationBuilders.Cucumber.UnitTests/CucumberDocumentationBuilderTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="CucumberDocumentationBuilderTests.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.IO; | ||
using System.IO.Abstractions; | ||
using System.IO.Abstractions.TestingHelpers; | ||
using System.Reflection; | ||
using NUnit.Framework; | ||
using PicklesDoc.Pickles.DataStructures; | ||
using PicklesDoc.Pickles.DirectoryCrawler; | ||
|
||
namespace PicklesDoc.Pickles.DocumentationBuilders.Cucumber.UnitTests | ||
{ | ||
[TestFixture] | ||
public class CucumberDocumentationBuilderTests | ||
{ | ||
[Test] | ||
public void GIVEN_MacOS_test_When_create_document_Then_there_is_no_error() | ||
{ | ||
var featureDescription = | ||
@"Feature: Clearing Screen | ||
In order to restart a new set of calculations | ||
As a math idiot | ||
I want to be able to clear the screen | ||
@workflow @slow | ||
Scenario: Clear the screen | ||
Given I have entered 50 into the calculator | ||
And I have entered 70 into the calculator | ||
When I press C | ||
Then the screen should be empty | ||
"; | ||
|
||
var fileSystem = new FileSystem(); | ||
fileSystem.Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); | ||
var IFileSystemInfo = fileSystem.DirectoryInfo.FromDirectoryName(@"./"); | ||
var configuration = new Configuration | ||
{ | ||
OutputFolder = IFileSystemInfo | ||
}; | ||
var builder = new CucumberDocumentationBuilder(configuration, fileSystem); | ||
FeatureParser parser = new FeatureParser(configuration); | ||
var feature = parser.Parse(new StringReader(featureDescription)); | ||
var tree = new Tree(new FeatureNode(IFileSystemInfo, string.Empty, feature)); | ||
builder.Build(tree); | ||
} | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
...ickles.DocumentationBuilders.Cucumber.UnitTests/FeatureTest/SettingUriForAFeature.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
Feature: Setting uri for aFeature in a folder | ||
|
||
@cucumber | ||
Scenario: A simple feature in a folder without base uri set | ||
Given I have this feature description placed in a folder 'FeatureTest' in a file 'SettingUriForAFeature.feature' | ||
""" | ||
Feature: Clearing Screen | ||
Scenario: Clear the screen | ||
Given I have entered 50 into the calculator | ||
And I have entered 70 into the calculator | ||
When I press C | ||
Then the screen should be empty | ||
""" | ||
When I generate the documentation | ||
Then the JSON file should contain | ||
""" | ||
"uri": "FeatureTest/SettingUriForAFeature.feature" | ||
""" | ||
|
||
@cucumber | ||
Scenario: A simple feature in a folder with file base uri | ||
|
||
Given I have this feature description placed in a folder 'FeatureTest' in a file 'SettingUriForAFeature.feature' | ||
""" | ||
Feature: Clearing Screen | ||
Scenario: Clear the screen | ||
Given I have entered 50 into the calculator | ||
And I have entered 70 into the calculator | ||
When I press C | ||
Then the screen should be empty | ||
""" | ||
And feature base uri is provided from configuration as 'test' | ||
When I generate the documentation | ||
Then the JSON file should contain | ||
""" | ||
"uri": "test/FeatureTest/SettingUriForAFeature.feature" | ||
""" | ||
@cucumber | ||
Scenario: A simple feature in a folder with folder base uri | ||
Given I have this feature description placed in a folder 'FeatureTest' in a file 'SettingUriForAFeature.feature' | ||
""" | ||
Feature: Clearing Screen | ||
Scenario: Clear the screen | ||
Given I have entered 50 into the calculator | ||
And I have entered 70 into the calculator | ||
When I press C | ||
Then the screen should be empty | ||
""" | ||
And feature base uri is provided from configuration as 'root/test/' | ||
When I generate the documentation | ||
Then the JSON file should contain | ||
""" | ||
"uri": "root/test/FeatureTest/SettingUriForAFeature.feature" | ||
""" | ||
|
||
@cucumber | ||
Scenario: A simple feature in a folder with an absolute base uri | ||
Given I have this feature description placed in a folder 'FeatureTest' in a file 'SettingUriForAFeature.feature' | ||
""" | ||
Feature: Clearing Screen | ||
Scenario: Clear the screen | ||
Given I have entered 50 into the calculator | ||
And I have entered 70 into the calculator | ||
When I press C | ||
Then the screen should be empty | ||
""" | ||
And feature base uri is provided from configuration as 'http://root/test/' | ||
When I generate the documentation | ||
Then the JSON file should contain | ||
""" | ||
"uri": "http://root/test/FeatureTest/SettingUriForAFeature.feature" | ||
""" |
Oops, something went wrong.