# Run parallel tests in LeanFT

Save testing time by running multiple tests, or a single test with multiple data sets, in parallel on the same host machine.

When using a seat license, LeanFT can run up to four test operations in parallel.

When using concurrent licenses, LeanFT dynamically consumes additional licenses, each enabling four parallel test operations. The maximum number of licenses to consume is defined in the LeanFT runtime engine settings.

Run parallel testing on:

- Native and hybrid mobile applications

- SAPUI5-based applications

- Web applications in the following browsers:

  Browser | Window | Linux | Mac | Mobile
  --- | --- | --- | --- | ---
  Google Chrome |  |  |  |
  Google Chrome (on Android) | N/A | N/A | N/A |
  Headless Chrome |  |  |  |
  Mozilla Firefox |  |  |  |
  PhantomJS |  |  |  |
  Safari (on iOS) | N/A | N/A |  |

Create and run your tests in a unit testing framework that supports running tests in parallel. LeanFT supports TestNG and NUnit 3, but you can also use any custom framework that launches tests in parallel.

Tip: To minimize performance issues when testing mobile applications, lock each device once for all tests. To do this, lock the device at the beginning of the class running your tests and not before each test.

Examples

TestNG

This example demonstrates how to use a data-driven TestNG test that enables running the same Web test in different types of browsers in parallel:

    @DataProvider(name="BrowserTypes", parallel=true)
    public Object[][] getBrowserTypeData() {
    	returnnew Object[][]{
    		{BrowserType.CHROME},
    		{BrowserType.INTERNET_EXPLORER},
    		{BrowserType.FIREFOX}
    	};
    }

    @Test(dataProvider="BrowserTypes")
    publicvoid parallelDataProviderTest(BrowserType browserTypeToLaunch) throws GeneralLeanFtException, ReportException {
    	Browser browser = BrowserFactory.launch(browserTypeToLaunch);
    	browser.navigate("www.hpe.com");
    	browser.sync();
    	Reporter.reportEvent("Info", "Browser launched: "+ browserTypeToLaunch + ", Thread id = " +Thread.currentThread().getId());
    	browser.close();
    }

For more code samples, see Parallel testing code samples (Java).

NUnit 3

To run LeanFT tests in parallel using NUnit 3.x, add NUnit’s “[Parallelizable]” annotation on top of each class in the project that you want to run in parallel with other classes. For example:

    namespace LeanFtTestProject
    {
       [TestFixture]
       [Parallelizable]
       public class TestClassA : UnitTestClassBase
       {
    	[Test]
    	public void TestA()
    	{
    	   //Write your test logic her
    	}
       }

       [TestFixture]
       [Parallelizable]
       public class TestClassB : UnitTestClassBase
       {
    	[Test]public void TestB()
    	{
    	   //Write your test logic here
    	}
       }
    }

Note:

- NUnit 3.x does not support running tests within the same class in parallel, but the classes themselves can be parallelized. As a best practice, to run specific tests in parallel, give each test its own class with its own annotation.

- If the test is configured to provide separate report files per class, a separate report is created for each parallel class run. For details, see Report settings.

  In this situation, do not use multiple TestFixtures with the same name and parameters. TestFixtures must be uniquely identified to enable creating a report for each run.

- The example above demonstrates one way of designing your NUnit 3.x projects for parallel test execution. For more information, see GitHub: Framework Parallel Test Execution.

See also:

- Create a LeanFT testing project or module
- Run LeanFT tests
- Analyze run results
- Blog post: Parallel Test Execution with LeanFT to enable continuous delivery

https://admhelp.microfocus.com LeanFT 8942
Tips to improve your search results...TOC Lean Functional Testing Help Center LeanFT Help Center 14.50 - 14.53 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version:(Undefined variable: _rscC_Basic_Variables.FloatingTocShow)