Skip to content

Latest commit

 

History

History
51 lines (43 loc) · 2.67 KB

sc_wikipedia.md

File metadata and controls

51 lines (43 loc) · 2.67 KB

Showcase: Wikipedia page test

Scenario : Test a HTML structure of "United States" page using static expected values.

This scenario covers to test between html values and static values in CSV.

Test details

  1. Get a actual html document from Web App.
  2. Assert HTTP response header and/or document values using expected values in CSV file.

sample1

Setup steps

  1. Create a test project.
  2. Install Tatami library from nuget.org then sets this into the project.
  3. Create a BaseUriMapping.xml
  4. Create a UserAgentMapping.xml
  5. Create a CSV file including test cases.
  6. Create a test method.
  7. Run test.
[TestMethod]
public async Task TestWikipediaWithUnitedStatesPage()
{
    // Arrange
    var testCasesCsv = await new HttpClient().GetStringAsync(
        "https://docs.google.com/spreadsheets/d/1Gvnq2NlBXyrnsjBH0Xr-R8U0f9RLeCR9RH5eAdTL_XE/export?format=csv&id=1Gvnq2NlBXyrnsjBH0Xr-R8U0f9RLeCR9RH5eAdTL_XE&gid=0");
    var baseUriMappingXml = File.ReadAllText(@"Wikipedia\BaseUriMapping.xml");
    var userAgentMappingXml = File.ReadAllText(@"UserAgentMapping.xml");
    var testExecutor = new TestExecutor(testCasesCsv, baseUriMappingXml, userAgentMappingXml);

    // Act
    var result = await testExecutor.TestAsync();

    // Assert
    if (!string.IsNullOrWhiteSpace(result.FailedMessage))
    {
        Assert.Fail(result.FailedMessage);
    }
}