我正在尝试在 Selenium webdriver 中运行此方法,但我继续收到此错误:
org.testng.TestNGException:
Method PopulateBorrower requires 2 parameters but 0 were supplied in the @Test annotation.
at org.testng.internal.Parameters.checkParameterTypes(Parameters.java:198)
at org.testng.internal.Parameters.createParameters(Parameters.java:134)
at org.testng.internal.Parameters.createParameters(Parameters.java:370)
at org.testng.internal.Parameters.handleParameters(Parameters.java:447)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1384)
at org.testng.internal.Invoker.createParameters(Invoker.java:1075)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1180)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:128)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1203)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
at org.testng.TestNG.run(TestNG.java:1036)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
--------->我做错了什么?代码如下。我在 SetUpBase 单独的类中设置了它。
@Test
public static void PopulateBorrower(String PrimaryBorrowerBaseName1,String PrimaryBorrowerBaseName)
{
String fName= PrimaryBorrowerInputDictionary.get(BorrowerFirstNameElement);
String lName=PrimaryBorrowerInputDictionary.get(BorrowerLastNameElement);
String suffix=PrimaryBorrowerInputDictionary.get(BorrowerSuffixElement);
String social=PrimaryBorrowerInputDictionary.get(BorrowerSocialSecurityNumberElement);
String homePhone=PrimaryBorrowerInputDictionary.get(BorrowerHomePhoneNumberElement);
String schoolYears=PrimaryBorrowerInputDictionary.get(BorrowerYearsInSchoolElement);
driver.findElement(By.id(PrimaryBorrowerBaseName1 + BorrowerFirstNameElement)).sendKeys(fName);
driver.findElement(By.id(PrimaryBorrowerBaseName1 + BorrowerLastNameElement)).sendKeys(lName);
driver.findElement(By.id(PrimaryBorrowerBaseName1 + BorrowerSuffixElement)).sendKeys(suffix);
driver.findElement(By.name(PrimaryBorrowerBaseName + BorrowerHomePhoneNumberElement)).sendKeys(social);
driver.findElement(By.name(PrimaryBorrowerBaseName + BorrowerHomePhoneNumberElement)).sendKeys(homePhone);
driver.findElement(By.name(PrimaryBorrowerBaseName + BorrowerYearsInSchoolElement)).sendKeys(schoolYears);
driver.findElement(By.name(PrimaryBorrowerBaseName +BorrowerMarriageStatusElement )).click();
assertEquals(driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerFirstNameElement))
.getText(), fName);
assertEquals(driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerLastNameElement))
.getText(), lName);
assertEquals(driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerSuffixElement))
.getText(), suffix);
assertEquals(driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerHomePhoneNumberElement))
.getText(), homePhone);
assertEquals(driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerYearsInSchoolElement))
.getText(), schoolYears);
assertTrue(driver.findElement(By.id(PrimaryBorrowerBaseName + BorrowerMarriageStatusElement))
.isSelected());
}