Human Readable Tests
Significantly improve your test readability with built-in page objects and over 18 Android controls with relevant actions and properties. BELLATRIX can also generate test cases that are understandable for non-technical people.
18 UI Elements Ready to Use
Over 18 well-known Android controls with actions and properties that most relevant to them.
Since WebDriver is not a test framework, it is written in most generic manner. All Android elements share a common AndroidElement base class- containing the same methods and properties.
For example- you use SendKeys method to type text in the text field, to click a button using Enter key or upload a file. Or why do you need Click method for content box or text field?
AppiumWebElement agreeCheckBox = driver.FindElementById("agreeChB")); agreeCheckBox.Click(); AppiumWebElement firstNameTextField = driver.FindElementById("firstName")); firstNameTextField.SendKeys("John"); AppiumWebElement saveBtn = driver.FindElementById("saveBtn")); agreeCheckBox.SendKeys(Keys.Enter);
One more thing, if you don’t use suffixes in the names of your variables or properties, you won’t know what type of elements they are. In the case that you want to perform specific verifications, this might be important.
BELLATRIX offers 18 strongly-typed Android controls such as: combobox, button, text field, checkbox, etc. Each specific control contains well-named actions and properties that are most relevant to it.
var checkBox = App.ElementCreateService.CreateByName<CheckBox>("checkBox"); checkBox.Check(); var comboBox = App.ElementCreateService.CreateByAutomationId<ComboBox>("select"); comboBox.SelectByText("Jupiter"); var button = App.ElementCreateService.CreateByName<Button>("button"); button.Click(); var textField = App.ElementCreateService.CreateByAutomationId<TextField>("textBox"); textField.SetText("Meissa Is Beautiful!");
While reading the code, you can quickly find out the type of the elements since it is the first thing you see. Moreover, the specific action methods and properties make the code more self-explanatory.
Hide Low-level Details with Page Objects
Page objects are classes that group elements, actions, and assertions that are related to a specific screen.
Page objects benefits:
- Reuse elements locators
- Fix elements locators in a single place
- Combine elements in use case methods
- Hide low-level API details- such as waiting for elements
- Reuse assertion exception messages
BELLATRIX comes with enhanced built-in page objects. Each page object can be spread among three files. Each file holds a specific group of methods and properties. We can have one for actions, one for declaring elements, and one more for assertions.
This speeds up test development and maintenance, since you can find different parts of the page object more quickly. For example, if you need to fix the element locator, you open the Page.Elements file.
Page objects significantly improve the test’s readability. This is because their actions and assertion methods can have names which are more relatable to your business domain.
var homePage = App.GoTo<HomePage>(); homePage.FilterProducts(ProductFilter.Popularity); homePage.AddProductById(28); homePage.ViewCartButton.Click(); var cartPage = App.Create<CartPage>(); cartPage.ApplyCoupon("happybirthday"); cartPage.UpdateProductQuantity(1, 2); cartPage.AssertTotalPrice("95.00"); cartPage.ProceedToCheckout.Click();
There are cases when you need to show your colleagues or managers what tests you have. Sometimes you may have manual test cases, but their maintenance and up-to-date state are questionable.
BELLATRIX generates automatically these test cases for you. This is a sample test case log generated after test execution.
Start Test Class = BDDLoggingTests Name = PurchaseRocketWithLogs Select 'Sort by price: low to high' on CartPage Click ApplyCupon on CartPage Ensure SuccessDiv on CartPage inner text is 'Coupon code applied successfully.' Set '0' into QuantityNumber on CartPage Click UpdateCartButton on CartPage Ensure OrderTotalSpan on CartPage inner text is '95.00€'