I would like to update Issues in Epic based on custom field of the Epic I've tried reworking this over and over. I would like some assistance.
def linkType = "Issue in Epic"
def linkMgr = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def event = event as IssueEvent
Issue issue = event.issue as Issue
def accountField = cfManager.getCustomFieldObjects(issue)?.find{it.name == "Account"}
def cfValue = issue.getCustomFieldValue(accountField)
def epicLink = cfManager.getCustomFieldObjectByName("Epic Link")
def epicName = cfManager.getCustomFieldObjectByName("Epic Name")
def change = event?.changeLog?.getRelated("ChildChangeItem")?.find{it.field == accountField}
if (!change){
return
}
def linkedIssue = ComponentAccessor.issueLinkManager.getOutwardLinks(issue.id).findAll{it.issueLinkType.name == linkType}
if (!linkedIssue){
return
}
if (change){
linkedIssue.each{
def linkedIssueObj = it.destinationObject
def oldValue = linkedIssueObj.getCustomFieldValue(accountField)
def newValue = issue.getCustomFieldValue(accountField)
accountField.updateValue(null, linkedIssueObj, new ModifiedValue(oldValue, newValue), new DefaultIssueChangeHolder())
}
}
Related
I have two methods inside a class (mask_im and save_im) that I must include in several other classes in separate modules. How can I create a class with those two methods without copying and paste 10 lines of code, or at least reduce it to two lines of code? I want to have like a class template or something that I can reuse easily.
class MaskFromImages:
def __init__(self, im_to_mask, m_rules, val_assign=None):
im_mem = ReadMap(im_to_mask, mem=True)
self.reference = im_mem.reference
if im_mem.no_data is None:
self.out_no_data = 255
else:
self.out_no_data = im_mem.no_data
out_array = im_mem.array
out_mem = im_mem.osgeodata
for i in m_rules:
out_array = MaskCls(out_mem, i[0], i[1], val_assign).array
out_mem = save_map(out_array, "", im_mem.d_type, self.reference, format_out="MEM")
out_array = out_array.astype("int16")
self.array = out_array
def mask_im(self, mask_aoi, mask_aoi_vl, replace_im=None, reverse=False):
map_mem = save_map(self.array, "", gdal.GDT_UInt16, self.reference, format_out="MEM")
im_masked = MaskAOI(map_mem, mask_aoi, mask_aoi_vl, self.out_no_data,
replace_im=replace_im, reverse=reverse)
return im_masked
def save_im(self, output, format_out="GTiff"):
ds_out = save_map(self.array, output, gdal.GDT_UInt16, self.reference, out_no_data=self.out_no_data,
format_out=format_out)
if format_out == 'MEM':
return ds_out
This is the way I solved it using inheritance:
class Template:
def __init__(self):
self.array = None
self.reference = None
self.out_no_data = None
self.data_type = None
def mask(self, mask_aoi, mask_aoi_vl, replace_im=None, reverse=False):
map_mem = save_map(self.array, "", self.data_type, self.reference, format_out="MEM")
im_masked = MaskAOI(map_mem, mask_aoi, mask_aoi_vl, self.out_no_data,
replace_im=replace_im, reverse=reverse)
return im_masked
def save(self, output, format_out="GTiff"):
ds_out = save_map(self.array, output, self.data_type, self.reference, out_no_data=self.out_no_data,
format_out=format_out)
if format_out == 'MEM':
return ds_out
class MergeClasses(Template):
def __init__(self, input_data, m_classes, other_cls_val=None):
class_map1 = ReadMap(input_data)
self.reference = class_map1.reference
class_map1_array = class_map1.array
if class_map1.no_data is None:
self.out_no_data = 255
else:
self.out_no_data = class_map1.no_data
array_class = merge_cls(class_map1_array, m_classes, other_cls_val)
class_map_f = array_class.astype("int16")
self.array = class_map_f
self.data_type = gdal.GDT_UInt16
I am working on an ecommerce project but my OrderManager() class does not saving the instance(i think)
When i am clicking on BOOK button i am getting this error which is defined in my view
order_amount = order_obj.total * 100
AttributeError: 'NoneType' object has no attribute 'total'
But when i refresh the page error goes way and order_obj.total * 100 is calculated, But my question is why i need to refresh the page again and again when i create a new order.
Here is my models.py
class OrderQuerySet(models.query.QuerySet):
def not_created(self):
return self.exclude(status='created')
class OrderManager(models.Manager):
def get_queryset(self):
return OrderQuerySet(self.model, using=self.db)
def create_or_get_order(self, product):
created = None
obj = None
qs = self.get_queryset().filter(product=product, active=True, status='created')
if qs.count() == 1:
obj = qs.first()
else:
self.model.objects.create(product=product)
created = True
return obj, created
class Order(models.Model):
order_id = models.CharField(max_length=120, blank=True)
product = models.ForeignKey(Product, on_delete=models.CASCADE)
total = models.PositiveIntegerField()
active = models.BooleanField(default=True)
objects = OrderManager()
class Meta:
ordering = ['-ordered_on', '-updated']
def __str__(self):
return self.order_id
def check_done(self): # check everything is correct before final checkout
order_id = self.order_id
total = self.total
if order_id and total > 0:
return True
return False
def mark_paid(self):
if self.check_done():
self.status = 'paid'
self.save()
return self.status
def pre_save_create_order_id(sender, instance, *args, **kwargs):
if not instance.order_id:
instance.order_id = unique_order_id_generator(instance)
pre_save.connect(pre_save_create_order_id, sender=Order)
def pre_save_order_total(sender, instance, *args, **kwargs):
"""calculate the product total while clicking on Book Button
(Still booking is not done you just clicked on Book button)"""
instance.total = instance.product.price
pre_save.connect(pre_save_order_total, sender=Order)
Views.py
def checkout_home_view(request, *args, **kwargs):
order_obj = None
order_amount = None
order_currency = None
order_id = None
slug = kwargs['slug']
product = Product.objects.get(slug=slug)
if product is not None:
# ****************** Here is problem ******************************
order_obj, order_create = Order.objects.create_or_get_order(product)
''' HERE I AM GETTING order_obj as None BUT WHEN I REFRESH ERROR GOES WAY '''
print('order_obj', order_obj) # printing None initally
order_amount = order_obj.total * 100
order_currency = 'INR'
order_id = order_obj.order_id
if request.method == 'POST':
'check that booking is done'
is_prepared = order_obj.check_done() # check_done() defined in Order model
if is_prepared:
client = razorpay.Client(auth=("xxx", "xxx"))
payment = client.order.create(dict(amount=order_amount, currency=order_currency))
if payment:
order_obj.mark_paid() # mark_paid() defined in Order model
order_obj.save()
class OrderManager(models.Manager):
...
def create_or_get_order(self, product):
created = None
obj = None
qs = self.get_queryset().filter(product=product, active=True, status='created')
if qs.count() == 1:
obj = qs.first()
else:
# -------------- catch the returned obj and return --------------
obj = self.model.objects.create(product=product)
created = True
return obj, created
I have defined an attribute in a custom class, but I keep receiving an AttributeError when I try to access it.
class SMainWindow(QMainWindow):
def __init__(self):
# Constructor
super(SMainWindow, self).__init__()
self.myapp = PyQtApp()
self.layout = QVBoxLayout()
self.label_text = ''
self.settings = scrudb.retrieve_settings('current')
self.competition = self.retrieve_competition()
self.set_competition(self.competition.id)
self.label = QLabel(self.label_text)
self.button_scrutineer = QPushButton('Scrutineer Competition')
self.button_comps = QPushButton('Change Competition')
self.button_comp = QPushButton('Edit Competition Details')
self.button_dancers = QPushButton('Add/Edit Competitors')
self.button_judges = QPushButton('Add/Edit Judges')
self.button_dancerGroups = QPushButton(
'Define Competitor Groups & Dances')
self.button_import = QPushButton('Import CSV')
self.button_delete = QPushButton('Delete Competition')
self.button_exit = QPushButton('Exit')
self.button_comps.clicked.connect(self.select_competition)
self.button_delete.clicked.connect(self.delete_competition)
self.button_exit.clicked.connect(self.exit_app)
if (self.competition == None):
self.disable_buttons()
self.layout.addWidget(self.label)
self.layout.addWidget(self.button_scrutineer)
self.layout.addWidget(self.button_comps)
self.layout.addWidget(self.button_comp)
self.layout.addWidget(self.button_dancers)
self.layout.addWidget(self.button_judges)
self.layout.addWidget(self.button_dancerGroups)
self.layout.addWidget(self.button_import)
self.layout.addWidget(self.button_delete)
self.layout.addWidget(self.button_exit)
self.myapp.setLayout(self.layout)
def set_competition(self, comp_id):
self.competition = scrudb.retrieve_competition(comp_id)
if (self.competition != None):
self.label_text = ('<center>Competition:<br><strong>%s</strong><br>%8s<br>%s</center>' % (self.competition.name, self.get_formatted_date(self.competition.eventDate), self.competition.location))
self.label.setText(self.label_text)
self.settings.lastComp = self.competition.id
scrudb.set_settings(self.settings)
return self.competition
else:
self.label_text = ('<center>No Competition Selected</center>')
return None
File "/Users/majikpig/mu_code/src/main/python/scruinterface1.py", line 182, in set_competition
self.label.setText(self.label_text)
AttributeError: 'SMainWindow' object has no attribute 'label'
You need to change order of fields ... in set competition function you try to access field, which you haven't defined yet.
self.set_competition(self.competition.id)
self.label = QLabel(self.label_text)
I am trying to create a calendar app in python.As for now I have manage to create the Gtk.window, a Gtk.Notebook with two pages (page1 month calendar, page 2 week calendar) added to the Gtk.window.I have used Gtk.Calendar for month and from signal 'day-selected' I used a function to get_date().Also I used a Gtk.TextView with Gtk.TextBuffer to input text (as a note).
First question : how to connect the date with the input text and store it in a list or dictionary so i can save it later to a file.
Second:I have activate details with self.calendar.set_property("show-details", True) and defined a function self.calendar.set_detail_func(self.cal_entry) for details.
def cal_entry(self, calendar, year, month, date):
if self.textbuffer is not None:
self.calendar.mark_day(self.day)
How to mark the days with notes(text in Gtk.TextBuffer) because the above function does not work correctly.
Below is a snippet of the code:
class Window(Gtk.ApplicationWindow):
def __init__(self, app):
super(Window, self).__init__(title="Live Calendar", application=app)
self.set_default_size(-1, 400)
self.set_resizable(False)
self.set_border_width(10)
self.create_notebook()
self.entry()
self.refresh_icon()
def refresh_icon(self):
#refreshing the icon of the app
print(get_filename())
subject_lines = read_file(subject)
index = [i for i in range(len(subject_lines)) \
if subject_lines[i].startswith("Icon=")][0]
subject_lines[index] = "Icon=" + get_filename() + "\n"
write_file(subject, subject_lines)
self.set_icon_from_file(get_filename())
timer = threading.Timer(60, self.refresh_icon)
timer.start()
def create_notebook(self):
# Open Buttton
self.openbutton = Gtk.Button("Open")
self.openbutton.set_tooltip_text("Open Notes")
self.openbutton.connect("clicked", self.on_open_clicked)
# Save Button
self.savebutton = Gtk.Button("Save")
self.savebutton.set_tooltip_text("Save Notes")
self.savebutton.connect("clicked", self.on_save_clicked)
# Header
self.header = Gtk.HeaderBar(title="Live Calendar")
self.header.set_property("show_close_button", True)
self.header.pack_start(self.openbutton)
self.header.pack_start(self.savebutton)
self.set_titlebar(self.header)
#page1 month calendar
self.page1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
self.calendar = Gtk.Calendar()
self.calendar.set_property("show-week-numbers", True)
self.calendar.set_detail_height_rows(2)
self.calendar.set_detail_width_chars(2)
self.calendar.set_property("show-details", True)
self.calendar.set_detail_func(self.cal_entry)
self.__connect_signals()
self.page1.add(self.calendar)
#note taking
self.sw = Gtk.ScrolledWindow()
self.sw.set_hexpand(True)
self.sw.set_vexpand(True)
self.textview = Gtk.TextView()
self.textview.set_editable(True)
self.textview.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
self.textbuffer = self.textview.get_buffer()
self.sw.add(self.textview)
self.page1.pack_start(self.sw, True, True, 0)
#page2 week calendar
......a lot of code.......
#create notebook
self.notebook = Gtk.Notebook()
self.notebook.set_tab_pos(0)
self.notebook.append_page(self.page1, Gtk.Label('Month'))
self.notebook.append_page(self.page2, Gtk.Label('Week'))
self.add(self.notebook)
def __connect_signals(self):
self.day_selected_handle = self.calendar.connect('day-selected', self.entry)
def entry(self, *args):
self.page1.remove(self.label)
self.year, self.month, self.day = self.calendar.get_date()
self.month = self.month + 1
self.entrydate = datetime.date(self.year, self.month, self.day)
self.notedate = self.entrydate.strftime("%d/%m/%y")
self.text = self.entrydate.strftime("%d/%m/%y write your notes here...")
self.label = Gtk.Label(self.text)
self.page1.pack_start(self.label, False, False, 0)
self.show_all()
def cal_entry(self, calendar, year, month, date):
if self.textbuffer is not None:
self.calendar.mark_day(self.day)
#save into file
def on_save_clicked(self, widget):
dialog = Gtk.FileChooserDialog("Save file", self,
Gtk.FileChooserAction.SAVE,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
response = dialog.run()
if response == Gtk.ResponseType.OK:
save_file = dialog.get_filename()
start_iter = self.textbuffer.get_start_iter()
end_iter = self.textbuffer.get_end_iter()
text = self.textbuffer.get_text(start_iter, end_iter, True)
with open(save_file, 'w') as f:
f.write(text)
elif response == Gtk.ResponseType.CANCEL:
dialog.destroy()
dialog.destroy()
# open and read the file
def on_open_clicked(self, widget):
dialog = Gtk.FileChooserDialog("Please choose a file", self,
Gtk.FileChooserAction.OPEN,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
filter_text = Gtk.FileFilter()
filter_text.set_name("Text files")
filter_text.add_mime_type("text/plain")
dialog.add_filter(filter_text)
response = dialog.run()
if response == Gtk.ResponseType.OK:
selected_file = dialog.get_filename()
with open(selected_file, 'r') as f:
data = f.read()
self.textbuffer.set_text(data)
elif response == Gtk.ResponseType.CANCEL:
dialog.destroy()
dialog.destroy()
def quitApp(self, par):
app.quit()
class Application(Gtk.Application):
def __init__(self):
super(Application, self).__init__()
def do_activate(self):
self.win = Window(self)
self.win.show_all()
def do_startup(self):
Gtk.Application.do_startup(self)
app = Application()
app.run(sys.argv)
Any help will be appriciated.
Thanks in advance
For the first question: Depends, but probably a dictionary indexed by a triple for y/m/d
d = dict()
d[(2019, 10, 1)] = "your notes..."
Second question: The way details work is that cal_entry(self, calendar, year, month, day) must return a string to be displayed below the day, in the calendar. So you have to get the text from the dictionary above. You can do that with:
def cal_entry(self, calendar, year, month, day):
self.calendar.mark_day(day)
return dict.get((year, month, day))
Maybe this sample code can help:
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class NotePopover(Gtk.Popover):
def __init__(self, app):
Gtk.Popover.__init__(self)
self.set_size_request(200, 300)
grid = Gtk.Grid()
grid.set_orientation(Gtk.Orientation.VERTICAL)
scrolled_window = Gtk.ScrolledWindow()
self.text_view = Gtk.TextView()
scrolled_window.add(self.text_view)
grid.add(scrolled_window)
button = Gtk.Button(label='Add')
grid.add(button)
grid.show_all()
self.add(grid)
scrolled_window.set_vexpand(True)
scrolled_window.set_hexpand(True)
button.connect('clicked', self.on_button_clicked)
self.app = app
def do_popup(self):
self.popup()
def on_button_clicked(self, widget):
year = app.win.calendar.get_property('year')
month = app.win.calendar.get_property('month')
day = app.win.calendar.get_property('day')
start_iter = self.text_view.get_buffer().get_start_iter()
end_iter = self.text_view.get_buffer().get_end_iter()
app.notes_dict[(year, month, day)] = self.text_view.get_buffer().get_text(start_iter, end_iter, True)
app.win.do_update()
self.text_view.get_buffer().set_text("")
self.popdown()
class Window(Gtk.Window):
def __init__(self, app):
Gtk.Window.__init__(self)
self.set_title('Test GtkCalendar')
self.set_default_size(400, 300)
header_bar = Gtk.HeaderBar()
header_bar.set_show_close_button(True)
self.set_titlebar(header_bar)
button = Gtk.Button(label="Add note")
button.get_style_context().add_class('suggested-action')
button.connect('clicked', self.on_button_clicked)
header_bar.pack_start(button)
grid = Gtk.Grid()
grid.set_orientation(Gtk.Orientation.VERTICAL)
self.calendar = Gtk.Calendar()
scrolled_window = Gtk.ScrolledWindow()
self.text_view = Gtk.TextView()
self.add(grid)
grid.add(self.calendar)
grid.add(scrolled_window)
scrolled_window.add(self.text_view)
self.calendar.set_hexpand(True)
self.calendar.set_halign(Gtk.Align.CENTER)
scrolled_window.set_vexpand(True)
scrolled_window.set_hexpand(True)
self.popover = NotePopover(app)
self.popover.set_relative_to(button)
self.connect('destroy', Gtk.main_quit)
self.calendar.connect('day-selected', self.calendar_changed)
self.calendar.connect('month-changed', self.calendar_changed)
self.show_all()
self.app = app
def on_button_clicked(self, widget):
self.popover.do_popup()
def calendar_changed(self, widget):
self.do_update()
def do_update(self):
year = app.win.calendar.get_property('year')
month = app.win.calendar.get_property('month')
day = app.win.calendar.get_property('day')
text = app.notes_dict.get((year, month, day))
if text is not None:
self.text_view.get_buffer().set_text(text)
else:
self.text_view.get_buffer().set_text("")
class Application:
def __init__(self):
self.notes_dict = dict()
self.win = Window(self)
if __name__ == '__main__':
app = Application()
Gtk.main()
I am trying to do some automation using groovy. I am taking response data another request and storing both request and both output in excel using jxl jars. but if I do that my excel file is getting corrupted. but when I did single request response it's working fine. so I want to know is there any memory issues with jxl??if yes how to overcome that??
Here's my script:
import jxl.*
import jxl.write.*
import groovy.sql.Sql
//Datasheet read define start
def projectLocation="E:/"
def dataFileLocation=projectLocation+"zip.xls"
def workbook = Workbook.getWorkbook(new File(dataFileLocation))
def readSheet = workbook.getSheet(0)
def rowCount = readSheet.getRows()
def colCount = readSheet.getColumns()
def myTestCase = context.testCase
//db config
def url = 'jdbc:hsqldb:hsql://localhost/'
def user = 'sa'
def password = ''
def driver = 'org.hsqldb.jdbcDriver'
def sql = Sql.newInstance(url, user, password, driver)
propTestStep = myTestCase.getTestStepByName("Properties");
//Datasheet read end
//Content Write define start
WorkbookSettings s = new WorkbookSettings();
s.setUseTemporaryFileDuringWrite(true);
// s.setInitialFileSize(100000000)
WritableWorkbook workbook1 = Workbook.createWorkbook(new File(projectLocation+"output1.xls"),s)
WritableSheet writeSheet = workbook1.createSheet("new", 0)
//
//WritableWorkbook workbook2 = Workbook.createWorkbook(new File(projectLocation+"output2.xls"))
//WritableSheet writeSheet1 = workbook2.createSheet("newOutput", 0)
def project = testRunner.testCase.testSuite.project
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
//Content Write define end
for(int i = 1;i < rowCount; i++)
{
for(int j = 0;j < colCount; j++)
{
val= readSheet.getCell(j,i).getContents()
// log.info "before storing in zip val="+ val
// propTestStep.setPropertyValue("zip",val)
def req=groovyUtils.getXmlHolder( "GetInfoByZIP#Request" )
req["//web:USZip"] = val
req.updateProperty()
testRunner.runTestStep( project.testSuites['USZipSoap12 TestSuite'].testCases['GetInfoByZIP TestCase'].testSteps['GetInfoByZIP'] )
// log.info "before sending to db val="+val
sql.eachRow('select state,city from zip where zip=?',[val]){ row ->
st= row.state
ct= row.city
}
//log.info st+" "+ct
def res=groovyUtils.getXmlHolder( "GetInfoByZIP#Response" )
def state = res.getNodeValues( "//STATE" )
def city=res.getNodeValues("//CITY")
def ct1=city[0]
log.info ct +" " + ct1
if(ct1.equalsIgnoreCase(ct)){
// log.info "city equals"
}
else{
// log.info "not eq"
}
def req1=groovyUtils.getXmlHolder( "GetInfoByState#Request" )
req1["//web:USState"]=state[0]
req1.updateProperty()
testRunner.runTestStep( project.testSuites['USZipSoap12 TestSuite'].testCases['GetInfoByZIP TestCase'].testSteps['GetInfoByState'] )
def respo1= testRunner.testCase.testSteps["GetInfoByState"].testRequest.response.contentAsString
Label labelReq = new Label(j,i,context.testCase.getTestStepByName("GetInfoByZIP").getProperty("request").value)
Label labelReq1 = new Label(j+2,i,context.testCase.getTestStepByName("GetInfoByState").getProperty("request").value)
def response = testRunner.testCase.testSteps["GetInfoByZIP"].testRequest.response.contentAsString
Label labelResp = new Label(j+1,i,response);
Label labelResp1 = new Label(j+3,i,respo1);
writeSheet.addCell(labelReq)
writeSheet.addCell(labelResp);
log.info respo1
writeSheet.addCell(labelReq1)
writeSheet.addCell(labelResp1);
}
}
workbook1.write()
workbook1.close()
I think you are response data exceeding the cell limit of excel. You can check that thing with copy paste the response in word check how many characters are there. Excel can contain 32,767 char in one line. if it is more than that it may get corrupt.
Most likely, you're overriding something unintentionally. I can't tell what it is. But, a good starting point is with much cleaner code. So I recommend using Frosted Sheets (backed by Apache POI) instead of JXL. It makes working with workbooks MUCH much much easier.
I wrote the library because I got tired of seeing some of the nastiest code ever, and I knew it could be done more... Groovy-ly.
import com.emmanuelrosa.frostedsheets.*
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import groovy.sql.Sql
def projectLocation="E:/"
def dataFileLocation="${projectLocation}zip.xls"
def workbook = new FrostedWorkbook(new HSSFWorkbook(new FileInputStream(dataFileLocation)))
def rowCount = readSheet.getRows()
def colCount = readSheet.getColumns()
def myTestCase = context.testCase
def url = 'jdbc:hsqldb:hsql://localhost/'
def user = 'sa'
def password = ''
def driver = 'org.hsqldb.jdbcDriver'
def sql = Sql.newInstance(url, user, password, driver)
propTestStep = myTestCase.getTestStepByName("Properties");
def workbook1 = FrostedWorkbook.createXLS()
def writeSheet = workbook1['new']
def project = testRunner.testCase.testSuite.project
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
/*
* cellIterator() returns a special Iterator which traverses
* through the cells by row, then column; top-down, left-right.
* It eliminates the need for nested loops.
*/
workbook[0].cellIterator().each { cell ->
req["//web:USZip"] = cell.cellValue
def req=groovyUtils.getXmlHolder( "GetInfoByZIP#Request" )
req.updateProperty()
testRunner.runTestStep( project.testSuites['USZipSoap12 TestSuite'].testCases['GetInfoByZIP TestCase'].testSteps['GetInfoByZIP'] )
sql.eachRow('select state,city from zip where zip=?',[val]) { row ->
st= row.state
ct= row.city
}
def res=groovyUtils.getXmlHolder( "GetInfoByZIP#Response" )
def state = res.getNodeValues( "//STATE" )
def city=res.getNodeValues("//CITY")
def ct1=city[0]
log.info ct +" " + ct1
if(ct1.equalsIgnoreCase(ct)) {
// log.info "city equals"
}
else{
// log.info "not eq"
}
def req1=groovyUtils.getXmlHolder( "GetInfoByState#Request" )
req1["//web:USState"]=state[0]
req1.updateProperty()
testRunner.runTestStep( project.testSuites['USZipSoap12 TestSuite'].testCases['GetInfoByZIP TestCase'].testSteps['GetInfoByState'] )
writeSheet[cell.rowIndex + 1].with {
def stateInfo = testRunner.testCase.testSteps["GetInfoByState"].testRequest.response.contentAsString
def zipValue = context.testCase.getTestStepByName("GetInfoByZIP").getProperty("request").value
def stateValue = context.testCase.getTestStepByName("GetInfoByState").getProperty("request").value
def zipInfo = testRunner.testCase.testSteps["GetInfoByZIP"].testRequest.response.contentAsString
// Add the columns to the row
append [zipValue, zipInfo, stateValue, stateInfo]
}
}
new FileOutputStream("${projectLocation}output1.xls").withStream { stream ->
workbook1.write(stream)
}