simpleExample.rst.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. Jump-start into worry free production deployments
  2. =================================================
  3. You can try baangt right away and see how it works. It'll take less than 5 minutes.
  4. Prerequisits
  5. ^^^^^^^^^^^^^
  6. * Chrome installed
  7. * Python3 installed
  8. * ``baangt`` installed (either via PIP or from the GIT-Repository at https://gogs.earthsquad.global/athos/baangt)
  9. If you prefer running ``baangt`` inside Docker, use the Dockerfile from https://gogs.earthsquad.global/athos/baangt-Docker.
  10. After downloading the repository, enter ``make build`` and then ``make run`` in the command line.
  11. Once Docker is up, use SVN://localhost:5902 to connect. All features are exactly like you'd install everything on your local machine.
  12. Let's dive right into it
  13. ^^^^^^^^^^^^^^^^^^^^^^^^^
  14. * Start baangt interactive UI by typing `python baangtIA.py`
  15. * In the dropdown "Testrun" chose "SimpleTheInternet.xlsx" and click on "Execute TestRun"
  16. * What's happening here is pretty similar to a real world test case:
  17. * Browser (in this case Firefox) starts up
  18. * Navigate to a certain web page
  19. * click on a link
  20. * navigate back
  21. * click on other link
  22. * click on several elements of the page (e.g. buttons)
  23. * write a report with summary and details about the test case. You'll find the report in the root directory of baangt, unless you stated otherwise.
  24. Extend the Script:
  25. ------------------
  26. For this to work we recommend an XPATH or CSS-plugin for your browser.
  27. Follow these steps to modify the behaviour of the test script:
  28. * Open "SimpleTheInternet.xlsx" from the baangt root directory in Excel or OpenOffice
  29. * In your browser with activated XPATH or CSS-Plugin head over to http://the-internet.com
  30. * Choose one of the links, that you want to play around with and find the XPATH or CSS from your tool.
  31. * Copy and paste this ID in the last line of the XLSX in column C ("Locator").
  32. * Column A ("Activity") should be "CLICK"
  33. * Column B ("LocatorType") will be either XPATH or CSS depending on your tool
  34. * Save the XLSX
  35. * Execute the testrun "SimpleTheInternet.xlsx" in ``baangt`` again.
  36. * Sit back and enjoy your victory!
  37. .. hint::
  38. If you want to be able to watch your browser executing each step, we recommend you set the parameter ``slowExecution`` with value ``True`` in Globals and re-run the test
  39. .. hint ::
  40. If you want the browser window to stay open on errors and/or after execution, you can use parameter ``dontCloseBrowser`` with value ``True``
  41. in global settings and run the test again. The browser will stop on errors or when the test run execution stopped.
  42. A bit further
  43. -------------
  44. Go ahead and try it out with your personal real-world example of a web-page, web-app or SPA, which you would like to have
  45. reproducable regression tests for.
  46. Of course you could basically follow the steps above, but depending on the length and complexity of the execution, you'll
  47. definitely enjoy having more tools in your toolbox:
  48. Recording a test case with Katalon Recorder
  49. -------------------------------------------
  50. Katalon Recorder is a free browser Add-on for Chrome and Firefox. Installation is simple, just google
  51. ``Katalon plugin <your-browser>`` and install the plugin. After installation of the Katalon recorder follow these steps:
  52. * Start the plugin
  53. * Hit the "record"-Button
  54. * Execute the activities you want it to record. Usually following these steps:
  55. * Open a Webpage
  56. * Login (optional)
  57. * Navigate to some sub-page
  58. * Click buttons
  59. * Enter values
  60. * Download documents (optional)
  61. * Stop recording
  62. .. hint::
  63. You might want to execute the test case from within Katalon Recorder to make sure everything was recorded properly.
  64. * Hit the export-Button of the recorder, chose format ``other``
  65. * Click "Export to Clipboard"
  66. * Switch over to ``baangt`` and press the button "Import KatalonRecorder"
  67. * The contents from the clipboard should be imported already and translation to ``baangt`` should be completed. If the clipboard was not inserted automatically, click on the button "Import Clipboard" and please drop a ticket stating your operating system incl. version and which browser you used for recording in Katalon recorder.
  68. * Press "Save" and choose where you want to store the resulting XLSX-File
  69. **That's it. You just created you first regression test case including all parameters for it.**
  70. If you're wondering which parameters these are, and how you can influence them, fear not! Open the Testcase-XLSX from
  71. the last step above, click on the "data"-Tab and start to enter values and lines as you please.
  72. You can always re-run Baangt after saving your Testrun-XLSX and see your progress.
  73. .. hint::
  74. If you want to be able to watch your browser executing each step, set the parameter ``slowExecution`` with value ``True`` in Globals and re-run the test
  75. Tweaking the result
  76. ^^^^^^^^^^^^^^^^^^^
  77. You managed to have a working recording. Congratulations! Let's learn a bit more about the structure of the created XLSX
  78. .. list-table:: Fields in Tab ``TestStepExecution``
  79. :widths: 25 75
  80. :header-rows: 1
  81. * - Column Name
  82. - Description
  83. * - ``Activtity``
  84. - Sets the activity of this TestStep. Activities are described in more details in next chapter
  85. * - ``LocatorType``
  86. - Most of the activities need a locator. We are big fans of XPATH as locatorType, due to speed and ease of use. Sooner
  87. or later you'll anyway end up needing XPATH, so why not use it always when there's no downside? If you prefer
  88. writing CSS-Paths then use value ``CSS`` for the locator. And if you are lucky enough to have unique IDs in your
  89. page simply use ``ID``.
  90. * - ``Locator``
  91. - The locator is the specification on which element ``Activity`` should happen. As in the value fields, you may
  92. use variable replacement here too, in order to replace Locators with values from the data file. For instance the
  93. following would work fine:
  94. ``//*[@id($(CUSTOMERNUMBER))]`` - this would create an XPATH-Statement where $(CUSTOMERNUMBER) is replaced by the
  95. actual value of the current test record.
  96. * - ``Value``
  97. - For instance activity ``SetText`` requires a value (The text to send to a Web-element). You may use fixed values
  98. (which will rarely happen) or values from your test data source, in the simple cases the sheet ``Data`` .
  99. The column names in the sheet ``data`` can be used as variable names (e.g. if you created a column "Quantity" in
  100. your data tab, you can use ``$(Quantity)`` in the field value.
  101. * - ``Comparison`` and ``Value2``
  102. - For some activities (e.g. IF) you not only need the Value-Field but also a comparison operator and a
  103. second field or value to compare to. Values for ``comparison`` are ``eq`` and ``=``. The field ``value2``
  104. follows the same logic as ``value``.
  105. * - ``Timeout``
  106. - Sometimes you might to overwrite the default timeout settings of ``baangt``. Here's your chance. Values in seconds,
  107. decimals are OK (``0.5`` is a valid value, so is ``90``).
  108. * - ``Optional``
  109. - Usually when ``baangt`` tries to execute an activity and can't (after timeout), it will throw an exception,
  110. report in the Logs and stop the current test case. If you set ``optional`` to ``True`` or ``X``, ``baangt``
  111. will continue execution of the test case, even if the activity wasn't possible.
  112. * - ``Release``
  113. - Often you'll face situations, where you want to run a test case in several stages (e.g. DEV, Pre-Quality, Quality,
  114. Migration, Pre-Production, etc.) and the software version on each stage is different. A test case, that works on
  115. Pre-Production will not pass on Dev-System as Dev is already further developed. If you change the test case to work
  116. on Dev-System and you need to test a Hotfix deployment on Pre-Production, what will you do? In other test solutions
  117. you would "simply" copy your test case, have one version for DEV, one for Pre-Production. Do that with hundreds of
  118. different test cases and watch yourself drown in chaos. OR you could use ``baangt`` where this problem is solved.
  119. Software moves through the stages of your system landscape as it evolves. Use this field to conditionally execute
  120. different "branches" of your test cases, depending on the version on the current stage. ``Release`` can be any
  121. string value. You can add "> " "< " and "= " as the first 2 characters to signal to ``baangt`` to only execute
  122. the step when current release is greater than, lower than or exactly equal to the value afterwards, for instance
  123. ::
  124. > 2019.05
  125. will run the line only, if the Version is ``2019.05a`` or ``2019.06``. We are aware, that your version numbers might
  126. follow different nomenclature, so we made it very easy to subclass the corresponding logic.
  127. More details on Activities
  128. --------------------------
  129. * GoToURL
  130. * click
  131. * setText
  132. * SetTextIF
  133. * clickIF
  134. * goBack
  135. * If
  136. * EndIf
  137. * Pause
  138. * Assert
  139. * address_create
  140. .. list-table:: Details of activities
  141. :widths: 25 75
  142. :header-rows: 1
  143. * - Activity
  144. - Description
  145. * - GoToURL
  146. - Navigate to the given URL. Column ``Value`` must provide the URL. You might want to use variables in your URL-String,
  147. for instance your URL might look like this ``https://$(STAGE).earthsquad.global/``. It will be replaced
  148. during runtime of the test data with the value of ``STAGE`` from either Global settings or settings in the
  149. ``testCaseSequence``.
  150. * - click
  151. - Will click on the object specified by the ``locator``.
  152. * - clickIF
  153. - Will click on the object specified by the locator IF the field in testDataDict, that you enter in Column ``value``
  154. has a value. This small and simple extension can save you hours and hours of work in maintenance of testcases.
  155. Imagine you have 10 checkboxes, that in various combinations provide different test results, and you have to test
  156. all possible combinations. Using one column in your datafile for each checkbox and the ``clickif``, you can create
  157. your testCases in minutes instead of hours or days. Imagine 50 checkboxes - with ``baangt`` your effort is still
  158. just minutes.
  159. * - setText
  160. - Write the text given in column ``value`` to the element specified by ``locator``. Only rarely will you have fixed
  161. values. Usually you'll assign columns of the test data using variable replacement (e.g. ``$(POSTCODE)`` to set the
  162. text from column ``POSTCODE`` from the datafile into the destination element.
  163. * - setTextIF
  164. - Same as SetText, but will only do something in cases where there is a value in the datafile. Similarly to clickIF
  165. this little helper functionality can help you save hours and hours in creation and maintenance of rocksolid and
  166. bulletproof test cases.
  167. * - goBack
  168. - Trigger the "back"-Button of the browser.
  169. * - If/Endif
  170. - The block between IF and ENDIF is only executed when the condition evaluated by ``value|comparator|value2`` is
  171. true, for instance:
  172. $(POSTCODE) = 7040
  173. $(YEAR2DATE) > $(YEARTOMONTH)
  174. Another use of the If-Statement is with ``LocatorType`` and ``Locator`` and comparison. This can be used when you
  175. want conditional execution of a larger block of statements depending on an element present or not present.
  176. * - assert
  177. - Will retrieve value of element specified by ``locator`` and compare with reference value from ``value``.
  178. * - pause
  179. - Will pause for the number of secons in ``value``. Valid numbers are float, e.g. 2, 0.2, 0.1, 25
  180. * - iban
  181. - Will create a random IBAN account number. ``value 2`` is the destination field of the test case structure. If you
  182. don't provide a field name (not necessarily one that exists in the input file. Can be any field name!) nothing will
  183. happen. If you provide input parameters in column ``value`` (``SWIFT`` and/or ``COUNTRY``) the IBAN will be created for that bank-code
  184. and/or country.
  185. * - address_create
  186. - provide an easy and easily extendable way to generate address data for a test case
  187. The following fields variable are stored in testcaseDataDict:
  188. CountryCode
  189. PostalCode
  190. CityName
  191. StreetName
  192. HouseNumber
  193. AdditionalData1
  194. AdditionalData2
  195. `value` optional
  196. Default field-value: {'HouseNumber': '6', 'AdditionalData1': 'Near MahavirChowk', 'AdditionalData2': 'Opposite St. Marish Church', 'StreetName': 'GoreGaon', 'CityName': 'Ambala', 'PostalCode': '160055', 'CountryCode': 'India'}
  197. These fields can be used as filter criteria in field value.
  198. Example value= `{CountryCode:CY, PostlCode: 7}`.
  199. Resulted field-value :{'HouseNumber': '6', 'AdditionalData1': 'Near MahavirChowk', 'AdditionalData2': 'Opposite St. Marish Church', 'StreetName': 'GoreGaon', 'CityName': 'Ambala', 'PostalCode': '7', 'CountryCode': 'CY'}
  200. `value2` optional
  201. If a prefix was povided in field Value2, the fieldnames will be concatenated with this prefix,
  202. e.g.if value2=`PremiumPayer_`, then the resulting field for CountryCode in testDataDict would become PremiumPayer_CountryCode.