Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Mar 10, 2020 12:36

This section guides you through setting up the integration between Perfecto and NeoLoad for running Appium scripts, based on the Quantum framework.

1 | Set up NeoLoad

  1. Download and install Neoload.
  2. Do one of the following:
    • Import the sample Neoload project.
    • Create your own project, as follows:
      1. Create a new project.
      2. Create a new user path.

         Click to view image
      3. Insert a new Command line action as a child.

         Click to view image
  3. On Windows only: Install Cygwin and append its bin, normally present under C:\cygwin64\bin, to the environment variables’ PATH variable.
  4. Perform the following based on your platform:
    • On Mac: Add the commands named sh and arg1 as: ${NL-CustomResources}/NL_Shell.sh

       Click to view image
    • On Windows: Set the location of your .sh file into command value. For example, set C:\cygwin64\bin\sh and arg1 as ${NL-CustomResources}\NL_Shell.sh.

       Click to view image
  5. In the custom-resources folder of the NeoLoad project path, create a file called NL_Shell.sh and add the following content:

    cd {QUANTUM_PROJECT_PATH}
    
    {MAVEN_PATH}/mvn clean install -Dnl.selenium.proxy.mode=EndUserExperience -Dnl.data.exchange.url=http://localhost:7400/DataExchange/v1/Service.svc/ -Dreportium-job-name=NEOLOAD -Dreportium-job-number=1

    Where:

    • {QUANTUM_PROJECT_PATH} should be replaced with the Quantum project path.

    • {MAVEN_PATH} should be replaced with the path to the .mvn file.

    • Reporting-related parameters are optional and enable integration with the Perfecto Smart Reporting CI Dashboard.

      Mac example shell script
      cd /Users/<user-name>/eclipse-workspace/Quantum_Neoload
      
      /usr/local/Cellar/maven/3.6.0/bin/mvn clean install -Dnl.selenium.proxy.mode=EndUserExperience -Dnl.data.exchange.url=http://localhost:7400/DataExchange/v1/Service.svc/ -Dreportium-job-name=NEOLOAD -Dreportium-job-number=1
      
      Windows example shell script
      #!/bin/bash
      
      cd /cygdrive/c/Genesis/Workspace/Quantum_Neoload
      
      C:/Genesis/Tools/apache-maven-3.6.3/bin/mvn test -Dnl.selenium.proxy.mode=EndUserExperience -Dnl.data.exchange.url=http://localhost:7400/DataExchange/v1/Service.svc/ -Dreportium-job-name=NEOLOAD -Dreportium-job-number=1

      Note: If you use Notepad++, make sure to select EOL Conversion to UNIX before saving the above content to NL_Shell.sh

       Click to view image
  6. Create a population and set the desired user path.

     Click to view image
  7. In NeoLoad, select Runtime, set the duration policy to By Iteration, and set both the initial number of users and the maximum number of users to 1 for any load variation policy.

     Click to view image


On this page:

2 | Integrate NeoLoad with Quantum

To integrate NeoLoad with Quantum, you can either use our sample project or your existing Quantum framework.

To use the sample project:

  1. Access the project on GitHub: https://github.com/PerfectoMobileSA/Quantum_Neoload.git
  2. In the application.properties file, update your remote.server and perfecto.capabilities.securityToken.

     Click for information on generating a security token

    To generate a security token:

    1. In the Perfecto UI at <YourCloud>.app.perfectomobile.com (where YourCloud is your actual cloud name, such as mobilecloud), click your user name and select My security token

    2. In the My security token form, click Generate Security Token.
    3. Click Copy to clipboard. Then paste it into any scripts that you want to run with Perfecto. 

    4. Click Close.

To use your existing Quantum framework:

  1. In the application.properties file, update your remote.server and add the perfecto.capabilities.securityToken.

     Click for information on generating a security token

    To generate a security token:

    1. In the Perfecto UI at <YourCloud>.app.perfectomobile.com (where YourCloud is your actual cloud name, such as mobilecloud), click your user name and select My security token

    2. In the My security token form, click Generate Security Token.
    3. Click Copy to clipboard. Then paste it into any scripts that you want to run with Perfecto. 

    4. Click Close.

  2. In the pom.xml file, add the following:

    1. Repository details to the <repositories> section:

      		<repository>
      			<id>neotys-public-releases</id>
      			<url>http://maven.neotys.com/content/repositories/releases/</url>
      			<releases>
      				<enabled>true</enabled>
      			</releases>
      			<snapshots>
      				<enabled>false</enabled>
      			</snapshots>
      		</repository> 
    2. The following Maven dependency:

      	<dependency>
      		<groupId>com.neotys.selenium</groupId>
      		<artifactId>neotys-selenium-proxy</artifactId>
      		<version>2.1.0</version>
      	</dependency> 
  3. Add the following new application.properties, as follows: Set neoload=true and neoload_projectPath with the file path for NeoLoad’s project.nlp.

    	#Enable neoload driver/ not
    	neoload=true
    	# absolute path of neoload project
    	neoload_projectPath=/Users/genesisthomas/neoload_projects/Perfecto/Perf.nlp
  4. Pass the applicable platformName for every enabled test from testng parameters. For example:

    	<test name="Web Scenarios Android Test" enabled="true"
    		thread-count="10">
    		<parameter name="driver.capabilities.model" value="Galaxy.*"></parameter>
    		<parameter name="perfecto.capabilities.platformName" value="Android"></parameter>

    Note: This automatically appends the platform name to the startTransaction method of NeoLoad.

  5. Add the customized UIDriverFactory.java and NLDriver.java classes as per the following package structure. Refer to the sample project if needed.

     Click to view image
  6. Change any driver URL navigation method to the NLDriver.getDriver().get() method. This new method works with or without Neoload enablement. Any other get() implementations do not get tracked in NeoLoad. For example:

    		NLDriver.getDriver().get("http://ushahidi.demo.neotys.com/");
  7. Call the startTransaction() and stopTransaction() methods of NeoLoad as follows:

    	@Given("^I am on Neoload submission$")
    	public void I_am_on__Neoload() throws Throwable {
    		NLDriver.startTransaction("home_Perfecto");
    		NLDriver.getDriver().get("http://ushahidi.demo.neotys.com/");
    		NLDriver.stopTransaction();

    Note: Both methods are activated only when neoload=true.

  8. Call the getLocator(QAFExtendedWebElement element) method to return the locator value of QAFExtendedWebElement from .loc files. This new method works with or without NeoLoad enablement. For example:

    	QAFExtendedWebElement reports = new QAFExtendedWebElement("nl.reports");
    	NLDriver.getDriver().findElement(By.xpath(NLDriver.getLocator(reports))).click();
  9. (Optional) Use the isNeoLoadEnabled() method if you want to differentiate or restrict the functional Quantum flow vs. the Neoload Quantum flow. For example:

    	if(NLDriver.isNeoLoadEnabled()) {
    		//Load testing
    	}else{
    		//Functional testing
    	}

Maintenance

If you plan to upgrade your Quantum version in the future, you need to self-maintain the UiDriverFactory.java class (getDriver() method).

Limitations

The following limitations apply:

  • The use of QAFExtendedWebElement functions, as shown in the following example, is not supported.

    QAFExtendedWebElement searchResultElement = new QAFExtendedWebElement("partialLink=" + result);
    searchResultElement.verifyPresent(result);

    Solution: Perform above steps 8 and 9 combined to overcome this challenge. For example:

    QAFExtendedWebElement reports = new QAFExtendedWebElement("nl.reports");
    if(NLDriver.isNeoLoadEnabled()) {
    NLDriver.getDriver().findElement(By.xpath(NLDriver.getLocator(reports))).click();
    }else{
    reports.waitForVisible(5000);
    }
  • QAF’s CommonStep class is not supported.
    Solution: Use above step 9 to overcome this challenge.
  • Tested for Perfecto Desktop Web and Perfecto Mobile Web only.
    Solution: For all other platforms, add the following TestNG parameter to the corresponding test in testng.xml:

    <parameter name="neoload" value="false"/>

3 | Set up parallel execution

To run tests in parallel, you can create several user paths with different shell files highlighting the testng.xml file (-DtestngXmlFile=testng.xml), along with different populations. The following sample user paths and populations for executing 3 different testng.xml files run on 3 different platforms in parallel.

 Click to view image

User paths:

 Click to view image

Populations:

 Click to view image

shell.sh:

4 | Execute your tests

  1. In NeoLoad,
    1. Click Run and wait for the results.

       Click to view image
    2. To view platform-related details and load times, click External Data.

       Click to view image
  2. In Perfecto, access the CI Dashboard and individual reports:

     Click to view image
  • No labels