Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed few test misses on OSX #1758

Merged
merged 2 commits into from
May 19, 2016
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
141 changes: 70 additions & 71 deletions Tests/L0/ANT/_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,76 +307,75 @@ describe('ANT Suite', function() {
done(err);
});
})

it('Ant calls enable code coverage and publish code coverage when Cobertura is selected.', (done) => {
setResponseFile('antCodeCoverage.json');

var tr = new trm.TaskRunner('ANT');
tr.setInput('antBuildFile', '/build/build.xml'); // Make that checkPath returns true for this filename in the response file
tr.setInput('javaHomeSelection', 'JDKVersion');
tr.setInput('jdkVersion', 'default');
tr.setInput('testResultsFiles', '**/TEST-*.xml');
tr.setInput('codeCoverageTool', 'Cobertura');
tr.setInput('classFilesDirectories', 'class1');

tr.run()
.then(() => {
assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\\build\\CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=Cobertura;\]/) >= 0 || tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\/build\/CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\/build\/CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=Cobertura;\]/) >= 0, 'should have called enable code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=Cobertura;summaryfile=\\build\\CCReport43F6D5EF\\coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;\]/) >= 0 ||
tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=Cobertura;summaryfile=\/build\/CCReport43F6D5EF\/coverage.xml;reportdirectory=\/build\/CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
Copy link

Choose a reason for hiding this comment

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

indention/not asserting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already indented

done();
})
.fail((err) => {
assert.fail("task should not have failed");
done(err);
});
})

it('Ant calls enable code coverage and publish code coverage when Jacoco is selected.', (done) => {
setResponseFile('antCodeCoverage.json');

var tr = new trm.TaskRunner('ANT');
tr.setInput('antBuildFile', '/build/build.xml'); // Make that checkPath returns true for this filename in the response file
tr.setInput('javaHomeSelection', 'JDKVersion');
tr.setInput('jdkVersion', 'default');
tr.setInput('testResultsFiles', '**/TEST-*.xml');
tr.setInput('codeCoverageTool', 'JaCoCo');
tr.setInput('classFilesDirectories', 'class1');

//
// Commenting out because these are failing and hanging for awhile on OSX
//
// it('Ant calls enable code coverage and publish code coverage when Cobertura is selected.', (done) => {
// setResponseFile('antCodeCoverage.json');

// var tr = new trm.TaskRunner('ANT');
// tr.setInput('antBuildFile', '/build/build.xml'); // Make that checkPath returns true for this filename in the response file
// tr.setInput('javaHomeSelection', 'JDKVersion');
// tr.setInput('jdkVersion', 'default');
// tr.setInput('testResultsFiles', '**/TEST-*.xml');
// tr.setInput('codeCoverageTool', 'Cobertura');
// tr.setInput('classFilesDirectories', 'class1');

// tr.run()
// .then(() => {
// assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\\build\\CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=Cobertura;\]/) >= 0, 'should have called enable code coverage.');
// assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=Cobertura;summaryfile=\\build\\CCReport43F6D5EF\\coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
// done();
// })
// .fail((err) => {
// assert.fail("task should not have failed");
// done(err);
// });
// })

// it('Ant calls enable code coverage and publish code coverage when Jacoco is selected.', (done) => {
// setResponseFile('antCodeCoverage.json');

// var tr = new trm.TaskRunner('ANT');
// tr.setInput('antBuildFile', '/build/build.xml'); // Make that checkPath returns true for this filename in the response file
// tr.setInput('javaHomeSelection', 'JDKVersion');
// tr.setInput('jdkVersion', 'default');
// tr.setInput('testResultsFiles', '**/TEST-*.xml');
// tr.setInput('codeCoverageTool', 'JaCoCo');
// tr.setInput('classFilesDirectories', 'class1');

// tr.run()
// .then(() => {
// assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\\build\\CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=JaCoCo;\]/) >= 0, 'should have called enable code coverage.');
// assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=\\build\\CCReport43F6D5EF\\coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
// done();
// })
// .fail((err) => {
// assert.fail("task should not have failed");
// done(err);
// });
// })

// it('Ant calls enable code coverage but not publish code coverage when summary file is not generated.', (done) => {
// setResponseFile('antGood.json');
// // antGood.json doesnt mock the stat for summary file.
// var tr = new trm.TaskRunner('ANT');
// tr.setInput('antBuildFile', '/build/build.xml'); // Make that checkPath returns true for this filename in the response file
// tr.setInput('javaHomeSelection', 'JDKVersion');
// tr.setInput('jdkVersion', 'default');
// tr.setInput('testResultsFiles', '**/TEST-*.xml');
// tr.setInput('codeCoverageTool', 'JaCoCo');
// tr.setInput('classFilesDirectories', 'class1');

// tr.run()
// .then(() => {
// assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\\build\\CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=JaCoCo;\]/) >= 0, 'should have called enable code coverage.');
// assert(tr.stdout.search(/##vso\[codecoverage.publish/) < 0, 'should have called publish code coverage.');
// done();
// })
// .fail((err) => {
// assert.fail("task should not have failed");
// done(err);
// });
// })
tr.run()
.then(() => {
assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\\build\\CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=JaCoCo;\]/) >= 0 || tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\/build\/CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\/build\/CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=JaCoCo;\]/) >= 0, 'should have called enable code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=\\build\\CCReport43F6D5EF\\coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;\]/) >= 0 ||
tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=\/build\/CCReport43F6D5EF\/coverage.xml;reportdirectory=\/build\/CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
Copy link

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

@AshwiniChalla AshwiniChalla May 19, 2016

Choose a reason for hiding this comment

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

already indented

done();
})
.fail((err) => {
assert.fail("task should not have failed");
done(err);
});
})

it('Ant calls enable code coverage but not publish code coverage when summary file is not generated.', (done) => {
setResponseFile('antGood.json');
// antGood.json doesnt mock the stat for summary file.
var tr = new trm.TaskRunner('ANT');
tr.setInput('antBuildFile', '/build/build.xml'); // Make that checkPath returns true for this filename in the response file
tr.setInput('javaHomeSelection', 'JDKVersion');
tr.setInput('jdkVersion', 'default');
tr.setInput('testResultsFiles', '**/TEST-*.xml');
tr.setInput('codeCoverageTool', 'JaCoCo');
tr.setInput('classFilesDirectories', 'class1');

tr.run()
.then(() => {
assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\\build\\CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\\build\\CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=JaCoCo;\]/) >= 0 || tr.stdout.search(/##vso\[codecoverage.enable buildfile=\/build\/build.xml;classfilesdirectories=class1;summaryfile=coverage.xml;reportdirectory=\/build\/CCReport43F6D5EF;ccreporttask=CodeCoverage_9064e1d0;reportbuildfile=\/build\/CCReportBuildA4D283EG.xml;buildtool=Ant;codecoveragetool=JaCoCo;\]/) >= 0, 'should have called enable code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish/) < 0, 'should have called publish code coverage.');
done();
})
.fail((err) => {
assert.fail("task should not have failed");
done(err);
});
})
});
19 changes: 19 additions & 0 deletions Tests/L0/ANT/antCodeCoverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"stats": {
"\\build\\CCReport43F6D5EF\\coverage.xml": {
"isFile": true
},
"/build/CCReport43F6D5EF/coverage.xml": {
"isFile": true
}
},
"rmRF": {
Expand All @@ -46,6 +49,22 @@
"\\build\\CCReportBuildA4D283EG.xml": {
"success": true,
"message": "success"
},
"/build/InstrumentedClasses": {
"success": true,
"message": "success"
},
"/build/cobertura.ser": {
"success": true,
"message": "success"
},
"/build/CCReport43F6D5EF": {
"success": true,
"message": "success"
},
"/build/CCReportBuildA4D283EG.xml": {
"success": true,
"message": "success"
}
}
}
4 changes: 4 additions & 0 deletions Tests/L0/ANT/antFails.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"\\build\\InstrumentedClasses": {
"success": true,
"message": "success"
},
"/build/InstrumentedClasses": {
"success": true,
"message": "success"
}
}
}
16 changes: 16 additions & 0 deletions Tests/L0/ANT/antGood.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@
"\\build\\CCReportBuildA4D283EG.xml": {
"success": true,
"message": "success"
},
"/build/InstrumentedClasses": {
"success": true,
"message": "success"
},
"/build/cobertura.ser": {
"success": true,
"message": "success"
},
"/build/CCReport43F6D5EF": {
"success": true,
"message": "success"
},
"/build/CCReportBuildA4D283EG.xml": {
"success": true,
"message": "success"
}
}
}
4 changes: 4 additions & 0 deletions Tests/L0/ANT/antVersionFails.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"\\build\\InstrumentedClasses": {
"success": true,
"message": "success"
},
"/build/InstrumentedClasses": {
"success": true,
"message": "success"
}
}
}
17 changes: 10 additions & 7 deletions Tests/L0/Gradle/_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ describe('gradle Suite', function() {
assert(tr.ran('gradlew build jacocoTestReport'), 'it should have run gradlew build');
assert(tr.invokedToolCount == 2, 'should have only run gradle 2 times');
assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=build.gradle;summaryfile=summary.xml;reportdirectory=CCReport43F6D5EF;ismultimodule=false;buildtool=Gradle;codecoveragetool=JaCoCo;\]/) >= 0, 'should have called enable code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=CCReport43F6D5EF\\summary.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=CCReport43F6D5EF\\summary.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0 ||
tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=CCReport43F6D5EF\/summary.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand All @@ -447,7 +448,7 @@ describe('gradle Suite', function() {
done(err);
});
})

it('Gradle with jacoco selected should call enable and publish code coverage for a multi module project.', (done) => {
setResponseFile('gradleCCMultiModule.json');

Expand All @@ -467,7 +468,8 @@ describe('gradle Suite', function() {
assert(tr.ran('gradlew build jacocoRootReport'), 'it should have run gradlew build');
assert(tr.invokedToolCount == 2, 'should have only run gradle 2 times');
assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=build.gradle;summaryfile=summary.xml;reportdirectory=CCReport43F6D5EF;ismultimodule=true;buildtool=Gradle;codecoveragetool=JaCoCo;\]/) >= 0, 'should have called enable code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=CCReport43F6D5EF\\summary.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=CCReport43F6D5EF\\summary.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0 ||
tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=JaCoCo;summaryfile=CCReport43F6D5EF\/summary.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand All @@ -477,7 +479,7 @@ describe('gradle Suite', function() {
done(err);
});
})

it('Gradle with cobertura selected should call enable and publish code coverage.', (done) => {
setResponseFile('gradleCCSingleModule.json');

Expand All @@ -497,7 +499,8 @@ describe('gradle Suite', function() {
assert(tr.ran('gradlew build cobertura'), 'it should have run gradlew build');
assert(tr.invokedToolCount == 2, 'should have only run gradle 2 times');
assert(tr.stdout.search(/##vso\[codecoverage.enable buildfile=build.gradle;summaryfile=coverage.xml;reportdirectory=CCReport43F6D5EF;ismultimodule=false;buildtool=Gradle;codecoveragetool=Cobertura;\]/) >= 0, 'should have called enable code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=Cobertura;summaryfile=CCReport43F6D5EF\\coverage.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
assert(tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=Cobertura;summaryfile=CCReport43F6D5EF\\coverage.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0 ||
tr.stdout.search(/##vso\[codecoverage.publish codecoveragetool=Cobertura;summaryfile=CCReport43F6D5EF\/coverage.xml;reportdirectory=CCReport43F6D5EF;\]/) >= 0, 'should have called publish code coverage.');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
Expand All @@ -507,7 +510,7 @@ describe('gradle Suite', function() {
done(err);
});
})

it('Gradle with jacoco selected and report generation failed should call enable but not publish code coverage.', (done) => {
setResponseFile('gradleGood.json');

Expand Down Expand Up @@ -537,7 +540,7 @@ describe('gradle Suite', function() {
done(err);
});
})

it('Gradle with cobertura selected and report generation failed should call enable but not publish code coverage.', (done) => {
setResponseFile('gradleGood.json');

Expand Down
6 changes: 6 additions & 0 deletions Tests/L0/Gradle/gradleCCMultiModule.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
},
"CCReport43F6D5EF\\coverage.xml": {
"isFile": true
},
"CCReport43F6D5EF/summary.xml": {
"isFile": true
},
"CCReport43F6D5EF/coverage.xml": {
"isFile": true
}
},
"rmRF": {
Expand Down
6 changes: 6 additions & 0 deletions Tests/L0/Gradle/gradleCCSingleModule.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
},
"CCReport43F6D5EF\\coverage.xml": {
"isFile": true
},
"CCReport43F6D5EF/summary.xml": {
"isFile": true
},
"CCReport43F6D5EF/coverage.xml": {
"isFile": true
}
},
"rmRF": {
Expand Down