I have an app that's starting to grow beyond my abilities to test manually every time I make changes to it (yes, I should probably have added tests from the
beginning, but at the time I was new to Mac/Xcode/Swift and you can't learn everything at once; for a c# developer it's quite a culture shock... it still is!). So, I've added a test class and tried to call one of the methods that my UI uses but that method makes the following call so that it can get access to a table view controller (for example), so I need to load the UI somehow:
let del = NSApplication.shared().delegate as! AppDelegate
I tried adding the following to my setUp() method (which I just copied from main.swift):
_ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
But the UI just loads and then sits there; nothing happens. So when I quit the UI everything finishes and the test that I ran in the first place seemingly never gets called.
My question is: how do I go about loading the UI properly for my test cases to use?
Thanks.