1

私はPythonが初めてで、Linuxアプリケーションの自動化の開発を始めたばかりです。

私が試しているシナリオは

thread.py --- すべてのプライマリ デバイス スレッドを呼び出し、テストケースからテストをロードします

admincase.py --- ケースのテストを保留します..

私ができないのは、テストをロードするときに特定のオブジェクトを thread.py から admincase.py に渡したいということです。それ、どうやったら出来るの..

私が渡そうとしているオブジェクトは(EppQueue)です

thread.py コード

import threading
import sys
import time
import logging
import os
import Queue
from EPP import EPP
import ldtp
import ldtputils
from functions import functions
from admincases import 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 コード

import unittest
from functions import 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)

これについていくつかの助けが必要です...

4

0 に答える 0