NEW: Start my new Ultimate Portfolio App course with a free Hacking with Swift+ trial! >>

How do I make unit tests for watchOS app?

Forums > watchOS

How do I make unit tests for watchOS app? From what I found for now I know that XCTest framework doesn't support watchOS and WatchKit currently. However, maybe are there any workarounds for that problem to test at least some code? I would like to test app with SwiftUI interface and lifecycle.

   

@Malauch did you have any luck with this? I am having the same problem.

   

@twostraws  Site AdminHWS+

This become possible literally yesterday – watchOS unit tests are now supported in Xcode 12.5 beta!

1      

@Malauch, @alfielefeuvre did you succeed in making WatchOs unit tests with Xcode 12.5 ?

I tried to make a very simple dummy test

import XCTest

class BaseTestCase: XCTestCase {

    func testDummy() {
        XCTAssertTrue(1 == 1)
    }

}

Then, change the active scheme to the WatchKit ExtensionTests scheme

But, everytime I run the test, I have an XCode crash - Xcode quit unexpectedly

Do you have the same issue?

   

Hacking with Swift is sponsored by Instabug

SPONSORED Catch bugs as soon as they happen and know exactly why a crash occurred. Instabug's SDK grabs all the logs they need to fix bugs, crashes and performance issues in minutes instead of days. Get screenshots, device details, network logs, repro steps, and tons of other critical insights needed to resolve issues and prioritize product backlogs straight from your dashboard. It only takes a minute to integrate!

Get started now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.