Forum Discussion

BThakur123's avatar
BThakur123
Occasional Visitor
2 years ago

Assertion failed

i am facing below error. Not able to solve this:

 

Assertion failed: assert result.getStatus().toString() == "FINISHED" | | | | | FAILED FAILED false com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner@423487e8 error at line: 27

 

Code used:

log.info("========= STEP: " + (context.currentStepIndex + 1) + " - " + context.currentStep.name + " =========")

import com.eviware.soapui.model.project.ProjectFactoryRegistry
import com.eviware.soapui.impl.wsdl.WsdlProject

// Pass token to 'MappingStudio' project
def projectDir = context.expand('${projectDir}')
def remoteProjectDir = projectDir.substring(0, projectDir.lastIndexOf("BinderCloudCore") - 1)
def xmlFile = remoteProjectDir + "\\MapStudio\\MapStudio.xml"
log.info(xmlFile)
def remoteProject = new WsdlProject(xmlFile)
remoteProject.setPropertyValue("Token", testRunner.testCase.testSuite.project.getPropertyValue("Token"))

// Run 'CreateProject' test case
def remoteTestSuite = remoteProject.getTestSuiteByName("Project")
def remoteTestCase = remoteTestSuite.getTestCaseByName("CreateProject")
remoteTestCase.setPropertyValue("set_ContractId", testRunner.testCase.getPropertyValue("set_ContractId"))
remoteTestCase.setPropertyValue("set_DocumentType", testRunner.testCase.getPropertyValue("set_DocumentType"))
remoteTestCase.setPropertyValue("set_FileName", testRunner.testCase.getPropertyValue("set_FileName"))
remoteTestCase.setPropertyValue("set_OwnerId", testRunner.testCase.getPropertyValue("set_OwnerId"))
log.info("set_Sheets = " + testRunner.testCase.getPropertyValue("set_Sheets"))
remoteTestCase.setPropertyValue("set_Sheets", testRunner.testCase.getPropertyValue("set_Sheets"))

def properties = new com.eviware.soapui.support.types.StringToObjectMap()
def async = false
def result = remoteTestCase.run(properties, async)
assert result.getStatus().toString() == "FINISHED"

// Set 'DocumentId' propery
testRunner.testCase.setPropertyValue("DocumentId", remoteTestCase.getPropertyValue("DocumentId"))
log.info("Set DocumentId = " + testRunner.testCase.getPropertyValue("DocumentId"))

// Set 'DocumentTypeId' propery
testRunner.testCase.setPropertyValue("DocumentTypeId", remoteTestCase.getPropertyValue("DocumentTypeId"))
log.info("Set DocumentTypeId = " + testRunner.testCase.getPropertyValue("DocumentTypeId"))

// Set 'ProjectId' propery
testRunner.testCase.setPropertyValue("ProjectId", remoteTestCase.getPropertyValue("ProjectId"))
log.info("Set ProjectId = " + testRunner.testCase.getPropertyValue("ProjectId"))

// Set 'ProjectName' propery
testRunner.testCase.setPropertyValue("ProjectName", remoteTestCase.getPropertyValue("ProjectName"))
log.info("Set ProjectName = " + testRunner.testCase.getPropertyValue("ProjectName"))

// Set 'SheetIds' propery
testRunner.testCase.setPropertyValue("SheetIds", remoteTestCase.getPropertyValue("SheetIds"))
log.info("Set SheetIds = " + testRunner.testCase.getPropertyValue("SheetIds"))

 

 

1 Reply

  • JuZ0's avatar
    JuZ0
    Contributor

    If I am not wrong the assertion fails because test case status is not set to a value "FINISHED". Could you print the output of that getStatus() method to see what it is actually returning?

     

    log.info result.getStatus()

    The output must be something else than expected "FINISHED" value.