Developer.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. Developer guidelines for custom enhancements
  2. ============================================
  3. ``baangt`` is already pretty versatile but from time to time you'll face a requirement, that simply can't be done without
  4. writing code. But that's not a bad thing - we like writing code after all, don't we?
  5. Subclassing
  6. ---------------------
  7. The main classes and functions should be more than OK for you. You'll just need to implement some central enhancements.
  8. For instance there's a requirement to check after each Browser-Interaction, whether a specific popup/message appeared.
  9. Don't be cruel and let the end-users duplicate the locator over and over again in their XLSX.
  10. Instead create a subclass of BrowserDriver
  11. ::
  12. from baangt.base.BrowserDriver import BrowserHandling
  13. class MyCustomBrowser(BrowserHandling)
  14. def findByAndClick(...)
  15. # Search for the element
  16. self.customSearchAndReact()
  17. def customSearchAndReact():
  18. if self.findBy(xpath, "specialThingForThisClient"):
  19. self.testdataDict[GC.TESTCASESTATUS] = GC.TESTCASESTATUS_FAILED
  20. That's it. Business people will love you and whenever "specialThingForThisClient" changes, you'll have to adjust only
  21. in one place.
  22. After subclassing you'll need to replace the standard ``BrowserHandling`` with ``MyCustomBrowser`` in order for baangt
  23. to use it.
  24. Debugging
  25. ---------
  26. Yeah, sometimes the logs alone are not enough, even when you set loglevel to ``debug``. In such cases you'll want to set
  27. breakpoints and expect the program to halt on the breakpoint. You've two chances to achieve that:
  28. * Start baangtIA.py from CLI using:
  29. ``python3 baangtIA.py --run=<PathAndFileOfTestrunName> --globals=<PathAndFileNameForGlobals>``
  30. * Use ``TX.DEBUG`` as flag in ``baangt`` interactive starter (=the UI, that comes when you start CLI without parameter
  31. ``--run``) with value ``True``
  32. Plugins
  33. -------
  34. Please make yourself familiar with https://pluggy.readthedocs.io/en/latest/ in order to implement Plugins.
  35. If you're stuck let me know.
  36. Network trace
  37. -------------
  38. Sometimes it's useful (especially for frontend debugging and in performance measurments) to have more detailed log about
  39. the calls that the browser exchanges with the backend. If you need this, use ``TC.NetworkInfo`` with value = ``True``.
  40. In the output file you'll see a new tab "Network" that shows all calls, headers, payload and timing information for each
  41. call.
  42. Use with care, as the file can get pretty big.
  43. Building baangt sources
  44. -----------------------
  45. Core project members can build distribution as follows:
  46. Building pyPi
  47. ^^^^^^^^^^^^^
  48. * Increase version in ``setup.py``
  49. * ``MakePackage.sh`` to upload to PyPi
  50. * Use latest version in depending project's ``requirements.txt`` (Custom projects)
  51. * ``pip install -r requirements.txt``
  52. Building Executables
  53. ^^^^^^^^^^^^^^^^^^^^
  54. * Checkout ``https://github.com/Athos1972/baangt-executables``
  55. * Checkout ``https://gogs.earthsquad.global/athos/baangt``
  56. * Change to /baangt directory
  57. * On a Windows computer: ``execWindow.bat`` (Takes about 5 Minutes)
  58. * Move ``/executables/baangt_windows_executable.zip`` to checked out ``baangt-executables`` ideally with this line:
  59. ``mv executables/baangt_mac_executable.zip ../baangt-executables``
  60. * Repeat accordingly on Mac (``execMac.sh``)
  61. * Repeat accordingly on Ubuntu (``execUbuntu.sh``)
  62. * ``git add .`` in the folder ``baangt-executables``
  63. * ``git commit -m <version>``
  64. * ``git push``
  65. Windows bundle executables:
  66. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  67. * Install innosetup-qsp (QuickStartPack) Version 6 from https://jrsoftware.org/isdl.php
  68. * Open Inno Setup
  69. * Use Script ``/windows/baangtSetupWindows.iss``
  70. * Check that the path for the LICENSE is correct on your computer (most probably it isn't!)
  71. * Execute the script using the "Compile"-Button (takes about 3-5 Minutes)
  72. * Copy the file from ``/baangt/windows/output/baangtsetup.exe`` to ``baangt-executables`` folder
  73. * ``git add .`` in the folder ``baangt-executables``
  74. * ``git commit -m <version>``
  75. * ``git push``