Human Readable Tests
Significantly improve your test readability with built-in page objects and over 30 web controls with relevant actions and properties. BELLATRIX can also generate test cases that are understandable for non-technical people.
30+ UI Elements Ready to Use
Over 30 well-known web controls with actions and properties that are most relevant to them.
Since WebDriver is not a test framework, it is written in most generic manner. All web elements share a common IWebElement interface- 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 DIV or text field?
IWebElement agreeCheckBox = driver.FindElement(By.Id("agreeChB")); agreeCheckBox.Click(); IWebElement firstNameTextField = driver.FindElement(By.Id("firstName")); firstNameTextField.SendKeys("John"); IWebElement avatarUpload = driver.FindElement(By.Id("uploadAvatar")); avatarUpload.SendKeys("pathTo\myAvatar.jpg"); IWebElement saveBtn = driver.FindElement(By.Id("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. For example, anchor web elements cannot be disabled, although buttons can. BELLATRIX offers over 30 strongly-typed web controls such as: anchor, button, text field, checkbox, etc. Each specific control contains well-named actions and properties that are most relevant to it.
CheckBox agreeCheckBox = App.ElementCreateService.CreateById<CheckBox>("agreeChB"); agreeCheckBox.Check(); TextField firstNameTextField = App.ElementCreateService.CreateById<TextField>("firstName"); firstNameTextField.SetText("John"); InputFile avatarUpload = App.ElementCreateService.CreateById<InputFile>("uploadAvatar"); avatarUpload.Upload("pathTo\myAvatar.jpg"); Button saveBtn = App.ElementCreateService.CreateById<Button>("saveBtn"); saveBtn.ClickByEnter();
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 web page.
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€'