Legacy | Custom personas
You can create and upload a new persona, representing your ultimate application user, thus emulating real-life conditions of your typical application user.
For that purpose, you need to determine the:
- Persona: A name, and a general characterization, including some indication for the reason this persona is your typical app user (for example, an avid coffee consumer would be a typical user of a Starbucks app).
-
Network Conditions: The network conditions your typical user encounters on a daily basis. This concept is also named Network Profile.
- Location: The location of that user. Set a location reflecting an area in which your app is likely to be heavily used.
- Background applications: The list of applications running in the background on your typical user's device. This is important because of the expected CPU consumption or resource allocation (such as the camera) of these applications.
You can also determine the device or devices used while running your application. However, the device specified for the persona only serves as a property of the persona. It is not a setting that can actually configure anything about the execution environment. You still need to select the device or devices via independent capabilities in your automation tests.
For more information on specifying devices in your tests, see Use capabilities to select a device.
When these characteristics are decided, use the WindTunnelUtils class to create the persona file. WindTunnelUtils includes the following member classes that assist in creating the custom persona:
PersonaDevice
defines the device capabilities for the device and the network used by your custom persona.PersonaProperties
defines the basic identification information for the custom persona.PersonaSettings
defines the location, background applications, and virtual network settings for the custom persona.
In addition, the following methods take different instances and create the persona file:
createWindTunnelPersona()
uploadWindTunnelPersona()
creates the persona and uploads it to the repository.
The following snippets show how to use these to create your persona:
Java snippet to create a persona
//**** Step 1 **** The persona properties.
//****************
//Include, in this order:
//* persona name - arbitrary
//* a general description - try to emphasize the persona essence, as well as
// something to indicate it as your app typical user.
//* an image - recommended image size: 48 x 48 pxl; used in the WT report.
WindTunnelUtils.PersonaProperties myProperties =
new WindTunnelUtils.PersonaProperties("myPersonaName", myDescription, "PUBLIC:/personas/myImage.jpg");
//**** Step 2 **** The device(s) used by the persona
//****************
//You can either define the whole device (as in the example below),
//or create an empty device, and set any number of its attributes separately.
WindTunnelUtils.PersonaDevice myDevice = new WindTunnelUtils.PersonaDevice();
// Initialize device object model via the setModel() method.
myDevice.setModel("iPhone-5S");
//OR another example:
//WindTunnelUtils.PersonaDevice myDevice = new WindTunnelUtils.PersonaDevice
//(null, "Android", "5.0.2", "Galaxy S6", "Samsung", "AT&T", null,
//"1440 x 2560", null);
//**** Step 3 **** The persona settings.
//****************
//Include, in this order:
//* location (1st & 2nd) - the 1st indicates coordinates, regularly set to "",
// and the 2nd indicates an address
//* orientation - portrait or landscape
//* network profile (either as a string or as a constant - example bellow)
//* list of apps - comma-no-space separated list.
// Some apps have differing names across platforms;
// list both if relevant to your persona.
WindTunnelUtils.PersonaSetting settings = WindTunnelUtils.PersonaSettings
("", "Paris, France", "landscape", "4G LTE Advanced Good", "twitter");
//OR another example:
//WindTunnelUtils.personaSetting settings = WindTunnelUtils.personaSettings
// ("", "1600 Amphitheatre Parkway, Mountain View, CA",
// "portrait",4g_lte_advanced_good, //"Twitter,Waze,WhatsApp");
//**** And finally **** Create (JSON file) and upload persona into repository
//****************
//Include, in this order:
//* host (cloud lab name), user, password - the first 3 args
//* location in repository - preferably, "PRIVATE:/Personas"; verify it exists!
//* persona properties object - created in step 1
//* persona device object - created in step 2
//* persona settings object - created in step 3
String repositoryKey =
WindTunnelUtils.uploadWindTunnelPersona("myCloud.perfectomobile.com", "myUser", "myPassword", "PRIVATE:/Personas", myProperties, myDevice, mySettings);
//**** To actually use the persona ****
//****************
// Use the custom persona located in "PRIVATE:/Personas/myPersonaName.json"//Notice the repositoryKey is the value returned in the final step above.
capabilities.setCapability("windTunnelPersonaKey", repositoryKey);
C# snippet to create a persona
//**** Step 1 **** The persona information.
//****************
//* a general description - try to emphasize the persona essence, as well as
// something to indicate it as your app typical user.
//* persona name - arbitrary
//* an image - Recommended image size: 48 x 48 pxl; used in the WT report.
string myPersonaDescription = "This is my persona description...";
string myPersonaName = "myPersona";
string myPersonaImage = "PUBLIC:/personas/myPersona.jpg";
//**** Step 2 **** The persona settings.
//****************
//* location - persona address
//* orientation - portrait or landscape
//* network profile (either as a string or as a constant - example bellow)
//* list of apps - comma-no-space separated list.
// Some apps have differing names across platforms;
// list both if relevant to your persona.
string myPersonaAdr = "1600 Amphitheatre Parkway, Mountain View, CA";
string myDeviceOrientation = "landscape";
string myNetworkProfile = 4g_lte_advanced_good;
string myPersonaApps = "United,Twitter,Facebook,Gmail,Outlook";
//Location in repository - preferably, "PRIVATE:/Personas"; verify it exists!
string myPersonaFolder = "PRIVATE:/Personas"//**** Step 3 **** The device(s) used by the persona
//****************
//You can either define the whole device (as in the example bellow),
//or create an empty device, and set any number of its attributes separately.
// In this case, Samsung GalaxyS6 running Android 5.0.2
Dictionary<string, object> device = WindTunnelUtils.CreateDevice(null, "Android", "5.0.2", "Galaxy S6", "Samsung", "AT&T", null, "1440 x 2560", null);
//**** And finally **** Create (JSON file) and upload persona into repository
//****************
//Include, in this order:
//* host (cloud lab name), user, password (3 args)
//* persona information (3 args) - name, description, image - created in step 1
//* persona settings (5 args) - location (1 for coordinates, regularly null,
// and 2 for address), orientation,
// network profile, app list - created in step 2
//* location in repository
//* persona device object - created in step 3
// Supply all information - method creates the Persona and
// uploads to the repository returning Repository Key for the
String repositoryKey = WindTunnelUtils.UploadWindTunnelPersona("myCloud.perfectomobile.com", "myUser", "myPassword", myPersonaName, myPersonaDescription, myPersonaImage, null, myPersonaAdr, myDeviceOrientation, myNetworkProfile, myPersonaApps, myPersonaFolder, device);
//**** To actually use the persona ****
//****************
// Use the custom persona located in "PRIVATE:/Personas/myPersonaName.json"//Notice the repositoryKey is the value returned in the final step above.
capabilities.SetCapability("windTunnelPersonaKey", repositoryKey);
For sample personas, including defined parameters, see Built-in personas.