def index():
    global _InitFwk, errorMsg, successMsg
    errorMsg = ""
    if request.method == 'GET':
        if _UiPortal.action_selectProject in request.args:
            _UiPortal.name_project = request.args[
                _UiPortal.action_selectProject]
            _InitFwk.ConfigParser.setMainConfigValue(
                _InitFwk.ConfigParser.SECTION_DEFAULTPROJECT,
                _InitFwk.ConfigParser.DEFAULT_PROJECT, _UiPortal.name_project)
            _InitFwk = InitFwk()
        elif _UiPortal.action_createPageObjects in request.args:
            createPageObjects.create()
            successMsg = "1. The Page Objects of <strong>%s</strong> are created successfully.</br>" % _InitFwk.name_project
        elif _UiPortal.action_createTestData in request.args:
            createTestDataStrings.create()
            successMsg = "1. The Test Data Objects of <strong>%s</strong> are created successfully.</br>" % _InitFwk.name_project
    elif request.method == 'POST':
        newProjectName = request.form[_UiPortal.EDIT_NEWPROJECT].strip()
        if newProjectName != "" and newProjectName is not None:
            testType = request.form[_UiPortal.RADIOBUTTON_TESTTYPE]
            _NewProjectCreator = NewProjectCreator(newProjectName, testType)
            _InitFwk = _NewProjectCreator.create()
            successMsg = "1. The Project <strong>%s</strong> is created successfully.</br>" % _InitFwk.name_project + \
                         "2. Please fill out <strong>%s</strong>.</br>" % os.path.join( _InitFwk.path_folder_data, "android or web or ios", "runTime.conf") + \
                         "3. Please fill out <strong>%s</strong> and then click <strong>Create Page Objects</strong> to create page objects.</br>" % os.path.join( _InitFwk.path_folder_data, "android or web or ios", "uiMaps", "uiMap.py") + \
                         "4. Please write Test Suite(cases) in <strong>%s</strong>.</br>" % os.path.join(_InitFwk.path_folder_cases, _InitFwk.name_project + ".py") + \
                         "5. Please add the names of Test cases that you want to test from the Test Suite to <strong>%s</strong>.</br>" % os.path.join(_InitFwk.path_folder_AutoTestPass, "(start_)" + _InitFwk.name_project + ".py")
        else:
            errorMsg = "<strong>New Project Name:</strong> cannot be empty!"
        _InitFwk = InitFwk()
    return render_template('index.html',
                           _InitFwk=_InitFwk,
                           errorMsg=errorMsg,
                           successMsg=successMsg)
def create():
    # project is defined in env>main.conf>[DefaultProject].
    _InitFwk = InitFwk()
    _TestDataStringsCreator = TestDataStringsCreator(_InitFwk.path_file_xlsx_testData_android, _InitFwk.path_folder_testData)
    _TestDataStringsCreator.create()
    _TestDataStringsCreator = TestDataStringsCreator(_InitFwk.path_file_xlsx_testData_ios, _InitFwk.path_folder_testData)
    _TestDataStringsCreator.create()
    _TestDataStringsCreator = TestDataStringsCreator(_InitFwk.path_file_xlsx_testData_web, _InitFwk.path_folder_testData)
    _TestDataStringsCreator.create()
Exemple #3
0
def create():
    # project is defined in env>main.conf>[DefaultProject].
    _InitFwk = InitFwk()
    _POCreator = POCreator(_InitFwk.path_file_xml_uiMap_android,
                           _InitFwk.path_folder_po)
    _POCreator.create()
    _POCreator = POCreator(_InitFwk.path_file_xml_uiMap_web,
                           _InitFwk.path_folder_po)
    _POCreator.create()
    _POCreator = POCreator(_InitFwk.path_file_xml_uiMap_ios,
                           _InitFwk.path_folder_po)
    _POCreator.create()
Exemple #4
0
    def setUpBeforClass(cls):
        '''
        cls.UI and cls.Pages are default test objects, if only one of Ios, Android and Web needs to be tested.
        It is just fine to just use them.
        '''
        cls.UI = None
        cls.UI_Ios = None
        cls.UI_Android = None
        cls.UI_Web = None
        cls.Pages_Android = None
        cls.Pages = None
        cls.Pages_Ios = None
        cls.Pages_Web = None
        cls.TestData_Android = None

        try:
            cls.InitFwk = InitFwk()
            cls.InitFwk.createResultFolder()
            # cls.InitFwk = InitFwk(GlobalArgs.getProjectName(), GlobalArgs.getProjectPath())
            if cls.InitFwk.TestType.ANDROID.lower() == cls.InitFwk.testType.lower():
                cls.UI_Android = AndroidFwk(cls.InitFwk)
                # cls.Pages_Android = Pages_Android(cls.UI_Android)
                cls.UI = cls.UI_Android
                # cls.Pages = cls.Pages_Android
            elif cls.InitFwk.TestType.IOS.lower() == cls.InitFwk.testType.lower():
                cls.UI_Ios = IosFwk(cls.InitFwk)
                # cls.Pages_Ios = Pages_Ios(cls.UI_Ios)
                cls.UI = cls.UI_Ios
                # cls.Pages = cls.Pages_Ios
            elif cls.InitFwk.TestType.WEB.lower() == cls.InitFwk.testType.lower():
                cls.UI_Web = WebFwk(cls.InitFwk)
                # cls.Pages_Web = Pages_Web(cls.UI_Web)
                cls.UI = cls.UI_Web
                # cls.Pages = cls.Pages_Web
            cls.Result = Result(cls.UI, cls.InitFwk, cls.__name__)  # avoid errors when the next step failed.
            cls.UI.getDriver()
            if cls.UI_Android is None:
                cls.UI_Android = AndroidFwk(cls.InitFwk)
            if cls.UI_Ios is None:
                cls.UI_Ios = IosFwk(cls.InitFwk)
            if cls.UI_Web is None:
                cls.UI_Web = WebFwk(cls.InitFwk)
            cls.Result = Result(cls.UI, cls.InitFwk, cls.__name__)
            cls.Result.beforeClass()
        except Exception as e:
            # traceback.print_exc()
            cls.UI.logger.error(traceback.format_exc())
            cls.Result.setEnvBlockMsg(e.__str__())
            try:
                if cls.UI_Ios.hasGotDriver is True:
                    cls.UI_Ios.quit()
            except:
                pass
            try:
                if cls.UI_Android.hasGotDriver is True:
                    cls.UI_Android.quit()
            except:
                pass
            try:
                if cls.UI_Web.hasGotDriver is True:
                    cls.UI_Web.quit()
            except:
                pass
            cls.UI.logger.error(e.__str__())
    # suite.addTest(TestBrowser("test_flow"))
    suite.addTest(TestBrowser1("test_flow"))
    test_result = unittest.TextTestRunner(verbosity=2).run(suite)

def mutipleThread2():
    suite = unittest.TestSuite()
    # suite.addTest(TestBrowser("test_flow"))
    suite.addTest(TestBrowser1("test_flow"))
    test_result = unittest.TextTestRunner(verbosity=2).run(suite)

if __name__ == '__main__':

   # "耗材购买".decode("utf-8")

    suite = unittest.TestSuite()
    initFwk = InitFwk()
    if initFwk.name_project == "PrinterControl":
        from projects.PrinterControl.cases.HomeMoreAbout import HomeMoreAbout
        # listTestSuits = ["test_flow"
        #                  # ,
        #                  # "test_aioVersion",
        #                  # "test_copyRight",
        #                  # "test_legalInformaion",
        #                  # "test_endUserLicenseAgreement",
        #                  # "test_endUserLicenseAgreement_back",
        #                  # "test_hpOnlinePrivacyStatement",
        #                  # "test_hpOnlinePrivacyStatement_back",
        #                  # "test_shareThisApp",
        #                  # "test_shareThisApp_back",
        #                  # "test_headerDisplay"
        #                  ]
Exemple #6
0
 def __init__(self, name_project=None, testType=None):
     self.InitFwk = InitFwk(name_project.strip())
     self.InitFwk.testType = testType.strip().lower()