Legacy | WindTunnelUtils Class

The WindTunnelUtils class is part of the Perfecto project template and provides some useful static methods that can enhance your interface with the Perfecto Lab. The class provides utilities used to incorporate WindTunnel functionality into automation scripts.

The class provides three sets of utilities:

Wind Tunnel static variables

The Wind Tunnel service defines various capabilities and Persona file field names that can be accessed by name. To make this easier the following static names are defined in the class and can be used in the automation scripts easily:

Copy
    public static final String WIND_TUNNEL_PERSONA_CAPABILITY = "windTunnelPersona";
    public static final String WIND_TUNNEL_LOCATION_CAPABILITY = "windTunnelLocation";
    public static final String WIND_TUNNEL_LOCATION_ADDRESS_CAPABILITY = "windTunnelLocationAddress";
    public static final String WIND_TUNNEL_ORIENTATION_CAPABILITY = "windTunnelOrientation";
    public static final String WIND_TUNNEL_VNETWORK_CAPABILITY = "windTunnelVNetwork";
    public static final String WIND_TUNNEL_BACKGROUND_RUNNING_APPS_CAPABILITY = "windTunnelBackgroundRunningApps";
    public static final String WIND_TUNNEL_REPORT_URL_CAPABILITY = "windTunnelReportUrl";

    public static final String DEVICE_NAME_CAPABILITY = "deviceName";
    public static final String DEVICE_PLATFORM_NAME_CAPABILITY = "platformName";
    public static final String DEVICE_PLATFORM_VERSION_CAPABILITY = "platformVersion";
    public static final String DEVICE_MODEL_CAPABILITY = "model";
    public static final String DEVICE_MANUFACTURER_CAPABILITY = "manufacturer";
    public static final String DEVICE_NETWORK_CAPABILITY = "network";
    public static final String DEVICE_LOCATION_CAPABILITY = "location";
    public static final String DEVICE_RESOLUTION_CAPABILITY = "resolution";
    public static final String DEVICE_DESCRIPTION_CAPABILITY = "description";

    // Constants for use with Points of Interest
    public static final String POI_DESCRIPTION = "description";
    public static final String POI_STATUS = "status";

    public static final String SUCCESS = "success";
    public static final String FAILURE = "failure";

    // Constants for use with Single Test Report
    public static final String REPORT_TIMER_RESULT = "result";
    public static final String REPORT_TIMER_THRESHOLD = "threshold";
    public static final String REPORT_TIMER_DESCRIPTION = "description";
    public static final String REPORT_TIMER_NAME = "name";

    // Names of the built-in Persona
    public static final String GEORGIA = "Georgia";
    public static final String ROSS = "Ross";
    public static final String PETER = "Peter";
    public static final String SAM = "Sam";
    public static final String SARA = "Sara";

Wind Tunnel basic methods

The following utility methods are used to incorporate the Wind Tunnel functionality into your automation scripts:

  • pointOfInterest - Method to add a point of interest (POI) to the script that will be highlighted in the Single Test Report.
    • Parameter name - string that appears in the report to identify the POI.
    • Parameter status - reports whether the status at this point is Success or Failure.
  • reportTimer - Method to add a timer to the script for the Single Test Report.
    • Parameter result - the timer value to report.
    • Parameter threshold - cutoff point for success timing.
    • Parameter description - string that appears in the report to explain what is timed.
    • Parameter name - string that appears in the report to identify the timer.
Copy
    /**
     * Adds a point of interest to the Wind Tunnel report.
     * Example:
     * pointOfInterest(driver, "Login Successful", WindTunnelUtils.SUCCESS);
     */
    public static String pointOfInterest(RemoteWebDriver driver, String name, String status) {
        ...
    }

    /**
     * Adds a timer report to the Wind Tunnel report.
     * Example:
     * reportTimer(driver, loginScreenTimer, 5000, "Timer for login screen", "");
     */
    public static String reportTimer(RemoteWebDriver driver, long result, long threshold,
                                     String description, String name) {
        ...
    }

Custom Persona creation methods

The following utility methods are used to create a new custom Wind Tunnel Persona for your scripts:

  • createWindTunnelPersona - creates a new Persona based on defining the component parts of the Persona
    • Parameter properties - supplies the PersonaProperties instance component
    • Parameter device - supplies the PersonaDevice instance component
    • Parameter settings - supplies the PersonaSettings instance component
  • uploadWindTunnelPersona - uploads a custom Persona JSON file to the Perfecto Lab Repository, so it can be used in an automation script.
    • Parameter host - identifies the Perfecto Lab
    • Parameters user & password - provide the Perfecto Lab credentials
    • Parameter repositoryFolder- provides the Repository location to save the Persona at.
    • Parameter properties - supplies the PersonaProperties instance component
    • Parameter device - supplies the PersonaDevice instance component
    • Parameter settings - supplies the PersonaSettings instance component
Copy
    /**
     * Example:
     * PersonaProperties properties = new PersonaProperties("Pedro", "This is Pedro's profile", "PUBLIC:personas\\Perdo.jpg");
     * PersonaDevice device = new PersonaDevice();
     * device.setModel("iPhone-5S");
     * PersonaSettings settings = new PersonaSettings(null, "Boston", "landscape", "4G LTE Advanced Good", "Waze,YouTube");
     * String persona = createWindTunnelPersona(properties, device, settings);
     */
    public static String createWindTunnelPersona(PersonaProperties properties, PersonaDevice device, PersonaSettings settings) throws JsonProcessingException {
        ...
    }

    /**
     * Example:
     * PersonaProperties properties = new PersonaProperties("Pedro", "This is Pedro's profile", "PUBLIC:personas\\Perdo.jpg");
     * PersonaDevice device = new PersonaDevice();
     * device.setModel("iPhone-5S");
     * PersonaSettings settings = new PersonaSettings(null, "Boston", "landscape", "4G LTE Advanced Good", "Waze,YouTube");
     * String repositoryKey = uploadWindTunnelPersona(myHost, myUser, myPassword, "PRIVATE:Personas", properties, device, settings);
     */
    public static String uploadWindTunnelPersona(String host, String user, String password, String repositoryFolder,
                                                 PersonaProperties properties, PersonaDevice device, PersonaSettings settings) throws UnsupportedEncodingException, MalformedURLException, IOException {
        ...
    }

Persona component classes

The class provides three member classes for use in creating new Persona:

  • PersonaProperties -
    • Member name - string used to name the persona
    • Member description - string to document an overview of the persona
    • Member image - image file used for presenting the persona.
    • Constructor that takes two strings and an image file
  • PersonaDevice -
    • Member deviceName - Device ID 
    • Member platformName - OS name (for example, iOS, Android)
    • Member platformVersion - OS version
    • Member manufacturer - Company name
    • Member model - Model name of device (for example iPhone 5s)
    • Member resolution - Screen size in pixels wxh
    • Member network - Carrier name
    • Member location - Physical location of the device
    • Member description - String for display purposes
    • Constructor that takes string parameters for each member, for non-relevant parameter supply null.
  • PersonaSettings -
    • Member location - Normal location of the Persona.
    • Member locationAddress - Location provided as a street address.
    • Member orientation - Normal Persona orientation of the device.
    • Member vnetworkProfile - Virtual network settings
    • Member applications - List of applications that Persona may run in background
    • Constructor that takes String arguments for all but last member. applications is a list of strings.