Package romanemperorsscraper.tester
Class PersonPageDataTester
- java.lang.Object
-
- romanemperorsscraper.tester.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
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.LinkedHashMap<java.lang.String,java.lang.String>
expectedScrapedValues
private static java.util.ArrayList<java.lang.String>
FIELDS
private static int
numberOfPassedTests
private static int
numberOfTests
private static PersonNameUrl
personNameUrl
private static PersonPageData
personPageData
private static org.openqa.selenium.WebDriver
webDriver
-
Constructor Summary
Constructors Constructor Description PersonPageDataTester()
-
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 numberOfPassedTestsstatic int
doTests()
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 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 constructorstatic void
initialize(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, UnsupportedOsException
Initialize 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
-
-