WinScp and ReadyApI
Hi All
Scenario:
I need to fetch content of Winscp log files( from specific location) and compare the data of logs using SOAP UI by hitting another service .
Currently I am doing this manually
Is there any way I can automate this process
Or, any groovy script I can run to automate the whole process
Hey Nikita
I've never used it, but i think you can use the 'File Wait' test step. The file contents get loaded into a property. I've had to compare stuff before..... nmrao developed a groovy script that compared the contents of 2 properties against each other a while back for me.
the groovy is as follows:
/** * all work courtesy of Rao * This groovy script compares the specified property values of two property steps and report the error if any * For more details: https://community.smartbear.com/t5/SoapUI-Pro/Comparison-of-Two-Property-Values-In-Two-Different-Properties/m-p/175573#M40015 **/ //Define the property names as defined in the property steps //Say, Name in Property Step 1 : Name in Property Step 2 //This way, it is possible to compare even if property names do not match in two Property Steps //Add or remove as per your need def map = ['id1': 'id2', 'name':'name'] //Modify the names of the Property Test step if needed. Here two property steps with given names are defined in the test case. def p1 = context.testCase.testSteps["Properties1"].properties def p2 = context.testCase.testSteps["Properties2"].properties def result = [] def assertPropertyValue = { p1key, p2key -> def temp = p1[p1key].value == p2[p2key].value log.info("Comparing $p1key, and $p2key values respectively ${p1[p1key].value} == ${p2[p2key].value} ? $temp") temp } map.each { result << assertPropertyValue(it.key, it.value) } assert result.every{it == true}, 'Comparison failed, check log'
You could grab the FileWait content and pass to a Properties step, extract the detail from the Request's response and pass it to another Properties step and then run the groovy to compare the two. This is how I'd do this - although there's probably other groovy options available.
so if you use something like the following test step hierarchy with the above you can probably compare the contents of the log files against any detail transferred to a properties step via your Request step
FileWaitStep (log contents are saved to step PropertiesStep1)
PropertiesStep1 (holds the content of the FileWaitStep) RequestStep(generates response, grab response detail and pass to PropertiesStep2) PropertiesStep2 (holds the properties from RequestStep) GroovyScriptStep (compares the contents of the PropertiesStep1 to PropertiesStep2)hope this helps,
rich