Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #576 from AutoScout24/resetSimulatorOnFailureSetting
Browse files Browse the repository at this point in the history
Add option for not reseting the simulator on failure
  • Loading branch information
ExtremeMan committed Sep 17, 2015
2 parents fa804e5 + 503e50b commit 4ceb944
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions xctool/xctool-tests/OCUnitTestRunnerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static id TestRunnerWithTestLists(Class cls, NSDictionary *settings, NSArray *fo
environment:environment
freshSimulator:NO
resetSimulator:NO
noResetSimulatorOnFailure:NO
freshInstall:NO
testTimeout:30
reporters:@[eventBuffer]];
Expand Down
1 change: 1 addition & 0 deletions xctool/xctool-tests/OTestShimTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ @interface OTestShimTests : XCTestCase
environment:@{}
freshSimulator:NO
resetSimulator:NO
noResetSimulatorOnFailure:NO
freshInstall:NO
testTimeout:1
reporters:@[]];
Expand Down
2 changes: 1 addition & 1 deletion xctool/xctool/OCUnitIOSAppTestRunner.m
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ - (void)runTestsAndFeedOutputTo:(void (^)(NSString *))outputLineBlock

// we will reset iOS simulator contents and settings now if it is not done in `prepTestEnv`
if (!_resetSimulator) {
prepareSimulator(YES, YES);
prepareSimulator(YES, !_noResetSimulatorOnFailure);
}

// Sometimes, the test host app installation retries are starting and
Expand Down
2 changes: 2 additions & 0 deletions xctool/xctool/OCUnitTestRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
BOOL _garbageCollection;
BOOL _freshSimulator;
BOOL _resetSimulator;
BOOL _noResetSimulatorOnFailure;
BOOL _freshInstall;
NSInteger _testTimeout;
NSArray *_reporters;
Expand Down Expand Up @@ -60,6 +61,7 @@
environment:(NSDictionary *)environment
freshSimulator:(BOOL)freshSimulator
resetSimulator:(BOOL)resetSimulator
noResetSimulatorOnFailure:(BOOL)noResetSimulatorOnFailure
freshInstall:(BOOL)freshInstall
testTimeout:(NSInteger)testTimeout
reporters:(NSArray *)reporters;
Expand Down
3 changes: 3 additions & 0 deletions xctool/xctool/OCUnitTestRunner.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ @interface OCUnitTestRunner ()
@property (nonatomic, assign) BOOL garbageCollection;
@property (nonatomic, assign) BOOL freshSimulator;
@property (nonatomic, assign) BOOL resetSimulator;
@property (nonatomic, assign) BOOL noResetSimulatorOnFailure;
@property (nonatomic, assign) BOOL freshInstall;
@property (nonatomic, copy, readwrite) NSArray *reporters;
@property (nonatomic, copy) NSDictionary *framework;
Expand Down Expand Up @@ -135,6 +136,7 @@ - (instancetype)initWithBuildSettings:(NSDictionary *)buildSettings
environment:(NSDictionary *)environment
freshSimulator:(BOOL)freshSimulator
resetSimulator:(BOOL)resetSimulator
noResetSimulatorOnFailure:(BOOL)noResetSimulatorOnFailure
freshInstall:(BOOL)freshInstall
testTimeout:(NSInteger)testTimeout
reporters:(NSArray *)reporters
Expand All @@ -149,6 +151,7 @@ - (instancetype)initWithBuildSettings:(NSDictionary *)buildSettings
_environment = [environment copy];
_freshSimulator = freshSimulator;
_resetSimulator = resetSimulator;
_noResetSimulatorOnFailure = noResetSimulatorOnFailure;
_freshInstall = freshInstall;
_testTimeout = testTimeout;
_reporters = [reporters copy];
Expand Down
1 change: 1 addition & 0 deletions xctool/xctool/RunTestsAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ typedef NS_ENUM(NSInteger, BucketBy) {

@property (nonatomic, assign) BOOL freshSimulator;
@property (nonatomic, assign) BOOL resetSimulator;
@property (nonatomic, assign) BOOL noResetSimulatorOnFailure;
@property (nonatomic, assign) BOOL freshInstall;
@property (nonatomic, assign) BOOL parallelize;
@property (nonatomic, assign) BOOL failOnEmptyTestBundles;
Expand Down
6 changes: 6 additions & 0 deletions xctool/xctool/RunTestsAction.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ + (NSArray *)options
description:
@"Reset simulator content and settings and restart it before running every app test run."
setFlag:@selector(setResetSimulator:)],
[Action actionOptionWithName:@"noResetSimulatorOnFailure"
aliases:nil
description:
@"Do not reset simulator content and settings if running failed."
setFlag:@selector(setNoResetSimulatorOnFailure:)],
[Action actionOptionWithName:@"freshInstall"
aliases:nil
description:
Expand Down Expand Up @@ -668,6 +673,7 @@ - (TestableBlock)blockForTestable:(Testable *)testable
environment:environment
freshSimulator:_freshSimulator
resetSimulator:_resetSimulator
noResetSimulatorOnFailure:_noResetSimulatorOnFailure
freshInstall:_freshInstall
testTimeout:_testTimeout
reporters:reporters];
Expand Down
10 changes: 10 additions & 0 deletions xctool/xctool/TestAction.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ + (NSArray *)options
description:
@"Reset simulator content and settings and restart it before running every app test run."
setFlag:@selector(setResetSimulator:)],
[Action actionOptionWithName:@"noResetSimulatorOnFailure"
aliases:nil
description:
@"Do not reset simulator content and settings if running failed."
setFlag:@selector(setNoResetSimulatorOnFailure:)],
[Action actionOptionWithName:@"freshInstall"
aliases:nil
description:
Expand Down Expand Up @@ -134,6 +139,11 @@ - (void)setResetSimulator:(BOOL)resetSimulator
[_runTestsAction setResetSimulator:resetSimulator];
}

- (void)setNoResetSimulatorOnFailure:(BOOL)noResetSimulatorOnFailure
{
[_runTestsAction setNoResetSimulatorOnFailure:noResetSimulatorOnFailure];
}

- (void)setFreshInstall:(BOOL)freshInstall
{
[_runTestsAction setFreshInstall:freshInstall];
Expand Down

0 comments on commit 4ceb944

Please sign in to comment.