def setUp(self): self.app = create_app() self.w_without_scoping = TestApp(self.app) self.w = TestApp(self.app, db=db, use_session_scopes=True) self.app_context = self.app.app_context() self.app_context.push() db.drop_all() db.create_all()
def test_2_install(self): apk_file = commands.getstatusoutput("ls %s| grep %s" % (app_dir, app_name))[1] if apk_file.endswith(".apk"): global testapp testapp = TestApp(comm.device, app_dir + apk_file, package_name, active_name) if testapp.isInstalled(): testapp.uninstall() self.assertTrue(testapp.install()) else: print("-->> No packed %s apk in %s" % (app_name, app_dir)) self.assertTrue(False)
def test_2_install(self): # Workaround for XWALK-6016: Build x86 and arm together, add arch filter apk_file = commands.getstatusoutput("ls %s| grep %s| grep %s" % (comm.build_app_dest, app_name.lower(), comm.ARCH))[1] if apk_file.endswith(".apk"): global testapp testapp = TestApp(comm.device, comm.build_app_dest + apk_file, package_name, active_name) if testapp.isInstalled(): testapp.uninstall() self.assertTrue(testapp.install()) else: print("-->> No packed %s apk in %s" % (app_name, comm.build_app_dest)) self.assertTrue(False)
def test_app_repeatedly_in_lowmemory(self): setUp() testapp = TestApp(device, ConstPath + "/../testapp/lowresourcetest.apk", "org.xwalk.lowresourcetest", "LowresourcetestActivity") if testapp.isInstalled(): testapp.uninstall() for i in range(20): self.assertTrue(testapp.install()); self.assertTrue(testapp.launch()); time.sleep(1) # swtich to background self.assertTrue(testapp.switch()); time.sleep(1) # swtich to front self.assertTrue(testapp.switch()); time.sleep(1) self.assertTrue(testapp.stop()); self.assertTrue(testapp.uninstall());
def test_2_install(self): apk_file = commands.getstatusoutput("ls %s| grep %s" % (comm.build_app_dest, app_name.lower()))[1] if apk_file.endswith(".apk"): global testapp testapp = TestApp(comm.device, comm.build_app_dest + apk_file, package_name, active_name) if testapp.isInstalled(): testapp.uninstall() self.assertTrue(testapp.install()) else: print("-->> No packed %s apk in %s" % (app_name, comm.build_app_dest)) self.assertTrue(False)
def test_swith_between_nativeandwebapp(self): setUp() testapp = TestApp(device, ConstPath + "/../iterative.apk", "org.xwalk.iterative", "IterativeActivity") try: if not testapp.isInstalled(): testapp.install() testapp.launch() # Pause and Resume 50 times for i in range(50): time.sleep(2) # swtich to native home app self.switchToHomeapp() self.assertFalse(testapp.isActivity()) time.sleep(2) # swtich back self.assertTrue(testapp.switch()) testapp.stop() except Exception as e: print "Error: %s" % e testapp.stop() self.assertTrue(False)
def test_app_repeatedly_in_lowdisk(self): setUp() if makeLowDisk(): testapp = TestApp(device, ConstPath + "/../testapp/lowresourcetest.apk", "org.xwalk.lowresourcetest", "LowresourcetestActivity") if testapp.isInstalled(): testapp.uninstall() for i in range(20): if testapp.install() and testapp.launch(): switchresult = False for i in range(2): time.sleep(1) # swtich app switchresult = testapp.switch() if switchresult: time.sleep(1) if testapp.stop() and testapp.uninstall(): time.sleep(1) else: testapp.uninstall() cleanWork() self.assertTrue(False) else: testapp.uninstall() cleanWork() self.assertTrue(False) else: testapp.uninstall() cleanWork() self.assertTrue(False) testapp.uninstall() cleanWork() self.assertTrue(True) else: print "-->> Test envrionment fail to set up" cleanWork() self.assertTrue(False)
def Activated(self): TestApp.TestGui("Menu.MenuCreateCases")
def makeLowDisk(): cleanWork() action_status = False if not os.path.exists(approot): cmd = "mkdir %s" % approot (return_code, output) = doCMD(cmd) vediofile = appsrc + "/video.3gp" vediosize = getFileSize(vediofile) if vediosize <= 0: print "-->> Lack pre-condition resource files" return False tmpreadystate = [False, False, False] global instaled_app_list while not action_status: freesize = getFreeDiskSize(device) if (freesize >= 1024) and not tmpreadystate[0]: # make app size: 500M count = int((500 - vediosize) / vediosize) for i in range(count): cmd = "cp %s %s " % (vediofile, appsrc + "/video" + str(i) + ".temp.3gp") (return_code, output) = doCMD(cmd) tmpreadystate[0] = True elif (freesize >= 512) and (freesize < 1024) and not tmpreadystate[1]: # clean appsrc if tmpreadystate[0]: cmd = "rm -rf %s/*.temp.3gp" % (appsrc) (return_code, output) = doCMD(cmd) (return_code, output) = doCMD(cmd) # make app size: 100M count = int((100 - vediosize) / vediosize) for i in range(count): cmd = "cp %s %s " % (vediofile, appsrc + "/video" + str(i) + ".temp.3gp") (return_code, output) = doCMD(cmd) tmpreadystate[1] = True elif (freesize < 512) and not tmpreadystate[2]: # clean appsrc cmd = "rm -rf %s/*.temp.3gp" % (appsrc) (return_code, output) = doCMD(cmd) tmpreadystate[2] = True appname = "helloworld%s" % int(time.time()) if createAPK(appname): apkname = appname[0].upper() + appname[1:] apkpath = approot + "/" + appname + ".apk" testapp = TestApp(device, apkpath, "org.xwalk." + appname, apkname + "Activity") #If app exists, go to next if not testapp.isInstalled(): #if app is not installed successful, delete the package, return True if not testapp.install(): action_status = True deleteAPK(testapp) # tmpreadystate[2] == True, # means free disk is too small to install test app # need to uninstall the last one to keep more free disk if len(instaled_app_list) > 0 and tmpreadystate[2]: testapp = instaled_app_list.pop(-1) testapp.uninstall() deleteAPK(testapp) else: instaled_app_list.append(testapp) else: break return action_status
def test_pause_resume_webapp_repeatedly(self): setUp() testapp = TestApp(device, ConstPath + "/../iterative.apk", "org.xwalk.iterative", "IterativeActivity") try: if not testapp.isInstalled(): testapp.install() testapp.launch() # Pause and Resume 50 times for i in range(50): time.sleep(2) # swtich to back self.assertTrue(testapp.switch()) time.sleep(2) # swtich to front self.assertTrue(testapp.switch()) testapp.stop() except Exception as e: print "Error: %s" % e testapp.stop() self.assertTrue(False)
dao_library_for_tests = DaoLibrary( config.get_database_host(), config.get_database_port(), config.get_database_name(), ) service_library_for_tests = ServiceLibrary(dao_library_for_tests, context_dir, config) user_service = service_library_for_tests.user_service handlers_library_for_tests = HandlersLibrary(service_library_for_tests) def clean_db(): dao_library_for_tests.db.command("dropDatabase") app = TestApp.make_app(handlers_library_for_tests) class TestUsersHandlersBase(AsyncHTTPTestCase): def setUp(self): clean_db() super(TestUsersHandlersBase, self).setUp() def get_app(self): return app class TestUserHandlers(TestUsersHandlersBase): def test_register_correct_handler(self): post_args = {"name": "name", "password": "******"} response = self.fetch("/user/register",
def test_app_repeatedly_in_lowbattery(self): setUp() testapp = TestApp(device, ConstPath + "/../testapp/lowresourcetest.apk", "org.xwalk.lowresourcetest", "LowresourcetestActivity") if testapp.isInstalled(): testapp.uninstall() for i in range(20): if testapp.install() and testapp.launch(): switchresult = False for i in range(2): time.sleep(1) # swtich app switchresult = testapp.switch() if switchresult: time.sleep(1) if testapp.stop() and testapp.uninstall(): time.sleep(1) else: testapp.uninstall() self.assertTrue(False) else: testapp.uninstall() self.assertTrue(False) else: testapp.uninstall() self.assertTrue(False) testapp.uninstall() self.assertTrue(True)
def Activated(self): TestApp.TestText("TestApp.All")
def Activated(self): TestApp.TestGui("Base")
def Activated(self): TestApp.TestGui("Document")
def Activated(self): TestApp.TestGui("TestApp.All")
#* This file is part of the FreeCAD CAx development system. * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * #* as published by the Free Software Foundation; either version 2 of * #* the License, or (at your option) any later version. * #* for detail see the LICENCE text file. * #* * #* FreeCAD is distributed in the hope that it will be useful, * #* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* GNU Lesser General Public License for more details. * #* * #* You should have received a copy of the GNU Library General Public * #* License along with FreeCAD; if not, write to the Free Software * #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* USA * #* * #* Juergen Riegel 2002 * #***************************************************************************/ Log("FreeCAD test running...\n\n") import TestApp, sys testResult = TestApp.TestText("TestApp.All") Log("FreeCAD test done\n") sys.exit(0 if testResult.wasSuccessful() else 1)
#* This file is part of the FreeCAD CAx development system. * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * #* as published by the Free Software Foundation; either version 2 of * #* the License, or (at your option) any later version. * #* for detail see the LICENCE text file. * #* * #* FreeCAD is distributed in the hope that it will be useful, * #* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* GNU Lesser General Public License for more details. * #* * #* You should have received a copy of the GNU Library General Public * #* License along with FreeCAD; if not, write to the Free Software * #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* USA * #* * #* Juergen Riegel 2002 * #***************************************************************************/ Log ("FreeCAD test running...\n\n") import TestApp;TestApp.TestText("TestApp.All") Log ("FreeCAD test done\n")
#* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * #* as published by the Free Software Foundation; either version 2 of * #* the License, or (at your option) any later version. * #* for detail see the LICENCE text file. * #* * #* FreeCAD is distributed in the hope that it will be useful, * #* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* GNU Lesser General Public License for more details. * #* * #* You should have received a copy of the GNU Library General Public * #* License along with FreeCAD; if not, write to the Free Software * #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* USA * #* * #* Juergen Riegel 2002 * #***************************************************************************/ Log("FreeCAD test running...\n\n") import TestApp, sys testCase = FreeCAD.ConfigGet("TestCase") testResult = TestApp.TestText(testCase) Log("FreeCAD test done\n") sys.exit(0 if testResult.wasSuccessful() else 1)
def Activated(self): TestApp.TestText("Document")
def Activated(self): TestApp.TestText("Menu.MenuDeleteCases")
def makeLowDisk(): cleanWork() action_status = False if not os.path.exists(approot): cmd = "mkdir %s" % approot (return_code, output) = doCMD(cmd) vediofile = appsrc + "/video.3gp" vediosize = getFileSize(vediofile) if vediosize <= 0: print "-->> Lack pre-condition resource files" return False tmpreadystate = [False, False, False] global instaled_app_list while not action_status: freesize = getFreeDiskSize(device) if (freesize >= 1024) and not tmpreadystate[0]: # make app size: 500M count = int((500 - vediosize)/vediosize) for i in range(count): cmd = "cp %s %s " % (vediofile, appsrc + "/video" + str(i) +".temp.3gp") (return_code, output) = doCMD(cmd) tmpreadystate[0] = True elif (freesize >= 512) and (freesize < 1024) and not tmpreadystate[1]: # clean appsrc if tmpreadystate[0]: cmd = "rm -rf %s/*.temp.3gp" % (appsrc) (return_code, output) = doCMD(cmd) (return_code, output) = doCMD(cmd) # make app size: 100M count = int((100 - vediosize)/vediosize) for i in range(count): cmd = "cp %s %s " % (vediofile, appsrc + "/video" + str(i) +".temp.3gp") (return_code, output) = doCMD(cmd) tmpreadystate[1] = True elif (freesize < 512) and not tmpreadystate[2]: # clean appsrc cmd = "rm -rf %s/*.temp.3gp" % (appsrc) (return_code, output) = doCMD(cmd) tmpreadystate[2] = True appname = "helloworld%s" % int(time.time()) if createAPK(appname): apkname = appname[0].upper() + appname[1:] apkpath = approot + "/" + apkname + "_" + device_abi + ".apk" testapp = TestApp(device, apkpath, "org.xwalk." + appname, apkname + "Activity") #If app exists, go to next if not testapp.isInstalled(): #if app is not installed successful, delete the package, return True if not testapp.install(): action_status = True deleteAPK(testapp) # tmpreadystate[2] == True, # means free disk is too small to install test app # need to uninstall the last one to keep more free disk if len(instaled_app_list) > 0 and tmpreadystate[2]: testapp = instaled_app_list.pop(-1) testapp.uninstall() deleteAPK(testapp) else: instaled_app_list.append(testapp) else: break return action_status
from threading import Thread from util import coms_client import TestApp import io #global variables that will be used to communicate between the coms_thread and the joy_thread and the UI_thread #code for UI #code for #creation of threads and classes # coms thread coms_thread = Thread(target=coms_client.run_client()) io_thread = Thread(target=io.update_joystick()) # the class for the GUI gui = TestApp() io_thread.start() coms_thread.start() gui.run()
#*************************************************************************** #* (c) Jürgen Riegel ([email protected]) 2002 * #* * #* This file is part of the FreeCAD CAx development system. * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * #* as published by the Free Software Foundation; either version 2 of * #* the License, or (at your option) any later version. * #* for detail see the LICENCE text file. * #* * #* FreeCAD is distributed in the hope that it will be useful, * #* but WITHOUT ANY WARRANTY; without even the implied warranty of * #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * #* GNU Lesser General Public License for more details. * #* * #* You should have received a copy of the GNU Library General Public * #* License along with FreeCAD; if not, write to the Free Software * #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * #* USA * #* * #* Juergen Riegel 2002 * #***************************************************************************/ Log("FreeCAD test running...\n\n") import TestApp TestApp.TestText("TestApp.All") Log("FreeCAD test done\n")
def test_swith_between_webapps(self): setUp() testapp = TestApp(device, ConstPath + "/../iterative.apk", "org.xwalk.iterative", "IterativeActivity") switchapp = TestApp(device, ConstPath + "/../switchapp.apk", "org.xwalk.switchapp", "SwitchappActivity") try: if not testapp.isInstalled(): testapp.install() if not switchapp.isInstalled(): switchapp.install() testapp.launch() # Pause and Resume 50 times for i in range(50): time.sleep(2) # swtich to other webapp self.assertTrue(testapp.switchTo(switchapp)) time.sleep(2) # swtich back self.assertTrue(testapp.switch()) testapp.stop() switchapp.stop() except Exception as e: print "Error: %s" % e testapp.stop() switchapp.stop() self.assertTrue(False)
def Activated(self): TestApp.TestText("BaseTests")
import TestApp import coral import os try: #Set the authentication path if (not os.getenv("CORAL_AUTH_PATH")): os.putenv("CORAL_AUTH_PATH", "/afs/cern.ch/sw/lcg/app/pool/db") app = TestApp.TestApp("oracle://lcg_coral_nightly/lcg_coral_nightly", "oracle://lcg_coral_nightly/lcg_coral_nightly", "lcg_coral_nightly") app.run() print "Overall SUCCESS" except Exception, e: print "Overall FAILURE" print str(e)
def test_app_repeatedly_in_lowmemory(self): setUp() testapp = TestApp(device, ConstPath + "/../testapp/lowresourcetest.apk", "org.xwalk.lowresourcetest", "LowresourcetestActivity") if testapp.isInstalled(): testapp.uninstall() for i in range(20): self.assertTrue(testapp.install()) self.assertTrue(testapp.launch()) time.sleep(1) # swtich to background self.assertTrue(testapp.switch()) time.sleep(1) # swtich to front self.assertTrue(testapp.switch()) time.sleep(1) self.assertTrue(testapp.stop()) self.assertTrue(testapp.uninstall())