Skip to content

Initial startup project for selenium tests [C#] [XUnit] [Chrome] [Firefox] [IE]

Notifications You must be signed in to change notification settings

squirrel5853/SeleniumProjectTemplate

Repository files navigation

SeleniumProjectTemplate

initial startup project for selenium tests

Quick FAQ

Frameworks?

.Net Core 2.2 XUnit Selenium

Won't Compile

You must select a build configuration (See Step 8)

No Tests

There are no tests out of the box, you must create your own (See Step 5,6,7) Inherit from UITestBase for easier support Remember to use the attribute [Fact] or [Theory] for tests to be detected.

Test Browsers

I have created web drivers for IE, Firefox and Chrome.

Setup Walkthrough (12 Steps)

Step 1

After cloning the repo, you can either just use the already created packaged zip (recommended) or create a project template from the project. Once you have a zip file you can then drop this in the Visual Studio Template Project Folder. Step1

Step 2

Start Visual Studio (visual studio must be restarted to detect changes) Select to start a new project and use the search bar to search for "Selenium" Step2

Step 3

Name your project as usual Step3

Step 4

You will now be presented with a blank project with all the required nuget packages required for Selenium tests. There is also a skelaton structure setup with base code to instantiate web drivers. Step4

Step 5

To get started, just create a new code file Step5

Step 6

Naming it as usual Step6

Step 7

Then write your first test (ensure to inherit from UITestBase) Step7

Step 8

Before it will compile, you must select the browser you wish to use. This is done using Build Configurations. Step8

Step 9

Navigate to the Test Explorer, this will list all tests within the project/solution. Step9

Step 10

If nothing is showing, ensure you have tagged all your test methods with either [Fact] or [Theory] Step10

Step 11

Run the test and see what happens. A browser instance should be started by the Selenium framework and test gets executed. Results of test shown in the test explorer Step11

Step 12

After debugging tests (using the same context menu to run tests), spotted that the text is empty for input control. Changed to use GetAttribute method of Value and then re-ran the tests. Step12

Enjoy

About

Initial startup project for selenium tests [C#] [XUnit] [Chrome] [Firefox] [IE]

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages