0

I added SKTestSession in my UI tests and it loads my .storekit file ok, at least that's what it says. But my store related code cannot be tested because SKProductsRequest never succeeds nor fails. Looks like it doesn't work at all. I use Xcode 12 GM atm.

Here's my code in UI tests' setUpWithError():

if session == nil {
    do {
        session = try SKTestSession(configurationFileNamed: "StoreConfiguration")
    } catch (let e) {
        print("Error: \(e)")
    }
}

Where session is a varin my test class.

When I just run project with .storekit set up in scheme it works just OK. But fails when it comes to UI tests.

So, how to make SKTestSession work in my UI tests?

silvansky
  • 2,426
  • 2
  • 19
  • 20
  • What does "never succeeds nor fails. Looks like it doesn't work at all" mean? – matt Sep 16 '20 at 14:03
  • This means that request starts but never calls it's delegate methods. Thanks, will upd the post. – silvansky Sep 16 '20 at 14:51
  • Well, you have not shown code for "request starts" or "delegate methods" so it's hard to assess what the problem is. – matt Sep 16 '20 at 14:55
  • Thanks a lot man! Double checked and found that I never implemented the `request:didFailWithError:` method! And it is called now with a strange error which I will ask about in the another question. – silvansky Sep 16 '20 at 15:00
  • I've discovered that StoreKit testing works only when building unit and UI tests with Debug configuration and refuses to work when building with Release or Profile configurations. – Andriy Nov 23 '20 at 11:51

1 Answers1

1

My bad: I never implemented SKProductsRequestDelegate's method request:didFailWithError: so I got no error. Now I get the error and gonna post another question about it.

silvansky
  • 2,426
  • 2
  • 19
  • 20