Fix test order in one file on ios #3020
Conversation
…tor naming in iOS test runner
There was a problem hiding this comment.
Code Review
This pull request adds a new end-to-end test file and modifies the iOS test runner to include a numeric prefix in dynamic selector names, ensuring a specific execution order. A review comment suggests refining the selector naming convention by using underscores instead of spaces and adding a 'test_' prefix to improve compatibility with test reporting tools and IDEs.
| XCTAssertTrue(passed, @"%@", details); \ | ||
| }); \ | ||
| SEL selector = NSSelectorFromString(dartTestName); \ | ||
| NSString *selectorName = [NSString stringWithFormat:@"%05lu %@", (unsigned long)i, dartTestName]; \ |
There was a problem hiding this comment.
The selector name is constructed using a space as a separator (e.g., 00000 my test). While technically allowed by the Objective-C runtime, selectors with spaces are highly unconventional and can break compatibility with test reporting tools, CI systems (like those parsing JUnit XML), and IDE integrations (such as the Xcode Test Navigator) that expect valid C-style identifiers. It is recommended to use an underscore as a separator and prefix the selector with test_ to align with standard XCTest naming conventions.
| NSString *selectorName = [NSString stringWithFormat:@"%05lu %@", (unsigned long)i, dartTestName]; \ | |
| NSString *selectorName = [NSString stringWithFormat:@"test_%05lu_%@", (unsigned long)i, dartTestName]; \ |
Potential fix for #2944