In this article we are going to see the build in asserts methods spatially come with robotium framework. These are not predefined Java asserts, these are from solo object specified form mobile.
After Initiating solo, we will mainly two type asserts
1. Memory checking : This asserts the available memory is not low by the system. Actually, it checks whether the current system memory is running low or not.
solo.assertMemoryNotLow();
Actually this is the implementation of this :
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ((ActivityManager)activityUtils.getCurrentActivity().getSystemService("activity")).getMemoryInfo(mi);
Assert.assertFalse("Low memory available: " + mi.availMem + " bytes!", mi.lowMemory);
2. Activity Checking : This assert is spatially for checking current activity. It has 4 overloaded methods to get this checking in 4 ways. We assume current activity = NoteEditor
-To check current activity with specified message and name
solo.assertCurrentActivity("Expected NoteEditor activity", "NoteEditor");
-To check current activity with specified message ,name and new instance or not.
solo.assertCurrentActivity("Expected NoteEditor activity", "NoteEditor", true);
-To check current activity with specified message and Class (extracted from Name)
solo.assertCurrentActivity("Expected NoteEditor activity",NotesList.class);
-To check current activity with specified message ,Class (extracted from Name) new instance or not.
solo.assertCurrentActivity("Expected NoteEditor activity", NotesList.class, true);
Note : The Boolean value checks whether it is new activity or not where we use this.
Thanks..:)
After Initiating solo, we will mainly two type asserts
1. Memory checking : This asserts the available memory is not low by the system. Actually, it checks whether the current system memory is running low or not.
solo.assertMemoryNotLow();
Actually this is the implementation of this :
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); ((ActivityManager)activityUtils.getCurrentActivity().getSystemService("activity")).getMemoryInfo(mi);
Assert.assertFalse("Low memory available: " + mi.availMem + " bytes!", mi.lowMemory);
2. Activity Checking : This assert is spatially for checking current activity. It has 4 overloaded methods to get this checking in 4 ways. We assume current activity = NoteEditor
-To check current activity with specified message and name
solo.assertCurrentActivity("Expected NoteEditor activity", "NoteEditor");
-To check current activity with specified message ,name and new instance or not.
solo.assertCurrentActivity("Expected NoteEditor activity", "NoteEditor", true);
-To check current activity with specified message and Class (extracted from Name)
solo.assertCurrentActivity("Expected NoteEditor activity",NotesList.class);
-To check current activity with specified message ,Class (extracted from Name) new instance or not.
solo.assertCurrentActivity("Expected NoteEditor activity", NotesList.class, true);
Note : The Boolean value checks whether it is new activity or not where we use this.
Thanks..:)