1

Currently I'm writing all the Test Case actions in one javascript file, and using Xcode Instruments automation.traceTemplate file for executing the Test Case. Following are contents from TestCase file.

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();

//target.logElementTree();
target.delay(2);
UIATarget.localTarget().captureScreenWithName("Application launched");

target.frontMostApp().mainWindow().textFields()[0].setValue("demo");
target.delay(2);
UIATarget.localTarget().captureScreenWithName("Username entered");


var passwordfield = target.frontMostApp().mainWindow().secureTextFields()[0];
passwordfield.setValue("demo");

My Requirement: I want to perform one action at a time on iOS device using Xcode Instruments instead of passing complete Test Case file as a input similar to implementation of Appium tool.We can select a text and pass 'text' as input and execute this command on real device.

Thanks in advance..........

Ashok
  • 197
  • 3
  • 17
  • Is there any one who can help me?? If I'm doing some thing wrong please let me know. Please discuss. – Ashok Jan 06 '15 at 05:38

2 Answers2

1

XCode instruments natively do not support on the fly Javascript. You have to have all your javascript in one file and execute all of the script at once. You are not able to stop execution, have separate test cases etc. This is where appium comes into play, it will allow arbitrary JS execution. You create your test cases in the appium/selenium format and they would send commands to instruments in the background.

Run through this tutorial http://appium.io/slate/en/tutorial/ios.html?java#native-ios-automation and you don't even have to use JS, you can use Java/Ruby and you will be in a better shape.

satyajit
  • 1,470
  • 3
  • 22
  • 43
  • I have one client and this client perform some operations on device from client side. Lets say he enters some text and then I want to enter this text in actual device and then take its screenshot. I want to create these commands dynamically and take its screenshot and send this screen shot to client – Ashok Jan 12 '15 at 09:31
0

Check out appiumRepl

You can send commands one-by-one and watch them happen on the device/emulator in realtime :)

There's a Ruby REPL as well.

TinyTimZamboni
  • 5,275
  • 3
  • 28
  • 24
  • I have one client and this client perform some operations on device from client side. Lets say he enters some text and then I want to enter this text in actual device and then take its screenshot. I want to create these commands dynamically and take its screenshot and send this screen shot to client – Ashok Jan 12 '15 at 09:33
  • Yes all that is possible just using Appium and its related webdrivers. Use the appium project at github.com/appium/appium and run it from the command line, rather than using the appium desktop app. Then connect to the server using any of the appium client libraries, they don't need to be run inside of a test case. – TinyTimZamboni Jan 13 '15 at 19:49
  • Thanks for your reply. I don't want to use appium. All other required components I have, just I need this scenario to implement not by using appium. Please help me. – Ashok Jan 14 '15 at 12:33