Page tree

To export a code to Perl, you need to do the following things:

  1. Code in Perl language
  2. Integrate SeeTestAutomation and Perl.

Get script code in Perl:

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 Perl.



Code will automatically generate in Perl language.

 

Step 4: Copy the generated code in Perl and paste into a text file. Here is an example of such a generated code:

#!/usr/bin/perl -w
use strict;
use Data::Dumper;
require ExperitestClient;
# Create client using defaults or using hostname and port number
my $client = SeeTest->new('localhost', 8890, 1);
$client->setProjectBaseDirectory("C:\\Users\\User\\workspace\\project1");
$client->setReporter2("html", "reports", "Untitled");
$client->setDevice("adb:Nexus 9");
$client->launch("com.experitest.ExperiBank/.LoginActivity", 1, 0);
$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(0);
# Releases the client so that other clients can approach the agent in the near future. 
$client->releaseClient();

 

Step 5: Save it with .pl extension.

Integrate to Perl:

  1. Need to integrate the perl environment with SeeTestAutomation built-in clients located in the installation folder under the ../clients/perl subfolder
  2. Copy the file ExperitestClient.pm ( located in <installation folder>\clients\perl) and paste it on the same directory where your Perl script is saved.
  3. Need to install RPC::XML module:
    1. Open ppm.bat (Perl Package Manager)
    2. Search for "rpc xml data"
  4. Select this package
    1. Click on 'Run marked Actions'.
    2. Wait for installation.

Run your script:

  1. From the command line go to the script location and run it using the command: perl <ScriptName>

Another way to run the Perl Script is on the PerlIDE "Padre".

  1. You can download the PerlIDE from the Link given below:-
    DWIM Perl 5.14.2.1 (v7).
  2. Install this IDE and add rpc::xml module.You should download the module librpc-xml-perl_0.77.orig.tar.gz file.
  3. You can add this module by clicking on Tools -> Module Tools -> Install Local Distribution.

In the following screenshot you will see that rpc::xml module is installing.

Run the Script:-

  1. Copy the code from SeeTestAutomation and paste in the framework.
  2. Save the ExperitestClient.pm file on the same directory with  your Script.
  3. Click on 'Run Script' and execute the script.


  • No labels