...
Code Block | ||
---|---|---|
| ||
def call( def ENVIRONMENTNAME ) { try { mettleci properties config mettleci remote upload // Configure Properties mettleci remote execute # Upload unit test specs "config/cleanup_unittest.sh" // Cleanup results of previous unit tests mettleci remote propertiesupload config # Configure// PropertiesUnit test 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" # Cleanup// Download unit test reports if throw e (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.