Don't Launch Simulator When Running Unittests

OCUnit: How to run tests without launching iPhone simulator?

How much time/resources? Rather than focusing on reducing those, I'd focus on expanding your tests to go far beyond Apple's original "Logic Test" guidelines. Those guidelines were limiting, and written before Xcode 4. Now you can write tests without thinking, "Is this a logic test or an application test?" -- just test everything.

Is there any way to run unit tests for swift without having to actually run the application

Jon Reid wrote a good blog post about not running the application when running unit tests: http://qualitycoding.org/app-delegate-for-tests/.

The idea is basically replacing the App Delegate in main.swift for an
"empty" App Delegate when you run the tests target, so you don't run any application logic when running the tests.

Disable simulator in SwiftUI unit test

Is there any way to disable the simulator when running non-UI unit tests?

The way I do that is to put all my business logic code and its unit tests into a framework. Xcode tests a framework without loading the app target, so the Simulator is not involved.

iOS could not launch simulator when use jenkins to run test

after my google, i found the result, can not launch the simulator is because jenkins is daemon, running in the background ,and can not render anything in front.

but we want to use jenkins to run our UnitTest and UITest , we must run the simulator, so we should change jenkins to a real user, and login in jenkins user.

i found a great blog which show how to do it step by step :
http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/

after you finish that , then you can run test on simulator using jenkins, wish this can help anyone has the same question.

Testing without simulator using xctool

Figured this out, this post helped.

My test case set up method initialized the storyboard like this

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:DEVMainStoryboardName 
bundle:nil];

Problem was passing nil to the bundle parameter, that uses the main bundle which is not what is used in the test target -- so you have to specify that you want to use the test bundle by writing

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:DEVMainStoryboardName 
bundle:[NSBundle bundleForClass:[self class]]];

Then don't forget to include the storyboard as a member of the target.

iOS tests will not run on simulator when using Jenkins through JNLP

I still see the error messages, but I was able to get Jenkins to run my unit tests. Here are the steps that worked for me:

  1. Reboot the remote machine
  2. Start the Xcode app from Finder
  3. Quit Xcode
  4. Run Jenkins test script

XCode 5 unit testing: starts my app

You are running application test, not logic test. This means an instance of your app will be started and then run the unit tests. This allow you to perform some integration test that require your app is running.

Here is the guide to setup application test and logic test.

If you want to change it to logic test (so it run faster and don't need to start your app first):

  1. go to build settings for your unit test target
  2. search Bundle
  3. remove Bundle Loader and Test Host

Sample Image



Related Topics



Leave a reply



Submit