Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ TestResult.xml
TestResults

# open cover results
codecoverage.xml
coverage.xml

# code analysis
analysis.xml
cs-money.dll.lastcodeanalysissucceeded

packages
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ This sample demonstrates techniques for using Testspace with C# code and the [NU
***
Build using AppVeyor's Online CI:

[![Build status](https://ci.appveyor.com/api/projects/status/x76ee4x2hc84l55a?svg=true)](https://ci.appveyor.com/project/jeffs-s2/csharp-nunit)
[![Build status](https://ci.appveyor.com/api/projects/status/78g1co48hr5xq7wd?svg=true)](https://ci.appveyor.com/project/munderseth/csharp-nunit-mffbo)

***
Publishing **Test Content** using www.testspace.com.

Expand All @@ -24,28 +25,27 @@ In order to run this sample you will need a host workstation with Visual Studio,
Building with static analysis:

<pre>
msbuild money/cs-money.csproj /p:runCodeAnalysis=true /p:codeanalysislogfile=StaticAnalysis.xml
msbuild money\cs-money.csproj /p:platform=anycpu /p:configuration=debug /p:runCodeAnalysis=true /p:codeanalysislogfile=..\analysis.xml
</pre>
Running tests with code coverage:

<pre>
OpenCover.Console.exe -target:nunit3-console.exe -targetargs:cs-money.dll -output:codecoverage.xml -register:user

OpenCover.Console -target:"nunit3-console.exe" -targetargs:"cs-money.dll" -output:"coverage.xml" -filter:"+[*]* -[*]*MoneyTest*" -register:user
</pre>

Publishing Results using **Testspace** in powershell:
Publishing Test Content using **Testspace**:

<pre>
wget https://testspace-client.s3.amazonaws.com/testspace-windows.zip -outfile .\money\packages\testspace.zip
extract to preferred location
testspace .\testresult.xml .\coverage.xml money\staticanalysis.xml ${ENV:TESTSPACE_TOKEN}/${ENV:BRANCH_NAME}
curl -fsS -o testspace-windows.zip https://testspace-client.s3.amazonaws.com/testspace-windows.zip
7z x -y .\testspace-windows.zip
estspace publish analysis.xml [Tests]TestResult.xml coverage.xml "master"
</pre>

Checkout the [Space](https://samples.testspace.com/projects/csharp/spaces/nunit).
Checkout the [Testspace Project](https://samples.testspace.com/projects/csharp.nunit).

To fork this example using AppVeyor requires:
- Account at www.testspace.com.
- AppVeyor Environment Variable:
- `TESTSPACE_URL` = `credentials:@my-org-name.testspace.com/my-project/my-space`
- `TESTSPACE_TOKEN` = `credentials:@my-org-name.testspace.com/my-project`
- `credentials` set to `username:password` or your [access token](http://help.testspace.com/using-your-organization:user-settings).
- `my-org-name.testspace.com/my-project/my-space` based on your subdomain, project, and space names. Refer [here](http://help.testspace.com/reference:runner-reference#login-credentials) for more details.
- `my-org-name.testspace.com/my-project` based on your subdomain, and project names. Refer [here](http://help.testspace.com/reference:runner-reference#login-credentials) for more details.
23 changes: 8 additions & 15 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
version: 1.0.{build}
configuration: Debug
install:
- ps: >-
mkdir .\money\packages

mkdir .\money\packages\testspace

wget https://testspace-client.s3.amazonaws.com/testspace-windows.zip -outfile .\money\packages\testspace.zip

7z x .\money\packages\testspace.zip -omoney\packages\testspace
build_script:
- ps: >-
nuget restore money/cs-money.sln

msbuild money/cs-money.csproj /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:runCodeAnalysis=true /p:codeanalysislogfile=StaticAnalysis.xml
- nuget restore money/cs-money.sln

test_script:
- ps: >-
.\money\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:".\money\packages\NUnit.ConsoleRunner.3.2.1\tools\nunit3-console.exe" -targetargs:'.\money\bin\Debug\cs-money.dll' -output:'.\coverage.xml' -filter:'+[*]* -[*]*MoneyTest*' -register:user
- msbuild money/cs-money.csproj /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:runCodeAnalysis=true /p:codeanalysislogfile=..\analysis.xml
- .\money\packages\OpenCover.4.6.519\tools\OpenCover.Console -target:".\money\packages\NUnit.ConsoleRunner.3.2.1\tools\nunit3-console.exe" -targetargs:"money\bin\Debug\cs-money.dll" -output:"coverage.xml" -filter:"+[*]* -[*]*MoneyTest*" -register:user

.\money\packages\testspace\testspace.exe publish .\testresult.xml .\coverage.xml .\money\staticanalysis.xml "${ENV:TESTSPACE_URL}"
after_test:
- curl -fsS -o testspace-windows.zip https://testspace-client.s3.amazonaws.com/testspace-windows.zip
- 7z x -y testspace-windows.zip
- testspace publish analysis.xml [Tests]TestResult.xml coverage.xml %TESTSPACE_TOKEN%/%APPVEYOR_REPO_BRANCH%#appveyor.build.%APPVEYOR_BUILD_NUMBER%
13 changes: 13 additions & 0 deletions desktopbuild.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
REM Remove any old test content
del *.xml

REM "test_script:"
msbuild money\cs-money.csproj /p:platform=anycpu /p:configuration=debug /p:runCodeAnalysis=true /p:codeanalysislogfile=..\analysis.xml
.\money\packages\OpenCover.4.6.519\tools\OpenCover.Console -target:".\money\packages\NUnit.ConsoleRunner.3.2.1\tools\nunit3-console.exe" -targetargs:"money\bin\Debug\cs-money.dll" -output:"coverage.xml" -filter:"+[*]* -[*]*MoneyTest*" -register:user

REM "after_test:"
REM curl -fsS -o testspace-windows.zip https://testspace-client.s3.amazonaws.com/testspace-windows.zip
REM 7z x -y .\testspace-windows.zip
REM del testspace-windows.zip

testspace publish analysis.xml [Tests]TestResult.xml coverage.xml "master.desktop"