Create TestNG xml in Intellij

2019-08-28 22:40发布

问题:

How to create TestNG.xml in Intellij Idea

This is my test code

import com.applitools.eyes.RectangleSize;
import com.applitools.eyes.selenium.Eyes;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.util.concurrent.TimeUnit;


public class mas1 {

    @Test
    public void test() {

        WebDriver driver = new FirefoxDriver();

        driver.get("https://demo.applitools.com");
        driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);

        driver.quit();

    }
}

I tried to create TestNG.xml following the below link

TestNG with IntelliJ IDEA: How to use the testng.xml file in IntelliJ IDEA 9

Can somebody explain to me how to create TestNG.xml

I don't know what i have to insert in suite field and package name to create it manually.

Below is image for my directory browsing, there are no packages

回答1:

This is sample XML for your Project,

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
  <test thread-count="5" name="Test">
    <classes>
      <class name="java.mas1"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->