Giter Club home page Giter Club logo

triplebeta / specbyexampleextension Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 10.12 MB

Visual Studio extension to get you started testing websites with Specflow and Selenium. In under 5 minutes you can setup a Visual Studio solution with a test project and add your first SpecFlow scenario test that will open a website in Chrome and perform a simple action on it.

License: Apache License 2.0

C# 76.10% HTML 23.46% CSS 0.39% JavaScript 0.05%
specflow selenium visual-studio-extension csharp t4 project-template

specbyexampleextension's Introduction

Extension for testing web applications using Selenium and SpecFlow

This Visual Studio extension was created to simplify using Selenium with SpecFlow and to get a working setup in under 5 minutes. The extension containing a Project and Items templates to get started testing websites with Specflow and Selenium in under 5 minutes.

It contains a number of components to get you started quickly: Your can have your first Selenium-based SpecFlow test running in under 5 minutes if you follow just the quick tutorial.

Getting started

Prerequisites

Make sure you installed the SpecFlow extension since this is a prerequisite for the SpecByExample extension. SpecFlow extension image

In case you want to change the generated code by updating the T4 templates, you may want to install the excellent T4 Toolbox extension of Oleg Sych as well. More information can be found on the home of T4 Toolbox. T4 Toolbox extension image

What's in the extension?

After installing it you will find some extra templates:

  • a Project Template to setup the test projects
  • an Item Template that allows you to import the web page you want to test Item templates

How does it work?

The Project Templates creates 3 projects to set the stage. In the Pages project you can add a new item and choose the template named "SpecByExample Page Adapter". This will show a wizard where you can select the url for your page. In case you just want to test with an example site you can use: SpecByExample Sample Website http://specbyexamplesamplewebsite.azurewebsites.net/ Wizard

This wizard parses the HTML of the webpage and extracts the containers (divs, spans) and controls (input, button, ...). At completion it will create a .webmodel file in your project containing all of these. For each control it registers how it can be found in the page, the name of the C# property to generate for it and more details. Then it registers a custom tool (PageAdapterGenerator) for the webmodel file.

The custom tool uses T4 templates to generate C# code from the webmodel. It will create a class representing the webpage (GoF Adapter pattern) in which each identified control will appear as a property. Each control propery is typed as one of the Control types such as Button, Link or Listbox. These control types are adapters for the controls and allow you to easily interact with its underlying HTML element.

Optionally, the custom tool can generate a Steps file for this webmodel, containing Steps like "I click button Login".

Extensibility

The page adapter and steps classes are defined as partial and can easily be extended. All code generation can be customized by adding the underlying T4 templates to your solution. To do so, use the template "SpecByExample T4 Templates".

You can also create your own control adapters and automatically use them by adding them to the Control Adapter Mapping Configuration. Add an item to your Pages project using the template "SpecByExample Control Adapter Mapping Configuration" and add your mapping.

specbyexampleextension's People

Contributors

triplebeta avatar

Watchers

 avatar

specbyexampleextension's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.