Forum Discussion

easyfish's avatar
easyfish
Contributor
8 years ago
Solved

how to count pure SOAP request test steps

Hello!

 

Under my test case, I have data sources, SOAP requests,groovy scripts.  With  testCase.testStepCount, I count all the steps. I am wondering how to get the pure SOAP request number without counting other test steps, like data source  or groovy scripts.

 

Thanks for your kind support in advance!

 

 

 

  • Here is the groovy script which only log the step name if test step is a soap request type

     

    import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
    log.info context.testCase.testStepCount
    (0..context.testCase.testStepCount-1).each{
    	def step = context.testCase.testStepList[it]
    	if ( step instanceof WsdlTestRequestStep) {
    		log.info step.name
    	}
    }

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    Here is the groovy script which only log the step name if test step is a soap request type

     

    import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
    log.info context.testCase.testStepCount
    (0..context.testCase.testStepCount-1).each{
    	def step = context.testCase.testStepList[it]
    	if ( step instanceof WsdlTestRequestStep) {
    		log.info step.name
    	}
    }
    • easyfish's avatar
      easyfish
      Contributor

      Hello Rao,

      Thanks so much for the code. You are a super hero.

  • Dopes's avatar
    Dopes
    Established Member

     

    import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
    
    count = 0
    (1..context.testCase.testStepCount).each{
        def step = context.testCase.testStepList[it]
        if ( step instanceof WsdlTestRequestStep) {
            count++
            }
    }
    
    log.info count