小编Bry*_*ley的帖子

你在UI测试自动化中有什么特别的自动化?

到目前为止,我在各种测试框架(Selenium,Tellurium,Canoo等)上阅读的所有文档都鼓励(或至少集中)通过UI对应用程序进行功能测试.我在下面看到的很少,我认为是最重要的

  1. 本地化测试
  2. 可用性测试
  3. 跨浏览器兼容性测试
  4. 针对同一浏览器的多个版本进行测试
  5. xss/sql注入
  6. 验证
  7. UI /表示层是否调用正确的服务层API(通过基于组件的测试彻底测试服务层)

所以这是我的问题

1)你在UI测试自动化方面有什么特别的自动化?

2)哪个UI测试框架可以满足以上所有项目?

architecture testing selenium automation

5
推荐指数
1
解决办法
343
查看次数

Selenium Internet Explorer 8缓存问题

当我在Win XP Internet Explorer 8上运行我的Selenium测试时,测试没有重新开始.它将使用之前运行的cookie /缓存启动测试.当我在Firefox中运行测试时,这不会发生.有人有解决方法吗?最好在Python
中我的一些想法:
- 在tearDownClass中运行一个脚本,删除所有临时文件:C:\ Documents and Settings\Owner\Local Settings\Temporary Internet Files
- 而不是"*iehta"作为我设置的浏览器它到Internet Explorer私有模式"*自定义C:\ Program Files\Internet Explorer\iexplore.exe -private"( - 由于我的语法关闭,这不起作用?

谢谢.

import unittest, inspect, time, re,  os
from selenium import selenium

class TESTVerifications(unittest.TestCase):
@classmethod
def setUpClass(self):

    self.selenium = selenium("localhost", 4444, "*iehta", "https://workflowy.com/")
    self.selenium.start() 
    self.selenium.set_timeout("60000")
    print("setUpClass")      
    self.selenium.window_maximize()
    self.selenium.open("/")


def setUp(self):
    self.verificationErrors = []


def test_login_6(self):
    sel = self.selenium
    sel.open("/") 
    sel.type("css=input[id='id_username']",'test+abc010@workflowy.com'  )
    sel.type("css=input[id='id_password']",'password')
    sel.click("css=form[id='login'] > input.submit")
    sel.wait_for_page_to_load("60000")
    self.failUnless(sel.is_element_present("id=logout"))


def tearDown(self):
    #self.selenium.stop()
    self.assertEqual([], self.verificationErrors,"Results: " + str(self.verificationErrors))
@classmethod    
def …
Run Code Online (Sandbox Code Playgroud)

python selenium internet-explorer

5
推荐指数
1
解决办法
767
查看次数

如何将python logger指向Tkinker的Listbox?

我有一个简单的应用程序,其中一个类表示数据结构,一个类用于GUI.我在第一堂课中使用了一个记录器:

class A(object):
    def __init__(self):
        self.logger = logging.getLogger(self.__class__.__name__)
        self.logger.info('creating new A object')
Run Code Online (Sandbox Code Playgroud)

等等

GUI包含一个带有Listbox的Tkinter窗口.

如何将日志定向到列表框?我希望看到消息填充列表,因为它们被记录而不是显示在控制台或日志文件中.

如何在执行类中的方法时更新列表框?

python logging tkinter

5
推荐指数
1
解决办法
514
查看次数

奇怪的Tkinter鼠标悬停行为

我一直在尝试使用鼠标悬停事件来更改Tkinter中的butten小部件的背景颜色.我在网上得到了一些简单的代码,适用于文本,但颜色不合适.这里是:

from Tkinter import *
root - Tk()

b = Button(root, text='foo')
b.pack()

def enterB(event):
    b.configure(text='bar', background='red')

def leaveB(event):
    b.configure(text='foo')

b.bind('<Enter>', enterB)
b.bind('<Leave>', leaveB)

root.mainloop()
Run Code Online (Sandbox Code Playgroud)

当我将鼠标放在按钮上时,文本会变为"bar",但背景颜色会保持灰色.当我的鼠标离开按钮上方的区域时,背景颜色变为红色,文本变为"foo".这与应该发生的事情相反.

如果我在leaveB函数的b.configure语句中放置background ='blue',并保持其余部分相同,则保留按钮将使按钮保持蓝色,并且它永远不会是红色.

谁能告诉我发生了什么?

谢谢.

python tkinter

5
推荐指数
1
解决办法
3589
查看次数

tkinter中的AttributeError

我正在尝试用tkinter编写程序.我还没有完成程序,但试图运行它只是为了看看我的窗口看起来如何,我在tkinter中得到一个错误.

我不知道现在该怎么办.谁知道错了什么?

这是消息

Traceback (most recent call last):
  File "<string>", line 420, in run_nodebug
  File "<module1>", line 53, in <module>
  File "<module1>", line 50, in main
  File "<module1>", line 23, in __init__
  File "C:\Python33\lib\tkinter\__init__.py", line 2110, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "C:\Python33\lib\tkinter\__init__.py", line 2036, in __init__
    classes = [(k, v) for k, v in cnf.items() if isinstance(k, type)]
AttributeError: 'str' object has no attribute 'items'

import tkinter
import tkinter.messagebox

#---------------------- define GUI class
class CalcMPG:
    def __init__(self): …
Run Code Online (Sandbox Code Playgroud)

python tkinter

5
推荐指数
1
解决办法
2424
查看次数

在tkinter中,为什么winfo_height()总是返回1?

这是最简单的例子.

#py3
from tkinter import *
tk = Tk()
canvas = Canvas(tk, width= 500 , height = 400)
canvas.winfo_height()
#In [4]: canvas.winfo_height()
#Out[4]: 1
Run Code Online (Sandbox Code Playgroud)

python tkinter

5
推荐指数
2
解决办法
5418
查看次数

Python 2.7.9 Mac OS 10.10.3消息"setCanCycle:不推荐.请改用setCollectionBehavior"

这是我的第一条消息,我希望你能帮助我解决我的问题.

当我启动python脚本时,我有这样的消息:

2015-06-10 23:15:44.146 python [1044:19431] setCanCycle:不推荐使用.请改用setCollectionBehavior

2015-06-10 23:15:44.155 python [1044:19431] setCanCycle:不推荐使用.请改用setCollectionBehavior

在我的脚本下面:

from Tkinter import *

root = Tk()

root.geometry("450x600+10+10")
root.title("Booleanv1.0")

Cadre_1 = Frame(root, width=400, height=100)
Cadre_1.pack(side='top')

fileA = Label(Cadre_1, text="File A")
fileA.grid(row=0,column=0)
entA = Entry(Cadre_1, width=40)
entA.grid(row=0,column=1, pady=10)
open_fileA = Button(Cadre_1, text='SELECT', width=10, height=1, command = root.destroy)
open_fileA.grid(row=0, column=2)

fileB = Label(Cadre_1, text="File B")
fileB.grid(row=1,column=0)
entB = Entry(Cadre_1, width=40)
entB.grid(row=1,column=1, pady=10)
open_fileB = Button(Cadre_1, text='SELECT', width=10, height=1, command = root.destroy)
open_fileB.grid(row=1, column=2)


root.mainloop()
Run Code Online (Sandbox Code Playgroud)

谁能帮我解释这个消息?

我怎么能删除此消息?

PS:我使用Anaconda 3.10.0和Spyder IDE,但是当我用终端启动脚本时遇到同样的问题. …

python macos tkinter spyder anaconda

5
推荐指数
1
解决办法
5317
查看次数

viewflow.io:实现队列任务

我想用ViewFlow库实现以下用例:

问题

由用户启动的特定流程的进程必须在执行芹菜作业之前在队列中等待.每个用户都有这些进程的队列.根据计划或手动触发,允许队列中的下一个进程继续.

我的流中的节点进入命名队列.应用程序中的其他逻辑为每个队列确定何时允许下一个任务继续进行.选择队列中的下一个任务并调用其激活的done()方法.

示例流可能如下所示:

class MyFlow(Flow):

    start = flow.Start(...).Next(queue_wait)
    queue_wait = QueueWait("myQueue").Next(job)
    job = celery.Job(...).Next(end)
    end = flow.End()
Run Code Online (Sandbox Code Playgroud)

实施排队的最佳方法是什么?在上面的例子中,我不知道"QueueWait"应该是什么.

我已经阅读了文档和视图流代码,但是我还不清楚是否可以使用内置的Node和Activation类(如func.Function)来完成,或者如果我需要使用自定义类进行扩展.

python django workflow django-viewflow

5
推荐指数
1
解决办法
500
查看次数

Robotframework侦听器引发“无法访问执行上下文”错误

为了支持替代的日志记录格式,我开始开发自定义Robotframework Listener。使用指南中的示例,我已经能够复制简单的PythonListner示例。可以使用以下示例成功运行此示例:

python.exe -m robot.run --listener C:\temp\tiny.py -s Test02.Test C:\temp\Test02
Run Code Online (Sandbox Code Playgroud)

由listener类生成的文件包含已发生的不同事件,并且该功能按预期运行。

将以下行添加到__init__类的方法时:

BuiltIn().get_variable_value('${SUITE SOURCE}')
Run Code Online (Sandbox Code Playgroud)

收到以下响应:

 failed: Creating instance failed: RobotNotRunningError: Cannot access execution context
Traceback (most recent call last):
  File "C:\temp\tiny.py", line 9, in __init__
    print  repr(BuiltIn().get_variables())
  File "C:\Python27\lib\site-packages\robot\libraries\BuiltIn.py", line 940, in get_variables
    return utils.NormalizedDict(self._variables.current, ignore='_')
  File "C:\Python27\lib\site-packages\robot\libraries\BuiltIn.py", line 2669, in _variables
    return self._namespace.variables
  File "C:\Python27\lib\site-packages\robot\libraries\BuiltIn.py", line 2661, in _namespace
    return self._context.namespace
  File "C:\Python27\lib\site-packages\robot\libraries\BuiltIn.py", line 2656, in _context
    raise RobotNotRunningError('Cannot access execution context')
============================================================================== …
Run Code Online (Sandbox Code Playgroud)

robotframework

5
推荐指数
1
解决办法
2229
查看次数

Python Tkinter Canvas产生损坏的后记文件

我有一个Tkinter画布,上面有服务器矩形,文本和线对象。

我用

.postscript(file='file.ps') 
Run Code Online (Sandbox Code Playgroud)

画布的方法。

当我尝试在Windows和Linux上使用ghostscript打开文件时,出现以下错误:

error: undefinedresult in stringwidth
Run Code Online (Sandbox Code Playgroud)

您对此有什么解决方案?

谢谢!

编辑:我正在使用python2

python canvas tkinter postscript

5
推荐指数
1
解决办法
280
查看次数