Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Describe

def call(
    def ENVIRONMENTNAME
) {
	try {
        bat label: 'Upload unit test specs', 
            script: '''
                %AGENTMETTLECMD% remote upload ^
                -host %IISENGINENAME% ^
                -username %MCIUSERNAME% -password %MCIPASSWORD% ^
                -source unittest ^
                -transferPattern "**/*" ^
                -destination %ENGINEUNITTESTBASEDIR%/specs/%DATASTAGE_PROJECT%
            '''

        bat label: 'Configure Properties', 
            script: '''
                %AGENTMETTLECMD% properties config ^
                -baseDir datastage ^
                -filePattern "cleanup_unittest.sh" ^
                -properties var.%ENVID% ^
                -outDir config
            '''

        bat label: 'Create unit test report dir', 
            script: "if not exist \"unittest-reports\" mkdir \"unittest-reports\""

        bat label: 'Run Unit Tests', 
            script: """
                %AGENTMETTLECMD% unittest test ^
                -domain %IISDOMAINNAME% ^
                -server %IISENGINENAME% ^
                -username %IISUSERNAME% -password %IISPASSWORD% ^
                -project %DATASTAGE_PROJECT% ^
                -specs unittest ^
                -reports unittest-reports ^
                -project-cache \"%AGENTMETTLEHOME%\\cache\\%IISENGINENAME%\\%DATASTAGE_PROJECT%\" ^
                -test-suite \"MettleCI Unit Tests - ${ENVIRONMENTNAME}\"
            """

        bat label: 'Download unit test reports', 
            script: '''
                %AGENTMETTLECMD% remote download ^
                -host %IISENGINENAME% ^
                -source %ENGINEUNITTESTBASEDIR%/reports ^
                -destination unittest-reports ^
                -transferPattern "%DATASTAGE_PROJECT%/**/*.xml" ^
                -username %MCIUSERNAME% -password %MCIPASSWORD%
            '''

        junit testResults: 'unittest-reports/**/*.xml', 
                allowEmptyResults: true

        bat label: 'Cleanup', 
            script: '''
                %AGENTMETTLECMD% remote execute ^
                -host %IISENGINENAME% ^
                -username %MCIUSERNAME% -password %MCIPASSWORD% ^
                -script "config/cleanup_unittest.sh"
            '''
   }
    catch(e) {
        bat label: 'Cleanup', 
            script: '''
                %AGENTMETTLECMD% remote execute ^
                -host %IISENGINENAME% ^
                -username %MCIUSERNAME% -password %MCIPASSWORD% ^
                -script "config/cleanup_unittest.sh"
            '''
        throw e
    }
}
  • No labels