Package romanemperorsscraper.tester
Class DynastyTester
- java.lang.Object
-
- romanemperorsscraper.tester.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.
-
-
Field Summary
Fields Modifier and Type Field Description private static Dynasty
dynasty
private static java.lang.String
DYNASTYNAME
private static java.lang.String
DYNASTYURL
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 org.openqa.selenium.WebDriver
webDriver
-
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 numberOfPassedTestsstatic int
doTests()
Compare scraped value with expected value for each Dynasty 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 the Julio-Claudian Dynasty and get its information through the Dynasty object constructorstatic void
initialize(org.openqa.selenium.WebDriver webDriver)
Get information of the Julio-Claudian Dynasty through the Dynasty object constructor
-
-
-
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
-
DYNASTYNAME
private static final java.lang.String DYNASTYNAME
- See Also:
- Constant Field Values
-
DYNASTYURL
private static final java.lang.String DYNASTYURL
- See Also:
- Constant Field Values
-
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 the Julio-Claudian Dynasty and get its information through the Dynasty 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 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 valuescrapedValue
- 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
-
-