Appium iOS testing with Visual Studio/C#

Hello. I just started looking into Appium and managed to set up and Android emulator (SDK) in my VM on Macbook Pro. Now I need to set up iOS environment. The more I think about it, the more confused I become. I have two main questions:

  1. How do I set up Appium with iOS to be used with C#/Visual Studio?
  2. Can I use same setup to develop tests for Android and iOS (obviously tests will run on either different devices or emulators)?

I hope that some of the current API that we wrote for web app testing using C# selenium webdriver can be utilized as well to create a code base that is easier to maintain.

Please assist and be as detailed as possible since I am new to this and might not be able to trace the train of thought if some steps are omitted.

THANK YOU VERY MUCH IN ADVANCE!!!

Hi @TAXIyellow!

It is possible to develop tests with C# and Appium. There is appium-dotnet-driver. But I think it should be actualized. I think it would be good if it become the similar as java-client. In order to improve this situation I am trying to implement something (a bit per day). It is possible that something will be proposed as a pull request soon.

Оk!

I think there are two ways.

This first way is to launch your tests from Windows (!!!). There should be a real Mac or virtual machine (like I do :smile: ) where Appium server is launched. So you should define URL of the Mac remote host in your test and you will start your tests remotely.

The second way is to use Xamarin Studio on Mac instead of Visual Studio. But… actually I don’t know how it works with Appium tests. I have found out it recently too :smile: )

You can do it. But some problems should be solved. I have mentioned it above.

Can somebody advise something better for now?

Hi @SergeyTichomirov . Thank you very much for your reply. Can you please give me an example of “you should define URL of the Mac remote host in your test and you will start your tests remotely” is done?

I am working on macbook pro and have a windows VM. My Visual Studio is on VM. I can instal and run Appium on Mac for iOS. What do I do from that point (example of a URL would be appreciated as well).

Thank you in advance!

Please look a samples. I think you’ll find all that you need here.

Thank you @SergeyTichomirov. I will take a look at those and will try to set it up this week. If I will have problems I hope you will be willing to answer my questions:) Thanks again.

Ok! If you find some problems it possible that they will have been fixed by the moment you will notify me. I am going to propose something as a pull request on this week. :wink:

Hi @SergeyTichomirov. I installed Appium and XCode on my mac and trying to run code from VIsual Studio on VM, but to no success so far. The error that I get, as to be expected, is below. Server’s address and port in General Settings of the Appium on Mac are the same as in AppiumServers.cs class (127.0.0.1:4723). Please assist.

SetUp : OpenQA.Selenium.WebDriverException : Unexpected error. System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:4723
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
— End of inner exception stack trace —
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)

I think I managed. Just needed to put correct IP address instead of default “local” one. Thank you for the help:)

Yeah! You are right. I have just wanted to answer you, but you could work out the problem before. :smiley:

Hi @SergeyTichomirov
Have you tried this?

Thanks!

No. I haven’t tried it yet. There is no need for me now.

hi, how can know what’s the IP address of my server located on a virtual machine?

Hello TAXIyellow,

Could you please provide the steps for automating iOS and android apps on mac environment with Visual studio/C#.

Thanks in advance