![](/img/trans.png)
[英]How to start python unit tests from command line with Sikuli 1.0.1
[英]How to integrate sikuli with python unit tests?
我是西庫里的新手。 我想在我的python(2.7版)單元測試(實際上是硒webdriver測試)中添加sikuli功能(能夠檢查網頁上是否顯示了特定圖像)。 有什么建議怎么做? 我嘗試安裝https://github.com/kevlened/sikuli_cpython
但出現錯誤(因為它可能需要Cython)。
在此處查看unnittest教程。 在任何測試方法中,您都可以編寫sikuli / selenium代碼。 這是一個例子。
import unittest, os
from xmlrunner import *
from sikuli import *
# unittest class
class Test_thing1(unittest.TestCase):
def setUp(self):
"""do initialisation here may be sikuli code"""
def testfunction1(self):
val=exists('windows_start_Btn.png')#this is sikuli
self.assertFalse(val, msg="your are not on Windows")
def tearDown(self):
""" do this at the end of the test may be sikuli code"""
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(Test_Thing1) #give the class name
result = XMLTestRunner(file("unittest.xml", "w")).run(suite)
print result.errors
outFile.close()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.