Developer Docs

Selenium tests with C#Bot

The Selenium tests in a C#Bot application are end-to-end integration tests which ensures the running application is working as expected in a browser.

Like the majority of the sections of the C#Bot testing framework, the Selenium tests utilise xUnit as the testing framework and test runner. However, the feature files which were written by the bot and any that you write are not written in a format which allows xUnit to be used. Specflow is the C# equivalent of Cucumber and will generate instances of your feature files in C#. These instances will run the relevant step definition methods, and make assertions based on the steps you have added to your tests. You do not need to modify the files created by Specflow in any way.

The Selenium tests in a Codebots application are accessible through either the Test section of the Platform or through the target application itself. In the target application they can be found here: ‘testtarget/Selenium/Tests/’. This folder contains the feature files for the tests. The step definitions can be found in ‘testtarget/Selenium/Steps/’.

Like the API tests, the Selenium tests require the application to be running to run the tests, as the tests interact with the application and gather information to make their assertions. The selenium tests are run using this command:

dotnet test

Example of a Selenium feature file

@botwritten @create
Feature: Create ExpeditionEntity

    Scenario: Create ExpeditionEntity
        Given I login to the site as a user
            And I navigate to the ExpeditionEntity backend page
            And I click to create a ExpeditionEntity
        When I create a valid ExpeditionEntity
        Then I assert that I am on the ExpeditionEntity backend page
            And I assert that I can see a popup displays a message: Successfully added Expedition

Was this article helpful?

Thanks for your feedback!

If you would like to tell us more, please click on the link below to send us a message with more details.







On this page

New to Codebots?

We know our software can be complicated, so we are always happy to have a chat if you have any questions.