Question: I want to know if there is a better way that iterating through a csv when performing a check. Virtually I am using SOAP UI (free version) to test a web service based on a search.

What I want to do is look at a response from a particular search request (the step name of the SOAP Request is 'Search Request') and look for all instances of test found in between xml tags `<TestID>` for both within `<IFInformation>` and `<OFInformation>` (this will be in a groovy script step).

```
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)

    import groovy.xml.XmlUtil
    def response = messageExchange.response.responseContent
    def xml = new XmlParser().parseText( response )

    def IF = xml.'soap:Body'
                    .IF*
                    .TestId.text()

    def OF = xml.'soap:Body'
                    .OF*
                    .TestId.text()

```

Now what I want to do is for each instance of the 'DepartureAirportId', I want to check that the ID is within a CSV file. There are two columns within the csv file (let's call it Search.csv) and both columns contain many rows. If the flight is found within any row within the first column, add a count +1 for the variable `'Test1'`, else if found in second column in csv, add count +1 for variable `'Test2'`. If not found within any, add count +1 for variable `'NotFound'`

I don't know if iterating through a csv is the best outcome or output all the data from the csv into an array list and iterate it through there but I want to know how this can be done and the best way for my own learning experience?

Answer: 
don't know about your algorithm, but the easiest way to iterate through simple csv file in groovy by line and splitting each line with separator:

```
new File("/1.csv").splitEachLine(","){line->
    println " ${ line[0] }   ${ line[1] } "
}

```

<http://docs.groovy-lang.org/latest/html/groovy-jdk/java/io/File.html#splitEachLine(java.lang.String,%20groovy.lang.Closure)>
You might want to use [CSV Validator](https://github.com/netsatan/validatecsv). 

```
Format.of(String regex)

```

It should do the trick - just provide the literal you're looking for as a rule for first column and check if it throws an exception or not.