class DependentData: def __init__(self, case_id): self.case_id = case_id self.run_method = RunMethod() self.opera_excel = OperationExcel() self.data = GetData() # 获取依赖数据的行号 def get_depend_row(self): row_num = self.opera_excel.get_row_num(self.case_id) return row_num # 获取依赖行的数据 def get_depend_line_data(self): row_data = self.opera_excel.get_row_data(self.case_id) return row_data # 执行依赖数据,获取接口返回的数据 def get_dependent_data(self): row_num = self.opera_excel.get_row_num( self.case_id) # 根据依赖的case_id获取依赖数据的行号 request_data = self.data.get_request_data(row_num) # 根据行号获取请求的数据 url = self.data.get_request_url(row_num) headers = self.data.get_is_header(row_num) method = self.data.get_request_method(row_num) res = self.run_method.run_main(method, url, request_data, headers) return json.loads(res) # 根据接口返回的数据,获取依赖字段对应的值 def get_dependent_values(self, row): depend_key = self.data.get_depend_key(row) # 获取依赖的字段key response_data = self.get_dependent_data() # 获取依赖接口返回的数据 json_exe = parse(depend_key) madle = json_exe.find(response_data) return [math.value for math in madle][0]
class RunTest: def __init__(self): self.run_method = RunMethod() self.data = GetData() #程序执行的入口 def go_on_run(self): self.data.get_case_lines()
def __init__(self, parent, safetyMode="viewAccess", *args, **kwargs): wx.Frame.__init__(self, parent, *args, **kwargs) self.safetyMode = safetyMode ConfigData.__init__(self, *args, **kwargs) StatusBar.__init__(self, parent, *args, **kwargs) MenuBar.__init__(self, parent, *args, **kwargs) ToolBar.__init__(self, parent, *args, **kwargs) TreeContextMenu.__init__(self, parent, *args, **kwargs) # Some actions which are not relevant for any specific area Actions.__init__(self, *args, **kwargs) # The functions to enable printing Printing.__init__(self, parent, *args, **kwargs) # The functions to enable the help system Help.__init__(self, *args, **kwargs) # The functions to enable the about dialog About.__init__(self, *args, **kwargs) # The functions to enable the about dialog Settings.__init__(self, *args, **kwargs) #Set main splitter MainSplitter.__init__(self, *args, **kwargs) #Add the xml tree Document.__init__(self, *args, **kwargs) #Fill xml tree GetData.__init__(self, *args, **kwargs) #Add functions to modify the view of the xml tree ViewData.__init__(self, *args, **kwargs) #Add functions to edit the xml tree EditData.__init__(self, *args, **kwargs) #Copy example files: Comment this out if Template-Designer is in productive use. #self.getExamples() #Some kind of self check self.saveConfig() #Set panels #self.propertiesPanel = wx.Panel(self.mainSplitter) self.propertiesPanel = wx.ScrolledWindow(self.mainSplitter) self.templatePanel = wx.Panel(self.mainSplitter) #Buttons on main frame self.applyButton = wx.Button(self.propertiesPanel, wx.ID_APPLY, _(u"Apply changes"), name="applyButton") self.defaultsButton = wx.Button(self.propertiesPanel, wx.ID_RESET, _(u"Restore settings"), name="defaultsButtons") expandAllButtonPath = self.documentTreeGraphics() + "/2downarrow.png" expandAllButtonBmp = wx.Image(expandAllButtonPath, wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.expandAllButton = wx.BitmapButton(self.templatePanel, -1, expandAllButtonBmp, name="expandButton") collapseAllButtonPath = self.documentTreeGraphics() + "/2uparrow.png" collapseAllButtonBmp = wx.Image(collapseAllButtonPath, wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.collapseAllButton = wx.BitmapButton(self.templatePanel, -1, collapseAllButtonBmp, name="collapseButton") addButtonPath = self.documentTreeGraphics() + "/filenew.png" addButtonBmp = wx.Image(addButtonPath, wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.addButton = wx.BitmapButton(self.templatePanel, -1, addButtonBmp, name="addButton") deleteButtonPath = self.documentTreeGraphics() + "/edit_delete.png" deleteButtonBmp = wx.Image(deleteButtonPath, wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.deleteButton = wx.BitmapButton(self.templatePanel, -1, deleteButtonBmp, name="deleteButton") """ Set taskbar icon. If you remove this, do not forget to remove the RemoveIcon() and Destroy() methods in self.onCloseWindow() """ self.taskBarIcon = wx.TaskBarIcon() iconPath = self.skinGraphics() + "/domtreeviewer.png" icon = wx.Icon(iconPath, wx.BITMAP_TYPE_PNG) self.taskBarIcon.SetIcon(icon, _(u"Template-Designer")) #Set titlebar icon self.SetIcon(icon) #Initiate the contents of the property panel self.pp = pp self.__doProperties() self.__doBindings() self.__doLayout() Safety(self)
def __init__(self, case_id): self.case_id = case_id self.run_method = RunMethod() self.opera_excel = OperationExcel() self.data = GetData()
def add_test_method(): data = GetData() rows_count = data.get_case_lines() for row in range(1, rows_count): setattr(RunTest, "test_%d" % row, RunTest.get_case_all(row))
def setUpClass(cls): cls.run_method = RunMethod() cls.data = GetData() cls.pass_count = [] cls.fail_count = []
def __init__(self): self.run_method = RunMethod() self.data = GetData()