Java Code Examples for org.testng.xml.XmlTest#addParameter()

The following examples show how to use org.testng.xml.XmlTest#addParameter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyTestExecutor.java    From AppiumTestDistribution with GNU General Public License v3.0 6 votes vote down vote up
public XmlSuite constructXmlSuiteForDistribution(List<String> tests,
                                                 Map<String, List<Method>> methods,
                                                 String suiteName,
                                                 String category,
                                                 int deviceCount) {
    XmlSuite suite = new XmlSuite();
    suite.setName(suiteName);
    suite.setThreadCount(deviceCount);
    suite.setParallel(ParallelMode.CLASSES);
    suite.setVerbose(2);
    listeners.add("com.appium.manager.AppiumParallelMethodTestListener");
    listeners.add("com.appium.utils.RetryListener");
    include(listeners, LISTENERS);
    suite.setListeners(listeners);
    XmlTest test = new XmlTest(suite);
    test.setName(category);
    test.addParameter("device", "");
    include(groupsExclude, EXCLUDE_GROUPS);
    include(groupsInclude, INCLUDE_GROUPS);
    test.setIncludedGroups(groupsInclude);
    test.setExcludedGroups(groupsExclude);
    List<XmlClass> xmlClasses = writeXmlClass(tests, methods);
    test.setXmlClasses(xmlClasses);
    writeTestNGFile(suite);
    return suite;
}
 
Example 2
Source File: MyTestExecutor.java    From AppiumTestDistribution with GNU General Public License v3.0 6 votes vote down vote up
public XmlSuite constructXmlSuiteForParallelCucumber(
    int deviceCount, List<AppiumDevice> deviceSerail) {
    ArrayList<String> listeners = new ArrayList<>();
    listeners.add("com.cucumber.listener.CucumberListener");
    XmlSuite suite = new XmlSuite();
    suite.setName("TestNG Forum");
    suite.setThreadCount(deviceCount);
    suite.setParallel(ParallelMode.TESTS);
    suite.setVerbose(2);
    suite.setListeners(listeners);
    for (int i = 0; i < deviceCount; i++) {
        XmlTest test = new XmlTest(suite);
        test.setName("TestNG Test" + i);
        test.setPreserveOrder(false);
        test.addParameter("device", deviceSerail.get(i).getDevice().getUdid());
        test.setPackages(getPackages());
    }
    return getXmlSuite(suite);
}
 
Example 3
Source File: MyTestExecutor.java    From AppiumTestDistribution with GNU General Public License v3.0 5 votes vote down vote up
public XmlSuite constructXmlSuiteForParallel(String pack, List<String> testcases,
                                             Map<String, List<Method>> methods,
                                             String suiteName, String category,
                                             int deviceCount,
                                             List<AppiumDevice> deviceSerail) {
    ArrayList<String> listeners = new ArrayList<>();
    listeners.add("com.appium.manager.AppiumParallelTestListener");
    listeners.add("com.appium.utils.RetryListener");
    include(listeners, LISTENERS);
    include(groupsInclude, INCLUDE_GROUPS);
    include(groupsExclude, EXCLUDE_GROUPS);
    XmlSuite suite = new XmlSuite();
    suite.setName(suiteName);
    suite.setThreadCount(deviceCount);
    suite.setDataProviderThreadCount(deviceCount);
    suite.setParallel(ParallelMode.TESTS);
    suite.setVerbose(2);
    suite.setListeners(listeners);
    for (int i = 0; i < deviceCount; i++) {
        XmlTest test = new XmlTest(suite);
        test.setName(category + "-" + i);
        test.setPreserveOrder(false);
        test.addParameter("device", deviceSerail.get(i).getDevice().getUdid());
        test.addParameter("hostName", deviceSerail.get(i).getHostName());
        test.setIncludedGroups(groupsInclude);
        test.setExcludedGroups(groupsExclude);
        List<XmlClass> xmlClasses = writeXmlClass(testcases, methods);
        test.setXmlClasses(xmlClasses);
    }
    writeTestNGFile(suite);
    return suite;
}
 
Example 4
Source File: MyTestExecutor.java    From AppiumTestDistribution with GNU General Public License v3.0 5 votes vote down vote up
public XmlSuite constructXmlSuiteDistributeCucumber(int deviceCount) {
    ArrayList<String> listeners = new ArrayList<>();
    listeners.add("com.cucumber.listener.CucumberListener");
    XmlSuite suite = new XmlSuite();
    suite.setName("TestNG Forum");
    suite.setThreadCount(deviceCount);
    suite.setParallel(ParallelMode.CLASSES);
    suite.setVerbose(2);
    suite.setListeners(listeners);
    XmlTest test = new XmlTest(suite);
    test.setName("TestNG Test");
    test.addParameter("device", "");
    test.setPackages(getPackages());
    return getXmlSuite(suite);
}
 
Example 5
Source File: MyTestExecutor.java    From AppiumTestDistribution with GNU General Public License v3.0 5 votes vote down vote up
public CreateGroups invoke() {
    xmlClasses = writeXmlClass(tests, methods);
    test = new XmlTest(suite);
    test.setName(category);
    test.addParameter("device", "");
    include(groupsExclude, EXCLUDE_GROUPS);
    test.setIncludedGroups(groupsInclude);
    test.setExcludedGroups(groupsExclude);
    writeXml = new ArrayList<>();
    return this;
}