-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
Hello,
I am getting "Parameter 'browser' is required by @configuration on method setUp but has not been marked @optional or defined" message while running my test class
I have extended my base class to test class as well as I have added browser and url values in testng xml
Please refer code below
Base class
public class Baseclass_1
{
public static WebDriver driver;
@Parameters({"browser","url"})
@BeforeClass
public void setUp(String browser,String url)
{
if(browser.equalsIgnoreCase("firefox"))
{
System.setProperty("webdriver.gecko.driver","G:\\Javaprogramming\\Selenium\\Selenium Setup\\geckodriver.exe");
driver=new ChromeDriver();
}
else if(browser.equalsIgnoreCase("chrome"))
{
}
driver.get(url);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@AfterClass
public void tearDown()
{
driver.quit();
}
===================================================================
Test class
public class FBTestnew extends Baseclass_1
{
WebDriver driver;
@Test
public void LogintoFB()
{
// Baseclass_1.setUp("firefox","https://www.facebook.com/");
FBHome FB_Hpme =PageFactory.initElements(driver, FBHome.class);
FB_Hpme.LogintoFB("username", "password");
}
}
Testng xml
<classes>
<class name="Com.Browser.Baseclass_1" />
</classes>
</test>
FAILED CONFIGURATION: @BeforeClass setUp
org.testng.TestNGException:
Parameter 'browser' is required by @configuration on method setUp but has not been marked @optional or defined
Where as on running testng by executing Run As TestNG Suite, following error seen.
[RemoteTestNG] detected TestNG version 6.8.0
[TestNG] Running:
G:\Javaprogramming\Maven2\testng.xml
Parameterization Test Suite
Total tests run: 0, Failures: 0, Skips: 0
Can Anyone help me?
Metadata
Metadata
Assignees
Labels
No labels