Here are instructions on how to export Silk Mobile scripts to Ruby code:
Get script code in Ruby:
Step 1: Create a test case.
Step 2: Click on the Code tab.
Step 3: Click on the drop down button of Languages and Select Ruby.
Code will automatically generate in Ruby language.
Step 4: Copy the generated code in Ruby and paste it into a text file. Here is an example of such a generated code:
load "Client.rb"# Create client using defaults or using hostname and port numberclient = Mobile::Client.new('127.0.0.1', 8890, true)client.setProjectBaseDirectory("C:\\Users\\User\\workspace\\project1")client.setReporter2("html", "reports", "Untitled")client.setDevice("adb:Nexus 9")client.launch("com.experitest.ExperiBank/.LoginActivity", true, false)client.elementSendText("NATIVE", "id=usernameTextField", 0, "company")client.elementSendText("NATIVE", "id=passwordTextField", 0, "company")client.click("NATIVE", "text=Login", 0, 1)# Generates a report of the test case.# For more information - http://supportline.microfocus.com/Documentation/books/ASQ/SilkMobile/90/help/Report+Of+Executed+Testclient.generateReport2(false);# Releases the client so that other clients can approach the agent in the near future. client.releaseClient();
Step 5: Save it with .rb extension.
Run your script:
Step 1: Copy the file Client.rb from the <SilkMobile>\clients\ruby folder and paste it to the same directory where your Ruby script is saved.
Step 2: From the command line go to the script location and run it using the command: ruby <ScriptName>