i am new to python and just now started developing an linux application automation.

scenario i am trying is

thread.py --- will invoke all primary device threads and load test from testcase

admincase.py --- hold my tests for the case..

what i am unable to do is i want to pass certain objects from thread.py to admincase.py when loading the test. how do i do that..

object which i am tryin to pass is (*EppQueue*)

thread.py code

|import  threading
import  sys
import  time
import  logging
import  os
import  Queue
from  EPPimport  EPP
import  ldtp
import  ldtputils
from  functionsimport  functions
from  admincasesimport  admincases
import  unittest

#logging.basicConfig(level=logging.DEBUG,
#                    format='(%(threadName)-10s) %(message)s',
#                    )
class  inittest(unittest.TestCase):
    global  fun
    global  EppQueue
    global  window_name

    def  cleanup(epp_port):
        if  os.path.exists(epp_port):
            os.unlink(epp_port)

    def  start_threads(EppQueue,server_ip,epp_port):
        epp=  EPP
        EPP1=  threading.Thread(name='EPP',  target=epp,  
args=(server_ip,54321,epp_port,EppQueue,))
        EPP1.setDaemon(True)
        EPP1.start()
        return  epp
    fun=  functions()
    EppQueue  =  Queue.Queue(1)
    server_ip='192.168.10.125'
    epp_port='/dev/ttyS17'
    print  "Starting"
    cleanup(epp_port)
    print  "Clean up Over"
    epp=  start_threads(EppQueue,server_ip,epp_port)
    raw_input("###### Please Start the main appilcation in the ATM and hit a KEY to 
continue ############")
    check=  0
    while  check==  0:
        window_name=  fun.start_up_verify('atm_main_app')
        if  any(window_name):
            check=  1
        else:
            check=  0
    if  not  any(window_name):
        print  "Please start the application and run the test"
        sys.exit(0)
    else:
        print  window_name
        print  "SYSTEM IS READY TO PERFORM TEST"
        raw_input("###### HIT ANY KEY TO START UNIT TEST ############")
raw_input("kkk") test= unittest.defaultTestLoader.loadTestsFromName("admincases")
        unittest.TextTestRunner(verbosity=2).run(test)
    raw_input("keyy")
    print  "final"
|

admincase.py code

|import  unittest
from  functionsimport  functions
import  time
import  Queue

class  admincases(unittest.TestCase):
    global  fun
    global  EppQueue
    global  window_name

    def  test_case_1(self):
        print  "test case 1"
        window_name=  'frmatm_main_app'
        fun.send_queue(self.EppQueue,"send_keys,&&&&&")
        fun.verify_screen(window_name,"ico0")
        fun.send_queue(self.EppQueue,"send_keys,C")
        fun.verify_screen(window_name,"ManagementFunctions")
        fun.send_queue(self.EppQueue,"send_keys,001234")
        fun.verify_screen(window_name,"MainMenu")
        fun.send_queue(self.EppQueue,"send_keys,1")
        fun.verify_screen(window_name,"Diagnostics")
        fun.send_queue(self.EppQueue,"send_keys,1")
        fun.verify_screen(window_name,"TerminalStatus")
        fun.send_queue(self.EppQueue,"send_keys,2")
        time.sleep(10)
        fun.send_queue(self.EppQueue,"send_keys,####****")


    fun=  functions()
    #EppQueue = Queue.Queue(1)
|

Need some assistance on this...

--
Regards
Venkat.S

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to