Counting posts

This test case deals with counting of the number of posts currently available in the blog, using the following code: 

@Test 
public void testCountPost() {
AdminLoginPage loginPage =
PageFactory.initElements(driver, AdminLoginPage.class);
AllPostsPage allPostsPage = loginPage.login(username, password);
Assert.assertEquals(allPostsPage.getAllPostsCount(), 1);
}

The following is the sequence of steps executed in the preceding test script to test counting the number of posts in the WordPress blog:

  1. It creates an instance of the AdminLoginPage PageObject that uses the driver instance created in the previous step.
  2. Once it gets the instance of the AdminLoginPage PageObject, it uses the login service to log into the WordPress Admin console. The login service, in return, gives out an instance of the AllPostsPage PageObject instance to the test script.
  3. The test script uses the instance of the AllPostsPage PageObject obtained in the previous step to use one of the many services provided by the All Posts page. In this case, it uses the getAllPostsCount service.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.154.171