...
Code Block | ||
---|---|---|
| ||
def call( def ENVIRONMENTNAME ) { try { mettleci properties config mettleci remote upload // Configure Properties mettleci remote execute "config/cleanup_unittest.sh" // Cleanup Uploadresults unitof testprevious specsunit tests mettleci remote upload mettleci properties config // ConfigureUnit Propertiestest specifications and data mkdir // Create unit test report dir try { mettleci unittest test // Run Unit Tests } mettleci remotefinally download{ // Download unit test reports junit testResults 'unittest-reports/**/*.xml' Whether the above is successfult or not... // Publish Unit Test results mettleci remote execute "config/cleanup_unittest.sh"download // Cleanup } catch(e) { mettleci remote execute "config/cleanup_unittest.sh" // CleanupDownload unit test reports throw e if (exists 'unittest-reports/**/*.xml') { junit testResults 'unittest-reports/**/*.xml' // Publish Unit Test results // Propagate error for downstream error handling} } } |
Note that this Custom Step makes used of Jenkins' JUnit plugin.
...