Learn how to write and run a basic ZWL test using Zylitics IDE.
This tutorial should cost less than 1 build minute.
- From the console, click on IDE.
- Once IDE loads, click on New File icon (left to
+in a circle icon in below image) and name it
my first zwl test(or whatever you feel like). Hit
- Hover the pointer on the new file. From the set of icons next to the file name, click on Create New Test (look at below image) to create a test. Name the test
verify basic functionality of google calculator. Hit
enterto save and open new test in editor.
Write the following ZWL code in editor. If time allows, we suggest you write it by hand and not using copy/paste to get a strong feel of ZWL and the editor.
openUrl('https://google.com')# Find search box and type querytype(findElement('input[aria-label="Search"]', by.cssSelector), 'calculator', keys.enter)# Find the calculator so that we can limit our further searches only within calculator panel.calculator = findElement('div[role="main"] div[data-async-context="query:calculator"] > :first-child', by.cssSelector)# Keep the calculator buttons we require to press.btn9 = findElementFromElement(calculator, '9', by.text)btnMul = findElementFromElement(calculator, '×', by.text)btnDiv = findElementFromElement(calculator, '÷', by.text)btnEq = findElementFromElement(calculator, '=', by.text)# Keep the result element that shows calculation result.resultEl = findElementFromElement(calculator, 'presentation', by.role) # Our first calculation is 9*9clickAll(btn9, btnMul, btn9, btnEq)# Assert the result is 81assertTrue(81 == getElementText(resultEl)) # Our final calculation is to divide the result by 9 twiceclickAll(btnDiv, btn9, btnDiv, btn9, btnEq)# Assert the result is 1assertTrue(1 == getElementText(resultEl)) print('Congratulations on writing your first ZWL test successfully!')
- Add a new Build Capability. From the top of IDE, click on Edit Menu (titled Edit Capabilities, Configs & Variables) and click on Build Capability. Alternatively, hit
Shift + A.
- In the opened window, click on Add new build capability.
- To run the test on Windows 10 with chrome, name the capability
- Select Windows 10 from the OS menu and preferred chrome version from Browser menu.
- Hit Save to save and return. Close the window.
- From Editor Embedded Output Console, click on the run build icon (titled Run build for this version). This will open up Build Config.
- In build config screen, select the Build Capability added in previous step and hit Run Build.
- IDE will now find and connect to a VM having the choice of OS and browser. You can keep an eye on the progress in Build Output Console.
- Once the VM is allocated and connected, test starts running. You can view live preview and real time output of the test within IDE.
- Once test run finishes, open Completed Builds to view the detailed results.
Start from the most important features and elements of Test Runner before learning more about ZWL. Once you've a good grasp of ZWL, learn more about IDE and Test Runner to be able to use Zylitics efficiently.