Page tree

Here are instructions on how to export SeeTestAutomation 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 number
client = 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 - https://docs.experitest.com/display/public/SA/Report+Of+Executed+Test
client.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: Run in command line:

gem install rest-client


.

Step 2: Copy the file Client.rb  from the <SeeTestAutomation>\clients\ruby folder and paste it to the same directory where your Ruby script is saved.

Step 3: From the command line go to the script location and run it using the command: ruby <ScriptName>


  • No labels