Class PersonPageDataTester


  • public class PersonPageDataTester
    extends java.lang.Object
    Class used to test the scraping of people' information (reign period, birth and death date, successor, spouses, children, adopted children, father, [...]). This test is relative to the Roman Emperor "Augusto" of the Julio-Claudian Dynasty.
    Author:
    Matteo Collica, Sara Lazzaroni, Radu Ionut Barbalata
    See Also:
    PersonPageData, PersonNameUrl, Tester
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void doTest​(java.lang.String expectedValue, java.lang.String scrapedValue)
      Perform a single test by comparing an expected value with a scraped value Update expectedScrapedValues by adding the expected value as key and the scraped value as value, numberOfTests and numberOfPassedTests
      static int doTests()
      Compare scraped value with expected value for each PersonPageData object's field
      static java.util.LinkedHashMap<java.lang.String,​java.lang.String> getExpectedScrapedValues()  
      static java.util.ArrayList<java.lang.String> getFields()  
      static int getNumberOfTests()  
      static void initialize()
      Initialize the WebDriver needed to scrape data from the Wikipedia page of Augusto and get its information through the PersonPageData object constructor
      static void initialize​(org.openqa.selenium.WebDriver webDriver)
      Get information of Augusto through the PersonPageData object constructor
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • webDriver

        private static org.openqa.selenium.WebDriver webDriver
      • numberOfTests

        private static int numberOfTests
      • numberOfPassedTests

        private static int numberOfPassedTests
      • FIELDS

        private static final java.util.ArrayList<java.lang.String> FIELDS
      • expectedScrapedValues

        private static java.util.LinkedHashMap<java.lang.String,​java.lang.String> expectedScrapedValues
    • Constructor Detail

      • PersonPageDataTester

        public PersonPageDataTester()
    • Method Detail

      • initialize

        public static void initialize​(org.openqa.selenium.WebDriver webDriver)
        Get information of Augusto through the PersonPageData object constructor
        Parameters:
        webDriver - the WebDriver needed to scrape data from the Wikipedia page
      • doTest

        public static void doTest​(java.lang.String expectedValue,
                                  java.lang.String scrapedValue)
        Perform a single test by comparing an expected value with a scraped value Update expectedScrapedValues by adding the expected value as key and the scraped value as value, numberOfTests and numberOfPassedTests
        Parameters:
        expectedValue - the expected value
        scrapedValue - the scraped value
      • doTests

        public static int doTests()
        Compare scraped value with expected value for each PersonPageData object's field
        Returns:
        numberOfPassedTests (the number of passed tests)
      • getNumberOfTests

        public static int getNumberOfTests()
        Returns:
        the total number of tests
      • getFields

        public static java.util.ArrayList<java.lang.String> getFields()
        Returns:
        an ArrayList of fields
      • getExpectedScrapedValues

        public static java.util.LinkedHashMap<java.lang.String,​java.lang.String> getExpectedScrapedValues()
        Returns:
        a LinkedHashMap (which follows the same order of fields) of expected value : scraped value entries