|
Continuum for C#
|
Start by adding a reference to the library LevelAccess.Continuum.dll in your test project and importing the SDK namespace - this library file can be found in the lib folder.
You will then need to go through 3 steps to get up and running. These steps are:
Keep reading below for a walkthrough of this process.
First, create an instance of Continuum and pass the path to your configuration file as an argument. The path can be relative to the test project executable file, or an absolute path.
You should use the same instance of Continuum across multiple tests, so make sure to initialize it in your testing framework setup method that runs before all tests.
Second, make sure to update your configuration file with your AMP access token and any other desired preferences. Here's what the continuum.json file should look like:
This step can be done in a variety of ways and is independent of the Continuum SDK. We're providing the instructions below for your convenience, but please check the official documentation of Selenium WebDriver or WebDriverManager if you need more information.
All of the code snippets below reference the ChromeDriver as an example, but you can also use other supported Web Drivers. See the compatibility notes at the top for more details.
If you already have a Chrome driver installed in your environment and available on the system PATH, this step can be as simple as this:
If you prefer to make your test suite automatically download a matching version of the Chrome driver prior to the setup, this is the minimal implementation that you could use:
The DriverManager library accepts an instance of WebProxy with the method below:
See below a complete example of how you could configure an instance of WebProxy:
Check more details on the following documentation:
It's time to connect the two parts together. You have initialized Continuum and a WebDriver. Now, call the SetUp method of Continuum and pass your WebDriver instance as an argument:
You can run this method as many times as you want during the lifecycle of an instance of Continuum. Whenever you need to create a new instance of your WebDriver, please remember to re-execute this method with the new WebDriver instance.
This step is very important to allow Continuum to inject the accessibility scanner in your WebDriver instance whenever it's needed. You can use the same WebDriver instance for as long as you want, but anytime you need to recreate it, make sure to update it on your Continuum instance.
After following the steps above you finally have the Continuum SDK ready to use.
Once you've navigated to the page you'd like to test, invoke the appropriate Continuum method (all of which execute synchronously). For example, to run all available accessibility tests against the entirety of the current page:
You can then do whatever you like with any accessibility concerns returned, like print them out to the console, filter them for only the ones you're interested in, etc.
For AMP users, check out our documentation for the AccessibilityConcern class for a complete list of what's returned for each accessibility concern.
Other Continuum methods are available that allow you to only run particular tests or test against specific best practices. Continuum also allows you to only test a particular part of a page rather than the entire page. All of these methods are detailed in our documentation for the Continuum class.
You have the power!
Questions can be emailed to Level Access support at suppo.nosp@m.rt@l.nosp@m.evela.nosp@m.cces.nosp@m.s.com.