如何在python-> sikuli中调用另一个类的函数?

时间:2016-01-20 05:29:16

标签: python sikuli sikuli-script sikuli-ide

如何访问channel2中channel1的方法,以便首先执行test_script1,test_script2,然后执行test_script3,test_script4。

注意: - 主要问题是我正在执行 suite1 = unittest.TestLoader()。loadTestsFromTestCase(channel1)和 suite2 = unittest.TestLoader()。loadTestsFromTestCase(channel2),我得到两个reprort表。

但我希望它们合并在一个包含channel1和channel2类数据的表中。

from sikuli import *
import unittest
import HTMLTestRunner

class channel1(unittest.TestCase):
    def test_script1(self):
        assert exists("1453186120180.png")
    def test_script2(self):
         assert exists("1453186901719.png")

class channel2(unittest.TestCase):
    def test_script3(self):
        assert exists("1453186120180.png")
    def test_script4(self):
         assert exists("1453186901719.png")
    #channel2().test_script1()
#suite1 = unittest.TestLoader().loadTestsFromTestCase(_main_channel.channel1)
#ch1=channel1.test_script1()
#ch2=channel1.test_script2()
suite2= unittest.TestLoader().loadTestsFromTestCase(channel2)
#suite2 = unittest.TestLoader().loadTestsFromTestCase(obj2)
outfile = open("D:\\report.html", "wb") # path to report folder

#runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title=' Report Title', description='desc..' ).run(suite1)
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title=' Report Title', description='desc..' ).run(suite1)
#runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title=' Report Title', description='desc..' ).run(suite2)
#runner.run(suite2)

请帮助..

0 个答案:

没有答案