Browse Source

Lots of Package-Imports corrected

bernhardbuhl 4 years ago
parent
commit
27175b4db7

+ 1 - 0
MakePackage.sh

@@ -1,3 +1,4 @@
 python3 setup.py sdist bdist_wheel
 python3 -m pip install --user --upgrade twine
 python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
+rm -R build/

+ 5 - 3
README.md

@@ -2,8 +2,10 @@
 This is the current release of baangt - the tool for "Basic And Advanced Next Generation Testing".
 
 ## Installation in a virtual environment:
-``pip-env``
-and
 ``pip install baangt``
 
-Please see latest news on http://baangt.org and for commercial customers http://baangt.com
+#Usage:
+
+
+#Further reading:
+Please see latest news on http://baangt.org for community edition and http://baangt.com for corporate environments

+ 41 - 0
baangt.py

@@ -0,0 +1,41 @@
+import getopt
+import sys
+from baangt.base.TestRun import TestRun
+from baangt.base.TestRunFromExcel import TestRunFromExcel
+
+
+def args_read(l_search_parameter):
+    l_args = sys.argv[1:]
+
+    try:
+        opts, args = getopt.getopt(l_args, "", ["testrun=",
+                                                "testrunfile=",
+                                                "configfile=",
+                                                ""
+                                                ])
+    except getopt.GetoptError as err_det:
+        print("Error in reading parameters:" + str(err_det))
+        print_args()
+        sys.exit("Abgebrochen wegen Fehler in Aufrufparametern")
+    if opts:
+        for opt, arg in opts:
+            if l_search_parameter == opt:  # in ("-u", "--usage"):
+                return arg
+    return None
+
+
+def print_args():
+    print("""
+Call: python baangt.py --parameters 
+       --testrun=<Existing, predefined Name of a TestRun (database or name defined inside a TestRunClass>
+       --testrunfile=<XLSX-File containing Testrun Definition>
+       --configfile=<Filename and path to a configuration file, that holds all necessary data>
+
+ Suggested for standard use:
+   python baangt.py --testrun="Franzi4711": Will run a Testrun Franzi4711 that is known in the database
+   python baangt.py --configfile="runProd.json": Will execute a Testrun as specified in runProd.json 
+   """)
+
+
+print_args()
+

+ 3 - 3
TestCase/TestCaseMaster.py

@@ -1,6 +1,6 @@
-from baangt import GlobalConstants as GC
-from baangt.Timing import Timing
-from TestSteps.Exceptions import *
+from baangt.base import GlobalConstants as GC
+from baangt.base.Timing import Timing
+from baangt.TestSteps.Exceptions import *
 
 class TestCaseMaster:
     def __init__(self, **kwargs):

TestSteps/__init__.py → baangt/TestCase/__init__.py


+ 4 - 5
TestCaseSequence/TestCaseSequenceMaster.py

@@ -1,8 +1,7 @@
-from baangt.HandleDatabase import HandleDatabase
-from TestCaseSequence.TestCaseSequenceParallel import TestCaseSequenceParallel
-from baangt.Timing import Timing
-import baangt.GlobalConstants as GC
-import baangt.CustGlobalConstants as CGC
+from baangt.base.HandleDatabase import HandleDatabase
+from baangt.TestCaseSequence.TestCaseSequenceParallel import TestCaseSequenceParallel
+from baangt.base.Timing import Timing
+import baangt.base.GlobalConstants as GC
 import multiprocessing
 import logging
 

+ 2 - 2
TestCaseSequence/TestCaseSequenceParallel.py

@@ -1,7 +1,7 @@
 import multiprocessing
 import logging
-from TestSteps import Exceptions
-from baangt import GlobalConstants as GC
+from baangt.TestSteps import Exceptions
+from baangt.base import GlobalConstants as GC
 
 logger = logging.getLogger("pyC")
 

TestCaseSequence/__init__.py → baangt/TestCaseSequence/__init__.py


+ 22 - 0
baangt/TestSteps/DropsApp/Login_API.py

@@ -0,0 +1,22 @@
+from baangt.base.ApiHandling import ApiHandling
+from TestSteps.CustTestStepMaster import CustTestStepMaster
+import baangt.base.GlobalConstants as GC
+
+
+class Login_API(CustTestStepMaster):
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+        self.execute()
+
+    def execute(self):
+        lUrl = self.testcaseDataDict["baseURL"]
+        session : ApiHandling = self.apiSession
+        content = {"username": self.testcaseDataDict["Username"],
+                   "password": self.testcaseDataDict["Password"]}
+        resultStatus, resultDict, resultHeader = session.postURL(url=lUrl, content=content)
+
+        self.testcaseDataDict["resultStatus"] = resultStatus
+        self.testcaseDataDict["resultDict"] = resultDict
+        self.testcaseDataDict["resultHeader"] = resultHeader
+
+        self.testcaseDataDict[GC.TESTCASESTATUS] = session.returnTestCaseStatus(resultStatus)

TestCase/__init__.py → baangt/TestSteps/DropsApp/__init__.py


TestSteps/Exceptions.py → baangt/TestSteps/Exceptions.py


+ 3 - 3
TestSteps/TestStepMaster.py

@@ -1,6 +1,6 @@
-import baangt.GlobalConstants as GC
-from baangt.Timing import Timing
-from baangt.BrowserHandling import BrowserDriver
+import baangt.base.GlobalConstants as GC
+from baangt.base.Timing import Timing
+from baangt.base.BrowserHandling import BrowserDriver
 import sys
 
 

+ 0 - 0
baangt/TestSteps/__init__.py


+ 2 - 2
baangt/ApiHandling.py

@@ -1,6 +1,6 @@
 import requests
-from . import GlobalConstants as GC
-from TestSteps import Exceptions
+from baangt.base import GlobalConstants as GC
+from baangt.TestSteps import Exceptions
 import logging
 
 logger = logging.getLogger("pyC")

+ 4 - 4
baangt/BrowserHandling.py

@@ -7,9 +7,9 @@ from selenium.webdriver.chrome.options import Options as ChromeOptions
 from selenium.webdriver.firefox.options import Options as ffOptions
 from selenium.common.exceptions import *
 from selenium.webdriver.common import keys
-from baangt import GlobalConstants as GC
-from baangt.Timing import Timing
-from TestSteps import Exceptions
+from baangt.base import GlobalConstants as GC
+from baangt.base.Timing import Timing
+from baangt.TestSteps import Exceptions
 import time
 import logging
 
@@ -74,7 +74,7 @@ class BrowserDriver:
         if not isinstance(desiredCapabilities, dict):
             return None
 
-        if desiredCapabilities.get(GC.BROWSER_MODE_HEADLESS) == True:
+        if desiredCapabilities.get(GC.BROWSER_MODE_HEADLESS):
             lOptions.headless = True
 
         return lOptions

baangt/CustGlobalConstants.py → baangt/base/CustGlobalConstants.py


+ 2 - 3
baangt/ExportResults.py

@@ -1,9 +1,8 @@
 import xlsxwriter
 import logging
 import json
-import baangt.CustGlobalConstants as CGC
-import baangt.GlobalConstants as GC
-from baangt.utils import utils
+import baangt.base.GlobalConstants as GC
+from baangt.base.utils import utils
 
 logger = logging.getLogger("pyC")
 

baangt/GlobalConstants.py → baangt/base/GlobalConstants.py


+ 2 - 2
baangt/HandleDatabase.py

@@ -1,8 +1,8 @@
 import logging
 import pandas as pd
 import json
-import baangt.CustGlobalConstants as CGC
-import baangt.GlobalConstants as GC
+import baangt.base.CustGlobalConstants as CGC
+import baangt.base.GlobalConstants as GC
 
 logger = logging.getLogger("pyC")
 

+ 6 - 6
baangt/TestRun.py

@@ -1,8 +1,8 @@
-from baangt.BrowserHandling import BrowserDriver
-from baangt.ApiHandling import ApiHandling
-from baangt.ExportResults import ExportResults
-from baangt.Timing import Timing
-from baangt import GlobalConstants as GC
+from baangt.base.BrowserHandling import BrowserDriver
+from baangt.base.ApiHandling import ApiHandling
+from baangt.base.ExportResults import ExportResults
+from baangt.base.Timing import Timing
+from baangt.base import GlobalConstants as GC
 import logging
 import sys
 
@@ -128,7 +128,7 @@ class TestRun:
         logger.debug(f"Imported module {fullQualifiedImportName}, result was {str(mod)}")
         retClass = getattr(mod, importClass)
         if not retClass:
-            logger.critical(f"Can't import module: {fullQualifiedImportName}, error: {e}")
+            logger.critical(f"Can't import module: {fullQualifiedImportName}")
             sys.exit("Critical Error in Class import - can't continue. "
                      "Please maintain proper classnames in Testrundefinition.")
         return retClass

baangt/TestRunDatabaseCreate.py → baangt/base/TestRunDatabaseCreate.py


+ 5 - 6
baangt/TestRunFromExcel.py

@@ -1,7 +1,6 @@
-from baangt.TestRun import TestRun
-from baangt.utils import utils
-import baangt.GlobalConstants as GC
-import baangt.CustGlobalConstants as CGC
+from baangt.base.TestRun import TestRun
+from baangt.base.utils import utils
+import baangt.base.GlobalConstants as GC
 import xlrd
 import logging
 
@@ -80,8 +79,8 @@ class TestRunFromExcel(TestRun):
                                                      testStepNumber=execLine["TestStepNumber"])
 
             lTestStep[1][GC.STRUCTURE_TESTSTEPEXECUTION][execLine["TestStepExecutionNumber"]] = {}
-            for key, value in execLine.items():
-                lTestStep[1][GC.STRUCTURE_TESTSTEPEXECUTION][execLine["TestStepExecutionNumber"]][key] = value
+            for lkey, value in execLine.items():
+                lTestStep[1][GC.STRUCTURE_TESTSTEPEXECUTION][execLine["TestStepExecutionNumber"]][lkey] = value
                 pass
 
     def getRowsWithHeadersAsDict(self, xlsTab):

+ 1 - 1
baangt/Timing.py

@@ -1,4 +1,4 @@
-from baangt import GlobalConstants as GC
+from baangt.base import GlobalConstants as GC
 from datetime import timedelta
 from time import time
 import logging

+ 0 - 0
baangt/base/__init__.py


+ 0 - 1
baangt/utils.py

@@ -1,6 +1,5 @@
 from datetime import datetime
 import ntpath
-import traceback
 
 class utils:
     def __init__(self):

+ 2 - 2
manual_run_API_EarthSquad.py

@@ -1,6 +1,6 @@
 from baangtVIG.CustTestRun import TestRun
-from baangt import GlobalConstants as GC
-from TestSteps.DropsApp import Login_API
+from baangt.base import GlobalConstants as GC
+from baangt.TestSteps.DropsApp import Login_API
 
 if __name__ == '__main__':
     #l_testRun = TestRun("WSTV-Single")

+ 1 - 1
setup.py

@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
 
 setuptools.setup(
     name="baangt", # Replace with your own username
-    version="2020.1.0b0",
+    version="2020.1.0b2",
     author="Bernhard Buhl",
     author_email="buhl@buhl-consulting.com.cy",
     description="Basic And Advanced NextGeneration Testing",