Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
VERSION: 2.1.1.${{ github.run_number }}
CONFIGURATION: Release
PACKAGE_DIR: NuGet_Packages
DevEnvDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-2019

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Dump environment variables
run: env

# https://github.com/marketplace/actions/file-regex-replace
- name: Update AsesmblyInfo version
uses: mingjun97/file-regex-replace@v1
with:
# regex to apply (regex)
regex: '\d+\.\d+\.\d+\.\d+'
# flags of the regex
flags: g
# replacement string
replacement: '${{ env.VERSION }}'
# Files to be replaced (regex)
include: 'AssemblyInfo.cs'
# Files not to be replaced (regex)
exclude: '.^'
# String file encoding
encoding: 'utf8'
# Path to the folder to be replaced
path: 'src'

- name: Setup NuGet.exe for use with actions
uses: NuGet/setup-nuget@v1.0.5

- name: NuGet restore SpecBind.sln
run: nuget restore src\SpecBind.sln

- name: NuGet restore ContosoUniversity.sln
run: nuget restore examples\FullDemo\ContosoUniversity.sln

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1

- name: Build SpecBind.sln
run: msbuild.exe src\SpecBind.sln /p:Configuration=${{env.CONFIGURATION}} /verbosity:normal /maxcpucount

- name: Build ContosoUniversity.sln
run: msbuild.exe examples\FullDemo\ContosoUniversity.sln /p:Configuration=${{env.CONFIGURATION}} /verbosity:normal /maxcpucount

- name: Add IIS Web Application for ContosoUniversity
run: |
& $env:WINDIR\system32\inetsrv\AppCmd.exe add app /site.name:"Default Web Site" /path:/ContosoUniversity /physicalPath:"${{ github.workspace }}\examples\FullDemo\ContosoUniversity"

- name: Grant modify permissions to ContosoUniversity database
run: |
& icacls "${{ github.workspace }}\examples\FullDemo\ContosoUniversity\App_Data\School.sdf" /grant IIS_IUSRS:M

- name: Grant full permissions to Temp folder
run: |
& icacls "C:\Windows\Temp" /grant "IIS_IUSRS:(OI)(CI)F" /T

- name: Setup VSTest.console.exe
uses: darenm/Setup-VSTest@v1

- name: Run tests with code coverage
run: |
& $env:UserProfile\.nuget\packages\OpenCover\4.6.519\tools\OpenCover.Console.exe -register:user -target:"vstest.console.exe" -targetargs:"/Settings:.\src\test.runsettings /Logger:trx;LogFileName=${{ github.workspace }}\src\TestResults\TestResults.trx .\src\SpecBind.Tests\bin\${{env.CONFIGURATION}}\net472\SpecBind.Tests.dll .\src\SpecBind.Selenium.Tests\bin\${{env.CONFIGURATION}}\net472\SpecBind.Selenium.Tests.dll .\src\SpecBind.CodedUI.Tests\bin\${{env.CONFIGURATION}}\net472\SpecBind.CodedUI.Tests.dll .\src\SpecBind.CodedUI.IntegrationTests\bin\${{env.CONFIGURATION}}\SpecBind.CodedUI.IntegrationTests.dll" -filter:"+[SpecBind]* +[SpecBind.Selenium]* +[SpecBind.CodedUI]* -[SpecBind]SpecBind.Properties.* -[SpecBind.Selenium]SpecBind.Selenium.Properties.* -[SpecBind.CodedUI]SpecBind.CodedUI.Properties.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\SpecBind_coverage.xml -mergebyhash -returntargetcode

- name: Find files to upload
if: always()
run: |
Get-ChildItem "${{ github.workspace }}\src\TestResults" -Recurse -Include "*.trx", "*.coverage", "*.jpg", "*.html" | select-object FullName

- name: Upload TestResults
uses: actions/upload-artifact@v2.2.2
if: always()
with:
name: SpecBind TestResults ${{ env.VERSION }}
if-no-files-found: error
path: |
src/TestResults/TestResults.trx
src/TestResults/**/*.coverage
src/TestResults/**/*.html
src/TestResults/**/*.jpg

- name: Publish Unit Test Results
uses: dorny/test-reporter@v1.0.0
if: always()
with:
# Name of the check run
name: Tests
# Coma separated list of paths to test reports
path: src/TestResults/TestResults.trx
# Format of test report. Supported options:
reporter: dotnet-trx
# Limits which test suites are listed:
list-suites: 'failed'
# Limits which test cases are listed:
list-tests: 'failed'
# Limits number of created annotations with error message and stack trace captured during test execution.
max-annotations: 50

- name: Install CodeCov
run: pip install codecov

- name: Run tests with code coverage
run: codecov -f "SpecBind_coverage.xml"

- name: NuGet pack SpecBind
run: nuget pack src\SpecBind\SpecBind.nuspec -OutputDirectory ${{env.PACKAGE_DIR}} -BasePath src\SpecBind -Verbosity Detailed -Version ${{env.VERSION}} -Symbols -Properties Configuration=${{env.CONFIGURATION}}

- name: NuGet pack SpecBind.CodedUI
run: nuget pack src\SpecBind.CodedUI\SpecBind.CodedUI.nuspec -OutputDirectory ${{env.PACKAGE_DIR}} -BasePath src\SpecBind.CodedUI -Verbosity Detailed -Version ${{env.VERSION}} -Symbols -Properties Configuration=${{env.CONFIGURATION}}

- name: NuGet pack SpecBind.Selenium
run: nuget pack src\SpecBind.Selenium\SpecBind.Selenium.nuspec -OutputDirectory ${{env.PACKAGE_DIR}} -BasePath src\SpecBind.Selenium -Verbosity Detailed -Version ${{env.VERSION}} -Symbols -Properties Configuration=${{env.CONFIGURATION}}

- name: Upload Build Artifacts
uses: actions/upload-artifact@v2.2.2
with:
name: SpecBind NuGet Packages ${{ env.VERSION }}
path: ${{ env.PACKAGE_DIR }}\*.nupkg
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ AppPackages/
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
Expand All @@ -115,3 +114,4 @@ UpgradeLog*.XML
src/SpecBind.sln.DotSettings
examples/FullDemo/ContosoUniversity/App_Data/School.sdf
/examples/FullDemo/ContosoUniversity/Properties/PublishProfiles/ContosoUniversity.pubxml
*.feature.cs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should feature files really be excluded from SCM?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the generated code-behind is being excluded.

They're automatically generated when you build the project anyway.

Otherwise, if the feature file is changed, then you will always see two changed files, when actually you just changed one.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also started to exclude the generated Code. The Feature Folder looks neat now, so that 'Business' Users have fewer excuses.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Join the chat at https://gitter.im/dpiessens/specbind](https://badges.gitter.im/dpiessens/specbind.svg)](https://gitter.im/dpiessens/specbind?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build status](https://ci.appveyor.com/api/projects/status/qhajavc6p5ut2480)](https://ci.appveyor.com/project/dpiessens/specbind)
[![Build status](https://github.com/SpecBind/specbind/actions/workflows/main.yml/badge.svg)](https://github.com/SpecBind/specbind/actions/workflows/main.yml)

[![Code Coverage](https://codecov.io/github/dpiessens/specbind/coverage.svg?branch=master)](https://codecov.io/github/dpiessens/specbind?branch=master)

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ branches:
only:
- master

image: Visual Studio 2017
image: Visual Studio 2019


#---------------------------------#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,5 @@
<stepAssemblies>
<stepAssembly assembly="SpecBind"/>
</stepAssemblies>
<unitTestProvider name="MsTest"/>
<plugins>
<add name="SpecBindGeneratorPlugin" type="Generator"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the new plugin strategy here? does it follow: https://docs.specflow.org/projects/specflow/en/latest/Extend/Plugins.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://docs.specflow.org/projects/specflow/en/latest/Integrations/CodedUI.html#introduction, "Coded UI is no longer supported with SpecFlow 3."

Instead of using a plugin to add attributes to the generated test class, there are explicit calls Playback.Initialize(); and Playback.Cleanup();.

This requires adding SpecBind.CodedUI as a step assembly in the application configuration file.

I'm thinking we can add this to App.config.install.xdt so it's automatically added when installing the SpecBind.CodedUI nuget package in a subsequent PR.

</plugins>
</specFlow>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,84 +1,34 @@
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{297B4A00-E56B-4CF2-98A1-1072BD2FA955}</ProjectGuid>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ContosoUniversity.AcceptanceTests</RootNamespace>
<AssemblyName>ContosoUniversity.AcceptanceTests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>True</IsCodedUITest>
<TestProjectType>CodedUITest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<OldToolsVersion>4.0</OldToolsVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
<Visible>False</Visible>
</CodeAnalysisDependentAssemblyPaths>
</ItemGroup>
<ItemGroup>
<Compile Include="Pages\HomePage.cs" />
<Compile Include="Pages\StudentsSearchPage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Scenarios\SearchForAStudent.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>SearchForAStudent.feature</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Scenarios\SearchForAStudent.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>SearchForAStudent.feature.cs</LastGenOutput>
</None>
<None Include="Scenarios\SearchForAStudent.feature" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.3.2</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.3.2</Version>
</PackageReference>
<PackageReference Include="SpecBind.CodedUI">
<Version>1.4.1.170</Version>
</PackageReference>
<PackageReference Include="SpecFlow" Version="3.5.14" />
<PackageReference Include="SpecFlow.MsTest" Version="3.5.14" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.5.14" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\..\..\src\CodedUI.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading