Rightpoint / RZUtils

Rightpoint Commonly Used Tools
Other
122 stars 22 forks source link

Adding A Test App Target to Unit Tests #139

Closed seanoshea closed 8 years ago

seanoshea commented 9 years ago

See https://github.com/Raizlabs/RZUtils/issues/128 for details.

seanoshea commented 9 years ago

cc @ZevEisenberg @KingOfBrian

ZevEisenberg commented 9 years ago

@seanoshea it's redundant to have RZUtilsTests, RZUtilsTestApp, and RZUtilsTestAppTests. Any way to consolidate this?

seanoshea commented 9 years ago

@ZevEisenberg I'd agree that all the different targets are getting a bit confusing.

I guess that everything could be consolidated into the RZUtilsTestAppTests target. That would mean that we could get rid of the RZUtilsTests target & the aggregate target RZUtilsAllTests as well. We'd just need to move the existing RZBlockKVOTests into the RZUtilsTestAppTests target which would be a simple enough move. I could try to amend #139 to do this if that's what you had in mind.

The only downside to consolidating into the RZUtilsTestAppTeststarget is that it might look somewhat odd to necessitate a test host app launch to execute unit tests on non UI-related code (RZBlockKVOTests would be one example). The README could be amended to at least to give other developers an understanding of why this decision was made, but I guess that's one tradeoff.

Anyone else see a better way of tackling this before I amend #139? cc @KingOfBrian

ZevEisenberg commented 9 years ago

Could also have a UI test target and a non-UI test target, and name them accordingly.

seanoshea commented 9 years ago

That would work too I think. Assuming I understand, that would mean:

  1. Renaming RZUtilsTestApp to RZUtilsTestUIApp and update the targets associated with it accordingly. The tests I added for testing auto layout constraints would live in this test app & target.
  2. Renaming the RZUtilsTest target to RZUtilsNonUITests. The RZBlockKVOTests file would remain part of this target.
  3. Continue using the RZUtilsAllTests aggregate target for running the unit tests on the command line.

RZUtilsTestAppTests is somewhat confusing as it is, but changing it to RZUtilsTestUIAppTests might make it a little more obvious as to what the target is testing? Open to other suggestions if you think I've got the wrong end of the stick with your last comment @ZevEisenberg

seanoshea commented 9 years ago

Or, it looks like you've named it RZHostApp in https://github.com/Raizlabs/RZUtils/commit/96868b547c0680c439a9e9bb8bd827c8c0066590 @ZevEisenberg

Genuinely don't have strong feelings on this from a naming perspective. Just wanted to add some unit tests to an awesome utils library.

seanoshea commented 9 years ago

If you prefer the name RZHostApp in the https://github.com/Raizlabs/RZUtils/pull/150 pull request, I'd be happy to reopen this pull request with the tests for auto-layout included in the differently named app.

Otherwise, anyone have any better ideas for naming here?

ZevEisenberg commented 9 years ago

@seanoshea I don't mind what it's called. I'm also probably going to redo that image tinting code at some point, or stick it in a different library, so don't worry about maintaining compatibility with that PR.

seanoshea commented 9 years ago

@ZevEisenberg - OK, I'll go ahead with the rename I mentioned on May 12th and update the PR.

seanoshea commented 9 years ago

@ZevEisenberg - renamed the test app. Here's the output:

[Info] Loading settings for scheme 'RZUtilsAllTests' ... (936 ms)

=== BUILD ===

  xcodebuild build RZUtilsAllTests
    RZUtilsTests / RZUtilsAllTests (Debug)
      ~ Check dependencies (30 ms)
      ~ Run custom shell script 'Run Script' (16538 ms)
--------------------------------------------------------------------------------
[Info] Loading settings for scheme 'RZUtilsTests' ... (1118 ms)

=== TEST ===

  xcodebuild build build
    Pods / Pods-RZUtils (Debug)
      ~ Check dependencies (265 ms)
      ~ Compile CAAnimation+RZBlocks.m (2772 ms)
      ~ Compile NSAttributedString+RZExtensions.m (2349 ms)
      ~ Compile NSDate+RZExtensions.m (2790 ms)
      ~ Compile NSDictionary+RZExtensions.m (2755 ms)
      ~ Compile NSObject+RZBlockKVO.m (2713 ms)
      ~ Compile NSString+RZStringFormatting.m (2750 ms)
      ~ Compile NSString+RZStringSize.m (2739 ms)
      ~ Compile NSUndoManager+RZBlockUndo.m (2752 ms)
      ~ Compile Target Support Pods-RZUtils-dummy.m (206 ms)
      ~ Compile RZAnimatedCountingLabel.m (314 ms)
      ~ Compile RZAnimatedImageView.m (222 ms)
      ~ Compile RZButtonView.m (193 ms)
      ~ Compile RZCollectionTableView.m (314 ms)
      ~ Compile RZCollectionTableViewCell.m (289 ms)
      ~ Compile RZCollectionViewAnimationAssistant.m (198 ms)
      ~ Compile RZCommonUtils.m (100 ms)
      ~ Compile RZDelayedOperation.m (254 ms)
      ~ Compile RZDispatch.m (100 ms)
      ~ Compile RZLocationService.m (393 ms)
      ~ Compile RZProgressView.m (268 ms)
      ~ Compile RZRevealViewController.m (408 ms)
      ~ Compile RZSegmentViewController.m (277 ms)
      ~ Compile RZSingleChildContainerViewController.m (276 ms)
      ~ Compile RZSplitViewController.m (287 ms)
      ~ Compile RZTelprompt.m (215 ms)
      ~ Compile RZViewControllerTransitioningContext.m (194 ms)
      ~ Compile RZViewFactory.m (198 ms)
      ~ Compile Test RZWaiter.m (150 ms)
      ~ Compile RZWebViewController.m (296 ms)
      ~ Compile UIAlertView+RZCompletionBlocks.m (188 ms)
      ~ Compile UIColor+RZExtensions.m (135 ms)
      ~ Compile UIFont+RZExtensions.m (104 ms)
      ~ Compile UIImage+RZAverageColor.m (114 ms)
      ~ Compile UIImage+RZResize.m (103 ms)
      ~ Compile UIImage+RZSnapshotHelpers.m (1019 ms)
      ~ Compile UIImage+RZSolidColor.m (248 ms)
      ~ Compile UIImage+RZStretchHelpers.m (154 ms)
      ~ Compile UIImageView+RZAXMaintainImageColors.m (273 ms)
      ~ Compile UIView+RZAutoLayoutHelpers.m (260 ms)
      ~ Compile UIView+RZBorders.m (227 ms)
      ~ Compile UIView+RZFrameUtils.m (184 ms)
      ~ Compile UIViewController+RZKeyboardWatcher.m (149 ms)
      ~ Create static library libPods-RZUtils.a (141 ms)
      0 errored, 0 warning (4861 ms)

    Pods / Pods (Debug)
      ~ Check dependencies (0 ms)
      ~ Compile Target Support Pods-dummy.m (73 ms)
      ~ Create static library libPods.a (8 ms)
      0 errored, 0 warning (89 ms)

    RZUtilsTests / RZUtilsTests (Debug)
      ~ Check dependencies (1 ms)
      ~ Write auxiliary files (0 ms)
--------------------------------------------------------------------------------
/bin/mkdir -p /Users/Sean/Library/Developer/Xcode/DerivedData/RZUtilsTests-dbhiipqvlbiauofglqlciwprhzre/Build/Intermediates/PrecompiledHeaders/RZUtilsTests-Prefix-bodrzkenuipmetcwueyyxsbmoenq
write-file /Users/Sean/Library/Developer/Xcode/DerivedData/RZUtilsTests-dbhiipqvlbiauofglqlciwprhzre/Build/Intermediates/PrecompiledHeaders/RZUtilsTests-Prefix-bodrzkenuipmetcwueyyxsbmoenq/RZUtilsTests-Prefix.pch.pch.hash-criteria
--------------------------------------------------------------------------------
      ~ Run custom shell script 'Check Pods Manifest.lock' (53 ms)
      ~ Precompile Supporting RZUtilsTests-Prefix.pch (1452 ms)
      ~ Compile RZAutoLayoutTests.m (191 ms)
      ~ Compile RZBlockKVOTests.m (223 ms)
      ~ Link RZUtilsTests (404 ms)
      ~ Generate RZUtilsTests.xctest.dSYM (170 ms)
      ~ Run custom shell script 'Copy Pods Resources' (83 ms)
--------------------------------------------------------------------------------
building file list ... done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
--------------------------------------------------------------------------------
      ~ Touch RZUtilsTests.xctest (6 ms)
      0 errored, 0 warning (2469 ms)

  [Info] Collecting info for testables... (3864 ms)
  run-test RZUtilsTests.xctest (iphonesimulator8.4, logic-test)
    ~ -[RZAutoLayoutTests testMultipleLevels] (83 ms)
    ~ -[RZAutoLayoutTests testParentChildAndUnrelated] (0 ms)
    ~ -[RZAutoLayoutTests testParentChildOrder1] (0 ms)
    ~ -[RZAutoLayoutTests testReturnsSingleView] (0 ms)
    ~ -[RZAutoLayoutTests testTwoUnrelatedViews] (0 ms)
    ~ -[RZBlockKVOTests testObservation] (0 ms)
    ~ -[RZBlockKVOTests testObserverDeallocation] (0 ms)
    ~ -[RZBlockKVOTests testObserverRemoval] (0 ms)
    8 passed, 0 failed, 0 errored, 8 total (87 ms)

** TEST SUCCEEDED: 8 passed, 0 failed, 0 errored, 8 total ** (14387 ms)
--------------------------------------------------------------------------------
      ~ Run custom shell script 'Run Script' (60116 ms)
--------------------------------------------------------------------------------
[Info] Loading settings for scheme 'RZUtilsTestApp' ... (1197 ms)

=== TEST ===

  xcodebuild build build
    Pods / Pods-RZUtils (Debug)
      ~ Check dependencies (161 ms)
      ~ Compile CAAnimation+RZBlocks.m (2721 ms)
      ~ Compile NSAttributedString+RZExtensions.m (2716 ms)
      ~ Compile NSDate+RZExtensions.m (1650 ms)
      ~ Compile NSDictionary+RZExtensions.m (2720 ms)
      ~ Compile NSString+RZStringFormatting.m (2769 ms)
      ~ Compile NSObject+RZBlockKVO.m (2785 ms)
      ~ Compile NSString+RZStringSize.m (2712 ms)
      ~ Compile NSUndoManager+RZBlockUndo.m (2726 ms)
      ~ Compile Target Support Pods-RZUtils-dummy.m (54 ms)
      ~ Compile RZAnimatedCountingLabel.m (119 ms)
      ~ Compile RZAnimatedImageView.m (102 ms)
      ~ Compile RZButtonView.m (96 ms)
      ~ Compile RZCollectionTableView.m (184 ms)
      ~ Compile RZCollectionTableViewCell.m (148 ms)
      ~ Compile RZCollectionViewAnimationAssistant.m (96 ms)
      ~ Compile RZCommonUtils.m (61 ms)
      ~ Compile RZDelayedOperation.m (81 ms)
      ~ Compile RZDispatch.m (79 ms)
      ~ Compile RZLocationService.m (361 ms)
      ~ Compile RZProgressView.m (250 ms)
      ~ Compile RZRevealViewController.m (464 ms)
      ~ Compile RZSegmentViewController.m (245 ms)
      ~ Compile RZSingleChildContainerViewController.m (281 ms)
      ~ Compile RZSplitViewController.m (269 ms)
      ~ Compile RZTelprompt.m (140 ms)
      ~ Compile RZViewControllerTransitioningContext.m (171 ms)
      ~ Compile RZViewFactory.m (297 ms)
      ~ Compile Test RZWaiter.m (173 ms)
      ~ Compile RZWebViewController.m (281 ms)
      ~ Compile UIAlertView+RZCompletionBlocks.m (248 ms)
      ~ Compile UIColor+RZExtensions.m (262 ms)
      ~ Compile UIFont+RZExtensions.m (206 ms)
      ~ Compile UIImage+RZAverageColor.m (196 ms)
      ~ Compile UIImage+RZResize.m (126 ms)
      ~ Compile UIImage+RZSnapshotHelpers.m (735 ms)
      ~ Compile UIImage+RZSolidColor.m (124 ms)
      ~ Compile UIImage+RZStretchHelpers.m (161 ms)
      ~ Compile UIImageView+RZAXMaintainImageColors.m (212 ms)
      ~ Compile UIView+RZAutoLayoutHelpers.m (264 ms)
      ~ Compile UIView+RZBorders.m (232 ms)
      ~ Compile UIView+RZFrameUtils.m (168 ms)
      ~ Compile UIViewController+RZKeyboardWatcher.m (218 ms)
      ~ Create static library libPods-RZUtils.a (32 ms)
      0 errored, 0 warning (4170 ms)

    Pods / Pods (Debug)
      ~ Check dependencies (0 ms)
      ~ Compile Target Support Pods-dummy.m (76 ms)
      ~ Create static library libPods.a (7 ms)
      0 errored, 0 warning (91 ms)

    RZUtilsTests / RZUtilsTests (Debug)
      ~ Check dependencies (1 ms)
      ~ Write auxiliary files (0 ms)
--------------------------------------------------------------------------------
/bin/mkdir -p /Users/Sean/Library/Developer/Xcode/DerivedData/RZUtilsTests-dbhiipqvlbiauofglqlciwprhzre/Build/Intermediates/PrecompiledHeaders/RZUtilsTests-Prefix-aannaygijdsnrnfvdlowimkaofdf
write-file /Users/Sean/Library/Developer/Xcode/DerivedData/RZUtilsTests-dbhiipqvlbiauofglqlciwprhzre/Build/Intermediates/PrecompiledHeaders/RZUtilsTests-Prefix-aannaygijdsnrnfvdlowimkaofdf/RZUtilsTests-Prefix.pch.pch.hash-criteria
--------------------------------------------------------------------------------
      ~ Run custom shell script 'Check Pods Manifest.lock' (35 ms)
      ~ Precompile Supporting RZUtilsTests-Prefix.pch (1453 ms)
      ~ Compile RZAutoLayoutTests.m (185 ms)
      ~ Compile RZBlockKVOTests.m (222 ms)
      ~ Link RZUtilsTests (678 ms)
      ~ Generate RZUtilsTests.xctest.dSYM (182 ms)
      ~ Run custom shell script 'Copy Pods Resources' (62 ms)
--------------------------------------------------------------------------------
building file list ... done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
--------------------------------------------------------------------------------
      ~ Touch RZUtilsTests.xctest (6 ms)
      0 errored, 0 warning (2715 ms)

    RZUtilsTests / RZHostApp (Debug)
      ~ Check dependencies (0 ms)
      ~ Compile RZHostAppDelegate.m (1510 ms)
      ~ Compile main.m (1338 ms)
      ~ Link RZHostApp (71 ms)
      ~ Generate RZHostApp.app.dSYM (106 ms)
      ~ Touch RZHostApp.app (6 ms)
      0 errored, 0 warning (1714 ms)

    RZUtilsTests / RZHostAppTests (Debug)
      ~ Check dependencies (33 ms)
      ~ Compile RZAutoLayoutHelpersTest.m (1767 ms)
      ~ Link RZHostAppTests (68 ms)
      ~ Generate RZHostAppTests.xctest.dSYM (152 ms)
      ~ Touch RZHostAppTests.xctest (6 ms)
      0 errored, 0 warning (2048 ms)

  [Info] Collecting info for testables... (3682 ms)
  run-test RZHostAppTests.xctest (iphonesimulator8.4, application-test)
    [Info] Installed 'RZ.RZHostApp'. (36231 ms)
    [Info] Launching test host and running tests ... (0 ms)
    ~ -[RZUtilsTestAppTests testCenteringViews] (8 ms)
    ~ -[RZUtilsTestAppTests testCenteringWithOffsetViews] (1 ms)
    ~ -[RZUtilsTestAppTests testPinningViews] (1 ms)
    3 passed, 0 failed, 0 errored, 3 total (12 ms)

** TEST SUCCEEDED: 3 passed, 0 failed, 0 errored, 3 total ** (57814 ms)
--------------------------------------------------------------------------------
      0 errored, 0 warning (76699 ms)

** BUILD SUCCEEDED ** (77555 ms)