From d67d949bcf5c62e908c3b06c8cc9b334454c58f5 Mon Sep 17 00:00:00 2001 From: Ran Li Date: Thu, 18 Jan 2024 16:55:23 +0100 Subject: [PATCH] added groovy unit test for new Piper step --- ...ntPipelineStageIntegrationTestsTest.groovy | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/groovy/templates/AbapEnvironmentPipelineStageIntegrationTestsTest.groovy b/test/groovy/templates/AbapEnvironmentPipelineStageIntegrationTestsTest.groovy index ae540381ef..d4a38d7945 100644 --- a/test/groovy/templates/AbapEnvironmentPipelineStageIntegrationTestsTest.groovy +++ b/test/groovy/templates/AbapEnvironmentPipelineStageIntegrationTestsTest.groovy @@ -113,4 +113,36 @@ class abapEnvironmentPipelineStageIntegrationTestsTest extends BasePiperTest { 'cloudFoundryCreateServiceKey'))) } + @Test + void testabapLandscapePortalUpdateAddOnProduct() { + + nullScript.commonPipelineEnvironment.configuration.runStage = [ + 'Integration Tests': true + ] + jsr.step.abapEnvironmentPipelineStageIntegrationTests(script: nullScript, integrationTestOption: 'addOnDeployment') + + + assertThat(stepsCalled, not(hasItem('input'))) + assertThat(stepsCalled, hasItems('abapLandscapePortalUpdateAddOnProduct')) + } + + @Test + void testabapLandscapePortalUpdateAddOnProductFails() { + + helper.registerAllowedMethod('abapLandscapePortalUpdateAddOnProduct', [Map.class], {m -> stepsCalled.add('abapLandscapePortalUpdateAddOnProduct'); error("Failed")}) + + nullScript.commonPipelineEnvironment.configuration.runStage = [ + 'Integration Tests': true + ] + + try { + jsr.step.abapEnvironmentPipelineStageIntegrationTests(script: nullScript, integrationTestOption: 'addOnDeployment') + fail("Expected exception") + } catch (Exception e) { + // failure expected + } + + assertThat(stepsCalled, not(hasItem('input'))) + assertThat(stepsCalled, hasItems('abapLandscapePortalUpdateAddOnProduct')) + } }