如何在我的葫芦/黄瓜测试中访问 iOS 上的警报视图的文本?
NSString *msgString = [NSString stringWithFormat:@"No: %@\n Latitude: %f\n Longitude: %f", wrapper.no, wrapper.latitude, wrapper.longitude];
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Really reset?" message:@"msgString" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] autorelease];
// optional - add more buttons:
[alert addButtonWithTitle:@"Yes"];
[alert show];
我想断言警报具有预期的内容:
Feature: Running a test
As a user using a phone connected to the internet
I want to have correct sample data retrieved from cache or net
So I can read the values of the tableview
Scenario: Testing retrieved data
Given the app is running
Then I press "Refresh"
Then I should see "Some value"
Then I press "Some value"
Then I should /*See an alert with "myMessage"*/
Then I press "OK"
And take picture
因此,如果我将字符串更改为简单的“否:”并丢弃字符串中的所有其他内容,它似乎确实有效,但我无法使用更复杂的字符串运行它:(