Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Snapshot test cases not running on xcode 9 beta #233

Open
rz-robsn opened this issue Jul 19, 2017 · 0 comments
Open

Snapshot test cases not running on xcode 9 beta #233

rz-robsn opened this issue Jul 19, 2017 · 0 comments

Comments

@rz-robsn
Copy link

rz-robsn commented Jul 19, 2017

Hi there,

I wanted to run snapshot test cases on a simple new project created with Xcode 9 beta 3.

The project includes both XCTestCase test cases and FBSnapshotTestCase test cases. The problem is that when I run all the tests of the test target, only the XCTestCase test cases are ran (a bug very similar to #229). The only project setting I changed after I created, aside from adding the FBSnapshotTestCase dependency as a pod, was setting the deployment target to 9.0

Here is my test suite :

import XCTest
@testable import SnapshotTest

class SnapshotTestTests: XCTestCase {
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    func testExample() {
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }
    
    func testPerformanceExample() {
        // This is an example of a performance test case.
        self.measure {
            // Put the code you want to measure the time of here.
        }
    }
    
}

import FBSnapshotTestCase

class FBSnapshotTestCaseSwiftTest: FBSnapshotTestCase {
    override func setUp() {
        super.setUp()
        recordMode = false
    }
    
    func testExample() {
        let view = UIView(frame: CGRect(x: 0, y: 0, width: 64, height: 64))
        view.backgroundColor = UIColor.blue
        FBSnapshotVerifyView(view)
        FBSnapshotVerifyLayer(view.layer)
    }
}

and below are the test execution logs :

Test Suite 'All tests' started at 2017-07-18 22:06:24.584
Test Suite 'FBSnapshotTestCase.framework' started at 2017-07-18 22:06:24.586
Test Suite 'FBSnapshotTestCase.framework' passed at 2017-07-18 22:06:24.586.
	 Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
Test Suite 'SnapshotTestTests.xctest' started at 2017-07-18 22:06:24.587
Test Suite 'SnapshotTestTests' started at 2017-07-18 22:06:24.587
Test Case '-[SnapshotTestTests.SnapshotTestTests testExample]' started.
Test Case '-[SnapshotTestTests.SnapshotTestTests testExample]' passed (0.001 seconds).
Test Case '-[SnapshotTestTests.SnapshotTestTests testPerformanceExample]' started.
/Users/robsonrazafindramary/projects/SnapshotTest/SnapshotTestTests/SnapshotTestTests.swift:33: Test Case '-[SnapshotTestTests.SnapshotTestTests testPerformanceExample]' measured [Time, seconds] average: 0.000, relative standard deviation: 163.118%, values: [0.000004, 0.000001, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000], performanceMetricID:com.apple.XCTPerformanceMetric_WallClockTime, baselineName: "", baselineAverage: , maxPercentRegression: 10.000%, maxPercentRelativeStandardDeviation: 10.000%, maxRegression: 0.100, maxStandardDeviation: 0.100
Test Case '-[SnapshotTestTests.SnapshotTestTests testPerformanceExample]' passed (0.257 seconds).
Test Suite 'SnapshotTestTests' passed at 2017-07-18 22:06:24.848.
	 Executed 2 tests, with 0 failures (0 unexpected) in 0.258 (0.260) seconds
Test Suite 'SnapshotTestTests.xctest' passed at 2017-07-18 22:06:24.849.
	 Executed 2 tests, with 0 failures (0 unexpected) in 0.258 (0.262) seconds
Test Suite 'All tests' passed at 2017-07-18 22:06:24.849.
	 Executed 2 tests, with 0 failures (0 unexpected) in 0.258 (0.265) seconds


Test session log:
	/var/folders/mk/23vxwvgs54x4vd34p400q4kc0000gq/T/com.apple.dt.XCTest/IDETestRunSession-F1D1A1C0-60B5-4DCB-8AE1-6D581FB8319B/SnapshotTestTests-E599428C-6562-42FB-ACFF-D5A30C902227/Session-SnapshotTestTests-2017-07-18_220623-UqyHEr.log

Program ended with exit code: 0

The problem seems to be xcode 9 specific. I tried reproducing the same error by creating another project on XCode 8.3.3 and the snapshot test cases ran fine.

The version of cocoapods I used was 1.2.1. You can find an zip of the project here

That's it, let me know if you have any questions !

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant