Hi , I need help for daily sanity. Here is the story.
What is sanity ?
To check connectivity B/w App A, B and C. in IST, JST and UAT Environments
ModifyCustomer: From B to C , it changes customer name (Here I change customer name to current date and set changed name to SearchCustomer Request)
SearchCustomer: From A to B to C (it searches the customer name after ModifyCustomer)
What I am doing: In all Environment I have sample Customer account with Customer name and in each Environment I will modify customer name daily to current date and try to retrive same
If both ModifyCustomer and SearchCustomer passes, then I will write same to file. At present with below script in SearchCustomer script assertion, I am able to achieve sanity for one Environment only. I need a way to append the same for all environment in single file.
I have 3 same Test case for different Environments.
Here is the sample script under Script assertion of SearchCustomer in JST Test case. Similarly I have UAT and IST Test case
===========================
import javax.mail.*
import java.text.SimpleDateFormat
try{
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder("Search_Customer#Response")
def holder1 = groovyUtils.getXmlHolder("ModifyCustomer#Request")
def frm_SearchCustomer_res= holder.getNodeValue("//*:customerName")
def frm_modifyCust_req = holder1.getNodeValue("//*:CustName")
def DT = new Date()
trnID = new SimpleDateFormat("ddMMyyyy")
def daytime = trnID.format(DT)
def sub
//def FileRes1 = new File("C:\\SoapProj\\"+daytime+".txt")
if (frm_SearchCustomer_res == frm_modifyCust_req)
{
log.info ("JST_PASSED")
sub = "Sanity Passed"
log.info("Passed")
def FileRes = new File("C:\\SoapProj\\"+daytime+".txt")
if (FileRes.exists() ) {
FileRes.append("JST_PASSED") }
}
else
{
sub = "Sanity FAILED port"
log.info("Failed")
def FileRes1 = new File("C:\\SoapProj\\"+daytime+".txt")
FileRes1.write("JST_FAILED")
}
}
catch (Exception e)
{
log.info ("Script failed")
}
============================