Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Builds fails when trying to use Swifter in XCUITest #525

Open
bartekpacia opened this issue Jul 22, 2022 · 3 comments
Open

Builds fails when trying to use Swifter in XCUITest #525

bartekpacia opened this issue Jul 22, 2022 · 3 comments

Comments

@bartekpacia
Copy link

bartekpacia commented Jul 22, 2022

I'm trying to create a long-running server in a XCUITest test.

import XCTest
import Swifter

class AccountCenterUITests: XCTestCase {

    func testExample() throws {
        // UI tests must launch the application that they test.
        let app = XCUIApplication()
        app.launch()
        
        let server = HttpServer()
        server["/hello"] = { .ok(.htmlBody("You asked for \($0)"))  }
        try server.start()
        
        XCTAssert(true)
    }
}

However I'm getting crashes:

$ xcodebuild \
  -project AccountCenter.xcodeproj \
  -scheme AccountCenter \
  -sdk iphonesimulator \
  -destination 'platform=iOS Simulator,name=iPhone 12,OS=15.5' \
  test


2022-07-25 10:38:30.342 xcodebuild[5880:35295] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-07-25 10:38:30.343 xcodebuild[5880:35295] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
Resolve Package Graph
Resolved source packages
Swifter - https://github.com/httpswift/swifter.git @ 1.5.0
[AccountCenter] Processing Info.plist
Signing AccountCenter.app (in target 'AccountCenter' from project 'AccountCenter')
[AccountCenterUITests] Compiling AccountCenterUITests.swift
❌ Undefined symbols for architecture arm64
❌   "type metadata accessor for Swifter.HttpRequest", referenced from:
❌   "type metadata accessor for Swifter.HttpServer", referenced from:
❌   "Swifter.HttpServer.__allocating_init() -> Swifter.HttpServer", referenced from:
❌ ld: symbol(s) not found for architecture arm64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
Testing failed:
	Undefined symbol: type metadata accessor for Swifter.HttpRequest
	Undefined symbol: type metadata accessor for Swifter.HttpServer
	Undefined symbol: Swifter.HttpServer.__allocating_init() -> Swifter.HttpServer
	Testing cancelled because the build failed.

** TEST FAILED **


The following build commands failed:
	Ld /Users/bartek/Library/Developer/Xcode/DerivedData/AccountCenter-dcpwguqebomrtsafgxoihvvsrwmo/Build/Products/Debug-iphonesimulator/AccountCenterUITests-Runner.app/PlugIns/AccountCenterUITests.xctest/AccountCenterUITests normal (in target 'AccountCenterUITests' from project 'AccountCenter')
(1 failure)

What can be causing this?

@asafkorem
Copy link

@bartekpacia, have you figured it out yet?

@bartekpacia
Copy link
Author

bartekpacia commented Mar 20, 2023

Hi @asafkorem,

Unfortunately I didn't. I tried a few more libraries and ended up using Building42/Telegraph. I also saw people use swhitty/FlyingFox and be happy with it.

Here's my short story about looking for a simple, working server (for iOS UI test automation purposes - here it is):

But in the end, I migrated to gRPC, so I don't use any of the libraries I mentioned above anymore :)

PS I see that you work on Detox - great job and thanks! It inspired us a lot in Patrol :)

@asafkorem
Copy link

asafkorem commented Mar 21, 2023

@bartekpacia, I remember you and Patrol from an issue you commented on (XCUITest integration on Detox), hope everything is going well for you, and thanks for sharing your story results!

BTW, I'm using Apple's Network framework directly, https://developer.apple.com/documentation/network, it works fine, but I just wanted to consider other alternatives.

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

No branches or pull requests

2 participants