Build and Execute Xamarin.iOS Unit Test from Command Line

DinashDinash INMember
edited December 2016 in Xamarin.iOS

I have been trying to run the iOS unit test from command line. I am using Xamarin Studio on Mac for now, I Created a iOS Unit test project as follows

Add New Project --> iOS --> Tests --> Unit Test App

And added a simple Unit test class and its code snippets as shown below:

using System;
using NUnit.Framework;

namespace iOSUnitTest
    public class iOSTestSample
        public iOSTestSample()

        public void MySampleTest() {

        public void MyFailerTest()

From Xamarin Studio, I am able to run the application which deploys a app into simulator and execute the test cases. I am trying to automate it through a script.

Till now, I am able to get the Unit Test project build and install the app into the running simulator.

I am not sure how to automate the unit test execution once the app is installed.


  • DinashDinash INMember

    Found Blog on Building Xamarin App with Atlansian Bamboo - which covers how we can automate iOSUnitTest Project, It really helped.

    Used Touch.Server which can be checkout from Touch.Server Github Link

    And using below Command, was able to have the iOSUnitTest project being automated.

    mono --debug path/to/Touch.Server.exe \ --launchsim path/to/project/Debug/ \ -autoexit \ -logfile=test-reports/TestProject.xml

    Also Refer

  • JoaoSilva.7604JoaoSilva.7604 GBUniversity ✭✭

    Hi @Dinash,

    Can you tell me how did you accomplish this?
    I did exactly as you said on the first post.
    I've already generated the Touch.Server.exe file and now I'm trying to use but I don't understand what and where is the *.app file... how do you get to generate it? is it from the ios unit test project?

    Thanks in advance

  • JoaoSilva.7604JoaoSilva.7604 GBUniversity ✭✭

    Got it, .app is the directory.
    Now I'm getting this:
    [mtouch stderr 17:04:51] warning MT0061: No specified (using --sdkroot), using the system Xcode as reported by 'xcode-select --print-path': /Applications/
    [mtouch stderr 17:04:52] error MT1212: Failed to create a simulator where type = SimDeviceType : and runtime = SimRuntime : 10.3 (14E269) -
    [mtouch stderr EOS]
    [mtouch stdout EOS]
    [12/04/2017 17:04:53] : System.Net.Sockets.SocketException (0x80004005): interrupted
    at System.Net.Sockets.Socket.Accept () [0x00039] in :0
    at System.Net.Sockets.TcpListener.AcceptTcpClient () [0x00016] in :0
    at SimpleListener.Start () [0x00003] in :0

    Do you have any idea?


  • JoaoSilva.7604JoaoSilva.7604 GBUniversity ✭✭

    Nvm, was missing, on the properties of the Touch.Server.exe

  • Hello @JoaoSilva.7604
    I am getting a similar error to what you were getting. I have tried passing in the device and device type but still getting the same error.

    mono --debug /Users/nareshthandu/Downloads/Touch.Unit-master/Touch.Server/bin/Debug/Touch.Server.exe --launchsim .app \ \ -autoexit \ -logfile=testresults_sim.log \ -verbose

    Can you please highlight if I am doing anything wrong.


Sign In or Register to comment.