Open NahidSiddiqui opened 7 years ago
Hi, I also see similar failures and the issue is very often. Not able to find the root cause of the issue and the device IP responds to ping all the time during execution when the error occurs.
I have tried creating HOTSPOT on Mac and made the device connect to it but still no luck.
I have had the following errors repeating randomly and intermittently. Errno::ENETDOWN HTTPClient::ConnectTimeoutError Calabash::Cucumber::ServerNotRespondingError Errno::ECONNREFUSED Could not connect to Device Agent service
After going over several forums, I had done the following steps and the runs are much more stable in Jenkins now.
Use rbenv build wrapper in jenkins job setting.
Avoid using "start_test_server_in_background" command inside the test code and instead use Launcher. Below is a code snippet I use,
Before do |_scenario|
launcher = Calabash::Launcher.launcher
options = {
# Add launch options here.
}
launcher.relaunch(options)
launcher.calabash_notify(self)
sleep 2
end
After do |_scenario|
calabash_exit
end
Keep the calabash-cucumber gem version and the calabash server version as the same (0.20.4) in my case. Bringing them to the latest version suitable for your Xcode is recommended. Follow instructions here, https://github.com/calabash/calabash-ios/wiki/Updating-your-Calabash-iOS-version
Run an overnight ping check from Mac to iPhone, another computer to your Mac, to ensure stable connection. Following shell script can be run in background
nohup ping <ip/host> | while read pong; do echo "$(date): $pong"; done >>outfile.log 2>&1 &
Did the following to the Mac to have the network up and running all the time,
a. The energy saver on Mac is the biggest enemy for several timing related issues. How to turn off sleep?
i. Choose Apple menu > System Preferences, then click Energy Saver.
ii. Drag the slider that controls the computer's sleep to Never, or select “Prevent computer from sleeping automatically when the display is off” if the checkbox is available.
iii. Some times this isn't persistent across reboots. So make your own startup script to run this command
sudo systemsetup -setcomputersleep Never
b. Create a Duplicate service for your ethernet and give it a valid IP from your network. Follow instructions here, https://community.spiceworks.com/topic/576032-mac-mini-network-connection-drops
In System Preferences > Network
Select the existing Ethernet interface, and click on the gear icon down below.
Select "Duplicate Service..."
and name it Ethernet 2 (by default) or Eth-Fake-Workaround (or the like). That name is PURELY a place-holder and has no functional aspect to it at all.
Set it to a manual IP that you have available that is of course outside your DHCP range.
Leave it & record the info in your notes.
Make sure using the Gear icon again > Set Service Order...
that the actual Interface with existing working IP is listed first, and the "fake"/duplicated interface 2nd.
Test & compare.
c. Turn off Firewall in Security settings.
d. Disconnect the node from jenkins and reboot your Mac and the devices (Suggest to reboot the devices using idevicediagnostics command for a full reboot) Check if all settings show up as changed above and start your jenkins job.
@vg2jana I believe the issue you are having is due to time out when connecting with the calabash server which is different to the reason behind my issue. But thank you very very much for sharing your findings.
Well, I suggest you have a ping check between the Mac and the device. In my case I have seen this error due to network where the ping was intermittent. Also, please check if no one else is using Mac/Device IP addresses.
Hi, Thanks for your help and support in advance. When starting my tests using calabash cucumber I am getting the following error:
Failing... Errno::ECONNREFUSED Retrying.. Errno::ECONNREFUSED: (Connection refused - Connection refused - connect(2) for "10.199.5.73" port 37265 (10.199.5.73:37265)) Retrying.. Errno::ECONNREFUSED: (Connection refused - Connection refused - connect(2) for "10.199.5.73" port 37265 (10.199.5.73:37265)) Failing... Errno::ECONNREFUSED
This issue appearing frequently but intermittently. I am running my tests using rake with the following command:
rake run_tests BRAND= ENV= PLATFORM=ios PLATFORM_VERSION='10.2.1' DEVICE_TARGET='FCCSV06BHFM2' TARGET='device' DEVICE_ENDPOINT=http://10.199.5.73:37265 FEATURE_NAME=
The tests run on the real device but I get the error majority of the times and when this occurs the test is failed.