Package romanemperorsscraper.tester
Class PersonPageDataTester
- java.lang.Object
-
- romanemperorsscraper.tester.PersonPageDataTester
-
public class PersonPageDataTester extends java.lang.ObjectClass 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
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.LinkedHashMap<java.lang.String,java.lang.String>expectedScrapedValuesprivate static java.util.ArrayList<java.lang.String>FIELDSprivate static intnumberOfPassedTestsprivate static intnumberOfTestsprivate static PersonNameUrlpersonNameUrlprivate static PersonPageDatapersonPageDataprivate static org.openqa.selenium.WebDriverwebDriver
-
Constructor Summary
Constructors Constructor Description PersonPageDataTester()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddoTest(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 numberOfPassedTestsstatic intdoTests()Compare scraped value with expected value for each PersonPageData object's fieldstatic java.util.LinkedHashMap<java.lang.String,java.lang.String>getExpectedScrapedValues()static java.util.ArrayList<java.lang.String>getFields()static intgetNumberOfTests()static voidinitialize()Initialize the WebDriver needed to scrape data from the Wikipedia page of Augusto and get its information through the PersonPageData object constructorstatic voidinitialize(org.openqa.selenium.WebDriver webDriver)Get information of Augusto through the PersonPageData object constructor
-
-
-
Field Detail
-
webDriver
private static org.openqa.selenium.WebDriver webDriver
-
personPageData
private static PersonPageData personPageData
-
personNameUrl
private static PersonNameUrl personNameUrl
-
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
-
-
Method Detail
-
initialize
public static void initialize() throws NoSupportedBrowsersException, UnsupportedOsExceptionInitialize the WebDriver needed to scrape data from the Wikipedia page of Augusto and get its information through the PersonPageData object constructor- Throws:
NoSupportedBrowsersException- if there are no supported browsers installed in user's Operating SystemUnsupportedOsException- if the user's Operating System isn't supported (not a Windows, macOS or Unix-based one)
-
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 valuescrapedValue- 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
-
-