public void CommonAssertionsAndroidControls()
var button = App.ElementCreateService.CreateByIdContaining<Button>("button");
var checkBox = App.ElementCreateService.CreateByIdContaining<CheckBox>("check1");
var comboBox = App.ElementCreateService.CreateByIdContaining<ComboBox>("spinner1");
var label = App.ElementCreateService.CreateByText<Label>("textColorPrimary");
var radioButton = App.ElementCreateService.CreateByIdContaining<RadioButton>("radio2");
We can assert whether the control is disabled. The different BELLATRIX Android elements classes contain lots of these properties which are a representation of the most important app element attributes. The biggest drawback of using vanilla assertions is that the messages displayed on failure are not meaningful at all. This is so because most unit testing frameworks are created for much simpler and shorter unit tests. In next chapter, there is information how BELLATRIX solves the problems with the introduction of Ensure methods. If the bellow assertion fails the following message is displayed: “*Message: Assert.AreEqual failed. Expected:. Actual:.*"
You can guess what happened, but you do not have information which element failed and on which screen.
Asserts that the checkbox is checked. On fail the following message is displayed: “Message: Assert.IsTrue failed.”
Cannot learn much about what happened.
Assert that the proper item is selected from the combobox items.
See if the element is present or not using the IsPresent property.
Assert that the radio button is clicked.
One more thing you need to keep in mind is that normal assertion methods do not include BDD logging and any available hooks. BELLATRIX provides you with a full BDD logging support for ensure assertions and gives you a way to hook your logic in multiple places.