无法在mac中执行testng

时间:2018-03-08 09:47:24

标签: java macos testng

我得到这样的输出:

=============================================== 套件总测试运行: 1,故障:0,跳过:1配置失败:1,跳过:2 ================================= ==============

执行没有发生。

@BeforeMethod
public void executePreConfigFile()
{
    String browserType = GenericUtilLib.getExcelData("./excelLib/TestData.xls", "config", 0, 1);
    String url = GenericUtilLib.getExcelData("./excelLib/TestData.xls", "config", 1, 1);
    if(browserType.equals("GC"))
    {
        System.setProperty("webdriver.chrome.driver", "./browserdriverlib/chromedriver");
        driver = new ChromeDriver();
    }
    else if(browserType.equals("IE"))
    {
        System.setProperty("webdriver.ie.driver", "./browserdriverlib/IEDriverServer.exe");
        driver = new InternetExplorerDriver();
    }
    else
    {
        FirefoxProfile profile = new FirefoxProfile();
        profile.setPreference("browser.download.folderList", 2);
        profile.setPreference("browser.download.dir", "C:\\" ); 
        profile.setPreference("plugin.disable_full_page_plugin_for_types", "application/pdf" );
        profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/csv,text/csv,application/pdfss, application/excel" );
        profile.setPreference("browser.download.manager.showWhenStarting", false );
        profile.setPreference("pdfjs.disabled", true );
        System.setProperty("webdriver.gecko.driver", "./browserdriverlib/geckodriver.exe");
        DesiredCapabilities capabilities = DesiredCapabilities.firefox();
        capabilities.setCapability("marionette", true);
        System.setProperty("webdriver.firefox.marionette", "./browserdriverlib/geckodriver.exe");
        driver = new FirefoxDriver();
    }

    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    driver.get(url);
    System.out.println("Browser Type Opened:" +browserType);
    System.out.println("URL is:"+url);  
}

@AfterMethod
public void executePostConfigFile()
{
    driver.quit();
    System.out.println("Browser Terminated");
}

0 个答案:

没有答案