Developer.rst.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. Plugins
  25. -------
  26. Please make yourself familiar with https://pluggy.readthedocs.io/en/latest/ in order to implement Plugins. If you're stuck let me know.