Jump-start into worry free production deployments¶
You can try baangt right away and see how it works. It’ll take less than 5 minutes.
Prerequisits¶
Chrome installed
Python3 installed
baangt
installed (either via PIP or from the GIT-Repository at https://gogs.earthsquad.global/athos/baangt)
If you prefer running baangt
inside Docker, use the Dockerfile from https://gogs.earthsquad.global/athos/baangt-Docker.
After downloading the repository, enter make build
and then make run
in the command line.
Once Docker is up, use SVN://localhost:5902 to connect. All features are exactly like you’d install everything on your local machine.
Let’s dive right into it¶
Start baangt interactive UI by typing python baangtIA.py
In the dropdown “Testrun” chose “SimpleTheInternet.xlsx” and click on “Execute TestRun”
- What’s happening here is pretty similar to a real world test case:
Browser (in this case Firefox) starts up
Navigate to a certain web page
click on a link
navigate back
click on other link
click on several elements of the page (e.g. buttons)
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.
Extend the Script:¶
For this to work we recommend an XPATH or CSS-plugin for your browser.
Follow these steps to modify the behaviour of the test script:
Open “SimpleTheInternet.xlsx” from the baangt root directory in Excel or OpenOffice
In your browser with activated XPATH or CSS-Plugin head over to http://the-internet.com
Choose one of the links, that you want to play around with and find the XPATH or CSS from your tool.
- Copy and paste this ID in the last line of the XLSX in column C (“Locator”).
Column A (“Activity”) should be “CLICK”
Column B (“LocatorType”) will be either XPATH or CSS depending on your tool
Save the XLSX
Execute the testrun “SimpleTheInternet.xlsx” in
baangt
again.Sit back and enjoy your victory!
Hint
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
Hint
If you want the browser window to stay open on errors and/or after execution, you can use parameter dontCloseBrowser
with value True
in global settings and run the test again. The browser will stop on errors or when the test run execution stopped.
A bit further¶
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 reproducable regression tests for.
Of course you could basically follow the steps above, but depending on the length and complexity of the execution, you’ll definitely enjoy having more tools in your toolbox:
Recording a test case with Katalon Recorder¶
Katalon Recorder is a free browser Add-on for Chrome and Firefox. Installation is simple, just google
Katalon plugin <your-browser>
and install the plugin. After installation of the Katalon recorder follow these steps:
Start the plugin
Hit the “record”-Button
- Execute the activities you want it to record. Usually following these steps:
Open a Webpage
Login (optional)
Navigate to some sub-page
Click buttons
Enter values
Download documents (optional)
Stop recording
Hint
You might want to execute the test case from within Katalon Recorder to make sure everything was recorded properly.
Hit the export-Button of the recorder, chose format
other
Click “Export to Clipboard”
- Switch over to
baangt
and press the button “Import KatalonRecorder” 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.
- Switch over to
Press “Save” and choose where you want to store the resulting XLSX-File
That’s it. You just created you first regression test case including all parameters for it.
If you’re wondering which parameters these are, and how you can influence them, fear not! Open the Testcase-XLSX from the last step above, click on the “data”-Tab and start to enter values and lines as you please.
You can always re-run Baangt after saving your Testrun-XLSX and see your progress.
Hint
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
Tweaking the result¶
You managed to have a working recording. Congratulations! Let’s learn a bit more about the structure of the created XLSX
Column Name |
Description |
---|---|
|
Sets the activity of this TestStep. Activities are described in more details in next chapter |
|
Most of the activities need a locator. We are big fans of XPATH as locatorType, due to speed and ease of use. Sooner
or later you’ll anyway end up needing XPATH, so why not use it always when there’s no downside? If you prefer
writing CSS-Paths then use value |
|
The locator is the specification on which element |
|
For instance activity |
|
For some activities (e.g. IF) you not only need the Value-Field but also a comparison operator and a
second field or value to compare to. Values for |
|
Sometimes you might to overwrite the default timeout settings of |
|
Usually when |
|
Often you’ll face situations, where you want to run a test case in several stages (e.g. DEV, Pre-Quality, Quality,
Migration, Pre-Production, etc.) and the software version on each stage is different. A test case, that works on
Pre-Production will not pass on Dev-System as Dev is already further developed. If you change the test case to work
on Dev-System and you need to test a Hotfix deployment on Pre-Production, what will you do? In other test solutions
you would “simply” copy your test case, have one version for DEV, one for Pre-Production. Do that with hundreds of
different test cases and watch yourself drown in chaos. OR you could use > 2019.05
will run the line only, if the Version is |
More details on Activities¶
Activity |
Description |
---|---|
GoToURL |
Navigate to the given URL. Column |
click |
Will click on the object specified by the |
clickIF |
Will click on the object specified by the locator IF the field in testDataDict, that you enter in Column |
setText |
Write the text given in column |
setTextIF |
Same as SetText, but will only do something in cases where there is a value in the datafile. Similarly to clickIF this little helper functionality can help you save hours and hours in creation and maintenance of rocksolid and bulletproof test cases. |
goBack |
Trigger the “back”-Button of the browser. |
If/Endif |
The block between IF and ENDIF is only executed when the condition evaluated by
Additionally you can check for empty/non-existing values by comparing to Another use of the If-Statement is with |
assert |
Will retrieve value of element specified by |
pause |
Will pause for the number of secons in |
iban |
Will create a random IBAN account number. |
pdfcompare |
In a step before you must have downloaded a PDF-File. Before you can compare, you have to provide a reference PDF
to upload. After the upload you’ll receive a unique ID for this document. Paste this ID into the |
CheckLinks |
Whenever you enter this command, all (if any) links on the current page will be checked and the status of the link will be reported accordingly. Reporting format is: Links on <base_url>: <status>:<Link> You’ll find the output in the Export sheet in the column “CheckedLinks”, which will be created automatically. |
saveto (for Web test cases only) |
|
clear |
|
switchwindow |
Switches to a browser window. |
setanchor |
There are pages, where you’ll not find good unique IDs or no nice way to locate elements. Setting an anchor can help in these cases. An anchor is an element, that can be located by CSS, ID or XPATH. After the anchor is set all future tries to locate an element will happen within the children of the anchor. To unset an anchor use setanchor without locator. setanchor can also improve the location performance, if you’re dealing with really large pages.
|
address_create |
provide an easy and easily extendable way to generate address data for a test case The following fields variable are stored in testcaseDataDict: CountryCode PostalCode CityName StreetName HouseNumber AdditionalData1 AdditionalData2
These fields can be used as filter criteria in field value. Example value= {CountryCode:CY, PostlCode: 7}. Resulted field-value :{‘HouseNumber’: ‘6’, ‘AdditionalData1’: ‘Near MahavirChowk’, ‘AdditionalData2’: ‘Opposite St. Marish Church’, ‘StreetName’: ‘GoreGaon’, ‘CityName’: ‘Ambala’, ‘PostalCode’: ‘7’, ‘CountryCode’: ‘CY’} value2 optional If a prefix was povided in field Value2, the fieldnames will be concatenated with this prefix, e.g.if value2=`PremiumPayer_`, then the resulting field for CountryCode in testDataDict would become PremiumPayer_CountryCode. |