cancel
Showing results for 
Search instead for 
Did you mean: 

Error while getting testcases status from all testsuites on project level

Regular Contributor

Error while getting testcases status from all testsuites on project level

i placed below script on Project - Teardown but its giving below error 

 

Note: If i place below script on TestSuite level - working fine but not working on project level 

 

ERROR [errorlog] com.eviware.soapui.support.scripting.ScriptException: Error in TearDown Script of APIAutomation
com.eviware.soapui.support.scripting.ScriptException: Error in TearDown Script of APIAutomation
at com.eviware.soapui.impl.wsdl.WsdlProject.runAfterRunScript(WsdlProject.java:2739) ~[ready-api-soapui-2.6.0.jar:2.6.0]
at com.eviware.soapui.impl.wsdl.testcase.WsdlProjectRunner.internalFinally(WsdlProjectRunner.java:186) [ready-api-soapui-2.6.0.jar:2.6.0]
at com.eviware.soapui.impl.wsdl.testcase.WsdlProjectRunner.internalFinally(WsdlProjectRunner.java:1) [ready-api-soapui-2.6.0.jar:2.6.0]
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:154) [ready-api-soapui-2.6.0.jar:2.6.0]
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:73) [ready-api-soapui-2.6.0.jar:2.6.0]
at com.eviware.soapui.impl.wsdl.WsdlProject.run(WsdlProject.java:2761) [ready-api-soapui-2.6.0.jar:2.6.0]
at com.eviware.soapui.impl.wsdl.WsdlProjectPro.run(WsdlProjectPro.java:1208) [ready-api-soapui-pro-2.6.0.jar:2.6.0]
at com.eviware.soapui.impl.wsdl.WsdlProjectPro.run(WsdlProjectPro.java:1203) [ready-api-soapui-pro-2.6.0.jar:2.6.0]
at com.smartbear.ready.cmd.runner.SoapUITestCaseRunner.runProject(SoapUITestCaseRunner.java:599) [ready-api-runners-2.6.0.jar:?]
at com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner.runProject(SoapUIProTestCaseRunner.java:301) [ready-api-runners-2.6.0.jar:?]
at com.smartbear.ready.cmd.runner.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:500) [ready-api-runners-2.6.0.jar:?]
at com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner.runRunner(SoapUIProTestCaseRunner.java:111) [ready-api-runners-2.6.0.jar:?]
at com.smartbear.ready.cmd.runner.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:293) [ready-api-runners-2.6.0.jar:?]
at com.smartbear.ready.cmd.runner.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:174) [ready-api-runners-2.6.0.jar:?]
at com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner.init(SoapUIProTestCaseRunner.java:88) [ready-api-runners-2.6.0.jar:?]
at com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner.main(SoapUIProTestCaseRunner.java:84) [ready-api-runners-2.6.0.jar:?]
Caused by: groovy.lang.MissingPropertyException: No such property: testSuite for class: Script1
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53) ~[groovy-all-2.4.4.jar:2.4.4]
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52) ~[groovy-all-2.4.4.jar:2.4.4]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307) ~[groovy-all-2.4.4.jar:2.4.4]

 

 

script : 

import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
import com.eviware.soapui.model.testsuite.TestRunner.Status 
import com.eviware.soapui.impl.wsdl.*
import com.eviware.soapui.impl.wsdl.testcase.*
import com.eviware.soapui.model.testsuite.*

def testCaseMap = [:]
def testCaseStatusMap = [:]
testSuite.testCaseList.each{

def reportMap=[:]
it.testSteps.each{

def testCaseStatus =true
try{

reportMap << [(it.value.name):(it.value.getAssertionStatus().toString())]
tempStatus = (it.value.getAssertionStatus().toString()=='PASS')?true:false
testCaseStatus = testCaseStatus && tempStatus

testSuite.setPropertyValue("Status", testCaseStatus.toString())
}

catch (e){

//log.info e

}

}

testCaseStatus = testSuite.getPropertyValue("Status")
def testCaseStatusStr = (testCaseStatus=='true')?'PASS': 'FAIL'

testCaseStatusMap << [(it.name):(testCaseStatusStr.toString())]
}

 

 

 

11 REPLIES 11
Contributor

Re: Error while getting testcases status from all testsuites on project level

The reason this is not working at the project level is because you have not mapped out the testSuites. You will have to map out the test suites the same way you mapped out the test cases.

Regular Contributor

Re: Error while getting testcases status from all testsuites on project level

Can you share script?
Community Hero

Re: Error while getting testcases status from all testsuites on project level

What are you trying to do?


Regards,
Rao.
Regular Contributor

Re: Error while getting testcases status from all testsuites on project level

I am trying to get the status of all test cases from all the testsuites under the project teardown after completing the testRun 

 

 

Community Hero

Re: Error while getting testcases status from all testsuites on project level

Can you check below thread and see if you can use it ?
https://stackoverflow.com/questions/41700437/creating-a-test-report-from-project-level-tear-down-scr...


Regards,
Rao.
Regular Contributor

Re: Error while getting testcases status from all testsuites on project level

appreciate your reply but, can you take a look my script and help me what i need to change based on this below comment  

 

"not mapped out the testSuites. You will have to map out the test suites the same way you mapped out the test cases."

Regular Contributor

Re: Error while getting testcases status from all testsuites on project level

Added project Map but still getting error 

 

Here is updated code : 

 

import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
import com.eviware.soapui.model.testsuite.TestRunner.Status
import com.eviware.soapui.impl.wsdl.*
import com.eviware.soapui.impl.wsdl.testcase.*
import com.eviware.soapui.model.testsuite.*

 

def projectMap = [:]

def projectStatusMap = [:]

def testCaseMap = [:]
def testCaseStatusMap = [:]
testSuite.testCaseList.each{

def reportMap=[:]
it.testSteps.each{

def testCaseStatus =true
try{

reportMap << [(it.value.name)Smiley Sadit.value.getAssertionStatus().toString())]
tempStatus = (it.value.getAssertionStatus().toString()=='PASS')?true:false
testCaseStatus = testCaseStatus && tempStatus

testSuite.setPropertyValue("Status", testCaseStatus.toString())
}

catch (e){

//log.info e

}

}

testCaseStatus = testSuite.getPropertyValue("Status")
def testCaseStatusStr = (testCaseStatus=='true')?'PASS': 'FAIL'

testCaseStatusMap << [(it.name)Smiley SadtestCaseStatusStr.toString())]
}

Regular Contributor

Re: Error while getting testcases status from all testsuites on project level

Added project Map but still getting error 

 

#Added - 

def projectMap = [:]

def projectStatusMap = [:]

 

Regular Contributor

Re: Error while getting testcases status from all testsuites on project level

Any update here ?- really appreciate !

New Here?
Join us and watch the welcome video:
Top Kudoed Authors