Specify testing scope in Automated tests
Define the testing scope for automated app accessibility testing within your test suite.
You might want to include accessibility tests only for certain device combinations or test cases. In that case, you can limit the scope of accessibility tests to specific device combinations or test cases.
Test on specific device combinations
In the configuration file, include or exclude specific device combinations from your testing scope by setting the accessibility
flag for the preferred device combination.
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
buildName: "Your static build/job name goes here"
projectName: "Your static project name goes here"
...
platforms:
- platformName: android
deviceName: Samsung Galaxy S22
platformVersion: 12.0
accessibility: true # Testing will be conducted on this device combination
- platformName: android
deviceName: Google Pixel 6
platformVersion: 13.0
accessibility: false # Testing will not be conducted on this device combination
...
For Android devices, App Accessibility automated tests are supported on version 11 and above.
Test specific test cases
Define tags for the tests you want to run in your test case file.
public class FirstTest extends AppiumTest {
private void navigateToSearchResults() throws Exception {
// Common setup steps for both tests
WebElement skipButton = (WebElement) new WebDriverWait(driver, Duration.ofSeconds(30)).until(
ExpectedConditions.presenceOfElementLocated(AppiumBy.id("org.wikipedia.alpha:id/fragment_onboarding_skip_button")));
skipButton.click();
WebElement searchElement = (WebElement) new WebDriverWait(driver, Duration.ofSeconds(30)).until(
ExpectedConditions.elementToBeClickable(AppiumBy.accessibilityId("Search Wikipedia")));
searchElement.click();
WebElement insertTextElement = (WebElement) new WebDriverWait(driver, Duration.ofSeconds(30)).until(
ExpectedConditions.elementToBeClickable(AppiumBy.id("org.wikipedia.alpha:id/search_src_text")));
insertTextElement.sendKeys("BrowserStack");
Thread.sleep(5000);
}
@Test(groups = "search")
public void testSearchFunctionality() throws Exception {
navigateToSearchResults();
List<WebElement> allProductsName = driver.findElements(AppiumBy.className("android.widget.TextView"));
Assert.assertTrue(allProductsName.size() > 0);
}
@Test(groups = "accessibility")
public void testAccessibilityScan() throws Exception {
navigateToSearchResults();
Map<String, Object> summary = AccessibilityUtils.getResultsSummary(driver);
System.out.println("=== Accessibility Summary ===");
for (Map.Entry<String, Object> entry : summary.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof Map) {
System.out.println(key + ":");
Map<?, ?> nestedMap = (Map<?, ?>) value;
for (Map.Entry<?, ?> nestedEntry : nestedMap.entrySet()) {
System.out.println(" " + nestedEntry.getKey() + " = " + nestedEntry.getValue());
}
} else {
System.out.println(key + " = " + value);
}
}
}
}
Include or exclude test cases from the testing scope based on their tag, annotation, or groups. These need to be specified under the accessibilityOptions
key in your configuration file.
...
accessibilityOptions:
wcagVersion: wcag21aa
includeTagsInTestingScope: ["accessibility"] # This test case will be included in the test.
excludeTagsInTestingScope: ["search"] # This test case will be excluded from the test.
scannerProcessingTimeout: 10
includeIssueType:
bestPractice: false
...
Access the report in your project folder on the App Accessibility dashboard.
Additionally, here are some important considerations for the inclusion & exclusion list:
- If no tags are found in either list, testing will take place on all test cases.
- If tags are found in both lists, the final set of test cases will be identified for testing by removing the exclusion list test cases from the inclusion list test cases.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!