Class DynastyTester


  • public class DynastyTester
    extends java.lang.Object
    Class used to test the scraping of dynasty information (Wikipedia page title, foundation and deposition date and the founder name and Wikipedia page URL). This test is relative to the Julio-Claudian Dynasty.
    Author:
    Matteo Collica, Sara Lazzaroni, Radu Ionut Barbalata
    See Also:
    Dynasty, Tester
    • Constructor Summary

      Constructors 
      Constructor Description
      DynastyTester()  
    • 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 Dynasty 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 the Julio-Claudian Dynasty and get its information through the Dynasty object constructor
      static void initialize​(org.openqa.selenium.WebDriver webDriver)
      Get information of the Julio-Claudian Dynasty through the Dynasty 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
      • dynasty

        private static Dynasty dynasty
      • 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

      • DynastyTester

        public DynastyTester()
    • Method Detail

      • initialize

        public static void initialize​(org.openqa.selenium.WebDriver webDriver)
        Get information of the Julio-Claudian Dynasty through the Dynasty 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 Dynasty 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