Running appium scripts for ios in parallel - ios

I have two mac machines with all the setup installed for appium. I want to run the appium scripts on two ios simulators in parallel.It is not possible in one mac machine by launching two simulators in parallel because mac uses only one instrument instance at a time.
Is there any way to approach this by using two machines?
Thanks.

For android you can run two emulators in parallel, So u can establish two appium sessions and run the scripts in parallel.But coming to ios xcode won't allow you to run the simulators in parallel.

You could use the Selenium grid to handle your two machines, as instructed at https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/grid.md
Otherwise you'll need to create a driver session against each of the servers in your script. To target a specific Appium server, simply change the url:port combination to match either of your servers when creating the Appium webdriver object/session.

As of now,
http://appium.io/docs/en/advanced-concepts/parallel-tests/
"With Xcode9 Appium supports parallel RealDevice and Simulator testing." for iOS

Related

I am using appium.app on mac how to open more than one session to run with different ports

I want to run the appium with different ports i am using appium.app on mac desktop.how to run with different ports any ideas..?
What do you mean to run appium with different ports? In case you're using the app, you set the port before you start the server.
In case you meant to run multiple appium sessions with different ports, I've installed appium using npm and then started my servers from command line
I guess you are talking about attaching more than one device and then executing the scripts in parallel on all devices like the selenium grid.
You can go through this link, which is appum's official documentation for setting up selenium grid for mobile automation.

Opening multiple appium server Instances on same machine

Can I start 2 appium server instances on my machine at the same time so that I can execute my test script simultaneously on 2 different devices connected to the machine?
Actually what I'm trying is to run my test script on 2 devices connected to same windows machine. For this I am using TestNG to pass the Android Driver url to start session. This url will be dynamic as 2 devices will be using 2 Appium server instances. Can I create 2 instances of Appium server at same time? If so then can I use code to create those instances as I don't want to use GUI to start it.
This question has already been asked and answer (if I am reading what you want correctly).
Please refer to How to start the Appium server from command prompt in MAC machine?
On a windows machine there should be an appium executable which you run with the command line arguments --address 127.0.0.1 -p 4273
In essence all you need to do is use a different port for your tests.

I want to make a Test Lab setup for Appium

I want to make a Test Automation Lab for Appium (Android & iOS)
Questions:
1. As per Appium limitation we can access Single device (ios) from Machine.
In this case If I connect multiple Ios/Android devices to MAC machine (Server) how I can access from other machine ?
If I make Windows machine as a server Can I access and Run scripts from MAC machine?
You can use the selenium grid with Appium to do that. parallel test with appium & selenium grid
you have to add the appium in environment variable
start the grid
start the node which you want then run in parallel
You can go for sauce labs, Sauce Labs allows users to run tests in the cloud on more than 500 different browser platform, operating system and device combinations, providing a comprehensive test infrastructure for automated and manual testing of desktop and mobile applications using Selenium, Appium and JavaScript unit testing frameworks.
https://saucelabs.com/

Using Selenium with ios-driver to test iOS mobile apps from a Windows machine

I am investigating the feasibility of testing native, hybrid, and web-based applications using Selenium for Windows (web only), Android, and iOS mobile devices (e.g. iPad).
The ideal setup for a tester would be a Windows machine with physical devices connected via USB. This works with Android as all that is needed (excluding the ADK and USB driver setup) is Selendroid's stand-alone server and a JAR dependency. However, from my understanding, this is not possible with iOS mobile devices using ios-driver. I have also checked out Appium, and they too state that a Mac computer would be needed to test iOS devices.
So that brings us to my question: Is there a way to test iOS mobile apps (web, hybrid, native) from a Windows machine?
Here is a list of preferences:
- Use Selenium and other Selenium-compatible plug-ins
- Run tests from Windows machine
- Cannot use iOS VM
- Cannot use Mac machine with "middle-man" application to communicate with Windows machine
- Have to test physical mobile devices
- No "hacks" (e.g. Jailbreaking)
It is also safe to assume that I have no experience developing iOS applications.
It is possible to run the tests from a Windows machine but not the way you are probably thinking. You will still need a Mac. Here are the requirements:
A mac on your network with Appium server running
Has Appium environment installed properly
Has the .app on the machine
If you have these three requirements fulfilled and there is no firewall blocking network access to the Mac then you can do it. You will have to actual tests on the Windows machine but instead of specifying 127.0.0.1:8080 in the setup method as the IP address of Appium server you will replace it with this: yourmacsipaddress:8080 and this should execute the test properly.
Remember that you have to specify the path of the .app in the test which is running from your Windows machine. But the catch is that the path has to be the path of the .app in the Mac and not on your Windows machine.
So the tests will run from your Windows machine but the installation of the app, the automation, and the testing will be done on the Mac but you will get the "pass" or "fail" update on your Windows machine.
If you do not want to set up appium in your local machine, You can also go with sauce lab.
sauce lab provide vm to you. select appropriate device and run using appiumDriver. Provide below capabilty and run using appiumDriver. your remote url will be like this
http://your_username:your_access_key#ondemand.saucelabs.com:80/wd/hub
For iOS Native,
{"driver.class":"io.appium.java_client.ios.IOSDriver","platformName":"iOS","browserName":"","platformVersion":"your os version","deviceName":"device Name","appiumVersion":"1.5.3","app":"sauce-storage:Your application name on sauce storage"}
Your application should be available on sauce storage. You can upload using sauce api .
You can also use this same for web application, android/ ios native application.

TeamCity fails to run iOS appium tests when auto-launched

Description
We are using appium in our cucumber suite within TeamCity 8 on an Apple MacMini running Mavericks. The problem is that appium seems to fail to interact with the iOS Simulator when it is ran from TeamCity at login (via Automator).
The only combination that I have found to work is to run the following from the Terminal in an interactive session:
sh /Applications/buildagent/bin/agent.sh start
What does not work?
running agent.sh start from an ssh session
creating a shell script with Automator that launches at login (the macmini is set to login automatically)
Theory
My theory is that it has something to do with Preferences -> Security & Privacy -> Accessibility. The only way that it works when launching from Terminal is if Terminal is added to this list of allowed applications. I'm not sure what I need to add to this list in order for this to work automatically at login.
Any help would be greatly appreciated.
Many iOS tests will not run without an interactive session. For example, unit tests using the iOS simulator will not work.
Edit: By interactive session, I mean the TeamCity agent must be started from the desktop, not via an SSH session. Otherwise nothing can communicate with the Simulator.
You are correct, you need to allow Appium to interact with Automator.
Solutions straight from the documentation:
If you're running Appium from an NPM install: sudo authorize_ios
If you're running Appium from source: sudo grunt authorize
If you are running Appium.app, you can authorize iOS through the GUI. This prompt pops up the first time you click "Launch/Run" on the GUI and it tries to open the simulator

Resources