TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2015 |
Maintained by Jon Reid.
MockUIAlertViewActionSheet lets you mock iOS alerts and action sheets for unit tests, based on the classic (and deprecated) UIAlertView and UIActionSheet.
(For new UIAlertController-based alerts, use MockUIAlertController.)
No actual alerts are presented. This means:
Make sure to take everything from Source/MockUIAlertViewActionSheet.
Nothing.
#import <MockUIAlertViewActionSheet/QCOMockAlertViewVerifier.h>
QCOMockAlertViewVerifier
before the execution phase of the test.Information about the alert is then available through the QCOMockAlertViewVerifier.
For example, here's a test verifying the title. sut
is the system under test
in the test fixture.
- (void)testShowAlert_AlertShouldHaveTitle
{
QCOMockAlertViewVerifier *alertVerifier = [[QCOMockAlertViewVerifier alloc] init];
[sut showAlert:nil];
XCTAssertEqualObjects(alertVerifier.title, @"Title");
}
#import <MockUIAlertViewActionSheet/QCOMockActionSheetVerifier.h>
QCOMockActionSheetVerifier
before the execution phase of the test.Information about the action sheet is then available through the QCOMockActionSheetVerifier.
See the sample app. Run it to see what it does, then read the tests.