SOAP UI Adding Groovy Assertions in Test Case


Adding Groovy Assertions in SOAP UI Test Case

  1. Select  your Test Case from project.
  2. Open Test Steps of this test case and double click on it
  1. Click Assertion
  1. Click Add Assertion

  1. Select Script Assertion   math and click add

  1. Double Click your Named Assertion.
  1. Write your groovy scripts in window.
In this I imported XML holder library for holding XML Response from server
Log.info ()  is used to print something on console
Holder.getnodeValue( ) function is getting a value of response by traversing XML response using XPATH  
Response XML:
  
     
        
           true
           City Found
           MA
           Boston
           Boston
           
              
                 2014-08-05T00:00:00
                 2
                 Partly Cloudy
                 
                    
                    83
                 
                 
                    
                    10
                 
              
              
                 2014-08-06T00:00:00
                 1
                 Thunder Storms
                 
                    68
                    79
                 
                 
                    30
                    50
                 
              
              
                 2014-08-07T00:00:00
                 2
                 Partly Cloudy
                 
                    64
                    78
                 
                 
                    40
                    20
                 
              
              
                 2014-08-08T00:00:00
                 4
                 Sunny
                 
                    62
                    76
                 
                 
                    20
                    20
                 
              
              
                 2014-08-09T00:00:00
                 4
                 Sunny
                 
                    63
                    78
                 
                 
                    20
                    10
                 
              
              
                 2014-08-10T00:00:00
                 4
                 Sunny
                 
                    63
                    80
                 
                 
                    10
                    10
                 
              
              
                 2014-08-11T00:00:00
                 4
                 Sunny
                 
                    65
                    81
                 
                 
                    10
                    10
                 
              
           
        
     
  

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s