0

I've got following solution for white-box tests:

  • Typhoon - DI framework
  • KIF - tool for interacting with UI

To test every single important edge case, i sometimes have to "stub" response from backend. I made it by patching component ( here is full description how it's done:How to inject fake, stubbed or mock dependencies for Integration tests using Typhoon )

so

in beforeAll method in KIFTestCase, HTTPClient was patched into FakeHTTPClient, and it gave me possibility to swap responses for particular requests.

project architecture

Production code for app, was refactored in most critical places, but in some places i had to use defaultAssembly to get dependencies from graph, so almost every Assembly in app is now deafultAssembly.

And of course there are dependencies with scope TyphoonScoopeSingleton.

problem:

After patching httpClient, those components with scope Singleton, are "refreshed" - init was called once again.

If i want to dynamically replace components in graph, for instance in beforeAll method, it is possible to do it with Typhoon without "refreshing" dependencies with scope Singleton?

Community
  • 1
  • 1
user3292998
  • 209
  • 1
  • 8
  • From memory, I don't think it is possible to avoid reloading singletons, without a code-change to Typhoon. Even then, depending on what is being patched, the effected object graph would have to be reloaded. – Jasper Blues May 04 '16 at 14:13
  • @JasperBlues thanks for fast reply. Do you have any advice how to fix that? – user3292998 May 04 '16 at 18:02

0 Answers0