← Back to team overview

sikuli-driver team mailing list archive

[Question #281215]: How to call a function from another class

 

New question #281215 on Sikuli:
https://answers.launchpad.net/sikuli/+question/281215

Hi

How can i access methods of channel1 in channel2 so that test_script1,test_script2 is execute first and then test_script3,test_script4.

Note:- The main issue is when i am executing suite1= unittest.TestLoader().loadTestsFromTestCase(channel1) and suite2= unittest.TestLoader().loadTestsFromTestCase(channel2), i am getting two reprort tables.

But instead i want them to merge in one table consisting data of channel1 and channel2 both.

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)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.