public class LoginPageTest extends TestBase
{
LoginPage loginPage;
HomePage homePage;
public LoginPageTest()
{
super();
}
@BeforeMethod
public void setUp()
{
initialization();
loginPage = new LoginPage();
}
@Test(priority=1) //Test Case 1
public void loginPageTitleTest()
{
String title = loginPage.validateLoginPageTitle();
Assert.assertEquals(title, "#1 Free CRM software in the cloud for sales and service");
}
@Test(priority=2) //Test Case 2
public void crmLogoImageTest()
{
boolean flag = loginPage.validateCRMImage();
Assert.assertTrue(flag); //If Flag is True, Assertion will be Passed.
}
@Test(priority=3) //Test Case 3
public void loginTest()
{
homePage = loginPage.login(property.getProperty("Username"),property.getProperty("Password") );
}
@AfterMethod
public void tearDown()
{
driver.quit();
}
}
配置失败@BeforeMethod
设置:
[RemoteTestNG] detected TestNG version 6.11.0
FAILED CONFIGURATION: @BeforeMethod setUp
java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
at org.openqa.selenium.remote.service.DriverService$Builder.<init>(DriverService.java:250)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.<init>(ChromeDriverService.java:98)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:91)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at com.crm.qa.BaseClass.TestBase.initialization(TestBase.java:45)
at com.crm.qa.TestCases.LoginPageTest.setUp(LoginPageTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)