1

私はJava、TestNG、およびSelenium Webdriverに比較的慣れていません(3週間)、TestNGが望んでいる方法でパラメーターを正しく渡していないようです。

テストは完全に実行されますが、次の理由で失敗したと表示されます。

org.testng.TestNGException: 
The data provider is trying to pass 2 parameters but the method com.pragmaticqa.tests.AppTest2#twoUsersSignUp takes 1

これが私のコードです:

public class AppTest2 {
     public WebDriver driver;
     public WebDriverWait wait;

         @DataProvider(name = "dataProvider")
         public Object[][] setUp() throws Exception {
         File firefoxPath = new File(System.getProperty("lmportal.deploy.firefox.path", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"));
         FirefoxBinary ffox = new FirefoxBinary(firefoxPath);
         ffox.setEnvironmentProperty("DISPLAY", ":20");
         driver = new FirefoxDriver(ffox, null);
         wait = new WebDriverWait(driver, timeoutInSeconds );
         Object[][] data = new Object[1][2];
         data[0][0] = driver;
         data[0][1] = wait;
         twoUsersSignUp(data);
         return data;
     }

     @Parameters({ "data" })
     @Test(dataProvider = "dataProvider")
     public void twoUsersSignUp(@Optional Object[][] data) throws InterruptedException{

           //test here

         }
}
4

1 に答える 1

3

データプロバイダーに入力しているデータを使用してテストメソッドを宣言する必要があるため、この場合は次のようになります。

 public void twoUsersSignUp(WebDriver d, WebDriverWait w).
于 2013-07-31T17:21:14.257 に答える