Skip to content

Commit

Permalink
Fixed all tests locally
Browse files Browse the repository at this point in the history
  • Loading branch information
lthrockmorton committed Dec 21, 2023
1 parent ebeda7e commit cdf6a57
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
14 changes: 13 additions & 1 deletion bluepill/tests/BPIntegrationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ - (void)testTwoBPInstances {
XCTAssert([runner busySwimlaneCount] == 0);
}

// Note: If this is failing for you locally, try resetting all of your
// sims with `sudo rm -rf /private/tmp/com.apple.CoreSimulator.SimDevice.*`
- (void)testClonedSimulators {
BPConfiguration *config = [self generateConfig];
config.numSims = @2;
Expand Down Expand Up @@ -266,13 +268,23 @@ - (void)testTwoBPInstancesWithXCTestRunFile {
BPRunner *runner = [BPRunner BPRunnerWithConfig:config withBpPath:bpPath];
XCTAssert(runner != nil);
int rc = [runner runWithBPXCTestFiles:app.testBundles];

// Set this once we learn how many tests are in the BPSampleAppTests bundle.
NSInteger sampleAppTestsRemaining = NSNotFound;
for (BPXCTestFile *testBundle in app.testBundles) {
// BPSampleAppTests is a huge bundle and will be broken into multiple batches
// Across all of these batches, the NOT skipped tests should add up to the total
// test count.
if ([testBundle.name isEqualToString:@"BPSampleAppTests"]) {
XCTAssertEqual(testBundle.skipTestIdentifiers.count, 8);
if (sampleAppTestsRemaining == NSNotFound) {
sampleAppTestsRemaining = testBundle.allTestCases.count;
}
sampleAppTestsRemaining -= (testBundle.allTestCases.count - testBundle.skipTestIdentifiers.count);
} else {
XCTAssertEqual(testBundle.skipTestIdentifiers.count, 0);
}
}
XCTAssertEqual(sampleAppTestsRemaining, 0);
XCTAssert(rc != 0); // this runs tests that fail
}

Expand Down
2 changes: 1 addition & 1 deletion bp/src/BPConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#import <Foundation/Foundation.h>

#pragma mark - Version Constants
#define BP_DEFAULT_XCODE_VERSION "14.1"
#define BP_DEFAULT_XCODE_VERSION "14.0"
#define BP_DEFAULT_RUNTIME "iOS 16.0"
#define BP_DEFAULT_BASE_SDK "16.0"

Expand Down
10 changes: 0 additions & 10 deletions bp/src/BPUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,6 @@ typedef BOOL (^BPRunBlock)(void);
*/
+ (NSString *)removeSwiftArgumentsFromTestName:(NSString *)testName;

/*!
* @discussion XCTest requires that swift test names are fully namespaced, and don't include parens,
* contrary to what Bluepill consumers provide.
*
* @param testName the name of the test to format
* @param bundleName The name of the test's bundle
* @return trimmed test name
*/
+ (NSString *)formatSwiftTestForXCTest:(NSString *)testName withBundleName:(NSString *)bundleName;

/*!
* @discussion setup the environment for weak linked frameworks
* @param argc the number of arguments to the command
Expand Down
2 changes: 1 addition & 1 deletion bp/tests/Utils/BPTestUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ + (NSString *)formatSwiftTestForXCTest:(NSString *)testName withBundleName:(NSSt
+ (BOOL)checkIfTestCase:(NSString *)testCase bundleName:(NSString *)bundleName wasRunInLog:(NSString *)logPath {
NSString *testName = testCase;
if ([self isTestSwiftTest:testName]) {
testName = [BPUtils formatSwiftTestForXCTest:testName withBundleName:bundleName];
testName = [BPTestUtils formatSwiftTestForXCTest:testName withBundleName:bundleName];
}
NSArray *testComponents = [testName componentsSeparatedByString:@"/"];
NSString *expectedString = [NSString stringWithFormat:@"Test Case '-[%@ %@]' started.", testComponents[0], testComponents[1]];
Expand Down

0 comments on commit cdf6a57

Please sign in to comment.