coverage attempt

This commit is contained in:
Qstick 2019-08-11 00:36:16 -04:00
commit c630a585fa
4 changed files with 33 additions and 33 deletions

1
.gitignore vendored
View file

@ -122,6 +122,7 @@ _rawPackage/
_dotTrace*
_tests/
*.Result.xml
coverage.xml
setup/Output/
*.~is

View file

@ -155,7 +155,7 @@ stages:
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Linux Unit
arguments: Linux Unit Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
@ -197,7 +197,7 @@ stages:
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Linux Integration
arguments: Linux Integration Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
@ -221,7 +221,7 @@ stages:
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Windows Unit
arguments: Windows Unit Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
@ -253,14 +253,14 @@ stages:
destinationFolder: '$(Build.ArtifactStagingDirectory)/bin'
- bash: |
ls -R ${BUILD_ARTIFACTSTAGINGDIRECTORY}
mkdir -p .\\bin
cp -R -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}\\bin\\Lidarr\\* .\\bin
mkdir -p ./bin
cp -R -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/* ./bin
- task: Bash@3
displayName: Windows Integration Tests
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Windows Integration
arguments: Windows Integration Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
@ -284,7 +284,7 @@ stages:
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Windows Automation
arguments: Windows Automation Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
@ -308,17 +308,17 @@ stages:
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Mac Unit
arguments: Mac Unit Test
- task: PublishTestResults@2
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '**/TestResult.xml'
testRunTitle: 'macOS Unit Tests'
- job: Mac_Integration_Tests
displayName: macOS Integration
- job: Unit_Test_Coverage
displayName: Coverage
pool:
vmImage: 'macOS-10.13'
vmImage: 'ubuntu-16.04'
steps:
- checkout: self
- task: DownloadPipelineArtifact@2
@ -327,28 +327,14 @@ stages:
buildType: 'current'
artifactName: Tests
targetPath: $(testsFolder)
- task: DownloadPipelineArtifact@2
displayName: Download Build Artifact
inputs:
buildType: 'current'
artifactName: Lidarr
itemPattern: '**/Lidarr.**.osx.tar.gz'
targetPath: $(Build.ArtifactStagingDirectory)
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/Lidarr.**.osx.tar.gz'
destinationFolder: '$(Build.ArtifactStagingDirectory)/bin'
- bash: |
mkdir ./bin
cp -R -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/* ./bin
- task: Bash@3
displayName: macOS Integration Tests
displayName: Coverage Unit Tests
inputs:
targetType: 'filePath'
filePath: ./test.sh
arguments: Mac Integration
- task: PublishTestResults@2
arguments: Linux Unit Coverage
- task: PublishCodeCoverageResults@1
displayName: Publish Coverage Results
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '**/TestResult.xml'
testRunTitle: 'macOS Integration Tests'
codeCoverageTool: 'cobertura'
summaryFileLocation: '**/Coverage.xml'

View file

@ -261,8 +261,10 @@ PackageTests()
if [ $runtime = "dotnet" ] ; then
$nuget install NUnit.ConsoleRunner -Version 3.7.0 -Output $testPackageFolder
$nuget install OpenCover -Version 4.7.922 -Output $testPackageFolder
else
mono $nuget install NUnit.ConsoleRunner -Version 3.7.0 -Output $testPackageFolder
mono $nuget install OpenCover -Version 4.7.922 -Output $testPackageFolder
fi
cp $outputFolder/*.dll $testPackageFolder

11
test.sh
View file

@ -1,11 +1,13 @@
#! /bin/bash
PLATFORM=$1
TYPE=$2
COVERAGE=$3
WHERE="cat != ManualTest"
TEST_DIR="."
TEST_PATTERN="*Test.dll"
ASSEMBLIES=""
TEST_LOG_FILE="TestLog.txt"
COVERAGE_FILE="$TEST_DIR/Coverage.xml"
if [ -d "$TEST_DIR/_tests" ]; then
TEST_DIR="$TEST_DIR/_tests"
@ -17,6 +19,7 @@ rm -f "$TEST_LOG_FILE"
export LIDARR_TESTS_LOG_OUTPUT="File"
NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe"
OPEN_COVER="$TEST_DIR/OpenCover.4.7.922/tools/OpenCover.Console.exe"
NUNIT_COMMAND="$NUNIT"
NUNIT_PARAMS="--workers=1"
@ -53,8 +56,16 @@ for i in `find $TEST_DIR -name "$TEST_PATTERN"`;
do ASSEMBLIES="$ASSEMBLIES $i"
done
if [ "$COVERAGE" = "Coverage" ]; then
$OPEN_COVER -register:user -target:"$NUNIT" -targetargs:"$NUNIT_PARAMS --where=\"$WHERE\" $ASSEMBLIES" -output:"$COVERAGE_FILE";
EXIT_CODE=$?
elif [ "$COVERAGE" = "Test" ] ; then
$NUNIT_COMMAND --where "$WHERE" $NUNIT_PARAMS $ASSEMBLIES;
EXIT_CODE=$?
else
echo "Run Type must be provided as third argument: Coverage or Test"
exit 3
fi
if [ "$EXIT_CODE" -ge 0 ]; then
echo "Failed tests: $EXIT_CODE"