diff --git a/.gitignore b/.gitignore index 5902ca0..85ada6f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,10 @@ TestResult.xml TestResults # open cover results -codecoverage.xml +coverage.xml + +# code analysis +analysis.xml +cs-money.dll.lastcodeanalysissucceeded packages diff --git a/README.md b/README.md index 449619f..d5a5b36 100644 --- a/README.md +++ b/README.md @@ -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. @@ -24,28 +25,27 @@ In order to run this sample you will need a host workstation with Visual Studio, Building with static analysis:
-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
 
Running tests with code coverage:
-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
 
-Publishing Results using **Testspace** in powershell: +Publishing Test Content using **Testspace**:
-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"
 
-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. diff --git a/appveyor.yml b/appveyor.yml index fc9ad15..d5eac82 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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% \ No newline at end of file diff --git a/desktopbuild.bat b/desktopbuild.bat new file mode 100644 index 0000000..a4f265b --- /dev/null +++ b/desktopbuild.bat @@ -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"