C#: Classes - Base & Sub

  • To create a sub class,
  • add ' : <classname>' to the class statement
  • add :' base()' to the constructor
  •  


Base Class WITHOUT Arguments

  • If Base Class accepts NO arguments, the subclass doesn't need to include the 'base class constructor'
    class BaseClass
    {
        public BaseClass()
  • Constructor doesn't need an explicit reference to the base class
    class Base_SubClass : BaseClass
    {
       public Base_SubClass()
  • This is also valid & probably preferred

    class Base_SubClass : BaseClass
    {
       public Base_SubClass() : BaseClass() {}

Base Class WITH Arguments

  • If Base Class constructor TAKES arguments, the subclass constructor must include them explicitly

Tags

C#: VIsualStudio 2017 IISE Setup Considerations

Simple Answer

It looks like you are missing a binding information entry in applicationhost.config file.

  1. Open your applicationhost.config file. Possible locations are:

    • %userprofile%\Documents\IISExpress\config\applicationhost.config
    • $(solutionDir)\.vs\config\applicationhost.config (VS2015)
    • Failing that, inspect the output from iisexpress.exe to be sure.
  2. Locate your WebSite entry and add following binding with your machine name.

Win7: netsh Commands For Network Interface Settings via CLI

Dos Shell Script

@echo off
echo This script must be ran as ADMIN
set ipAddr=192.168.0.81
set subMask=255.255.255.0
set gwAddr=192.168.0.1
set dns=dhcp
set dnsAddr=208.180.42.68

echo %COMPUTERNAME% - %ipAddr% - %subMask% - %gwAddr% - %dnsAddr%
echo Setting inferace values now... CTRL-C to cancel
pause
netsh interface ip set address name="Local Area Connection" static %ipAddr% %subMask% %gwAddr%
netsh interface ip set dns "Local Area Connection" source=dhcp

netsh Commands

Show if config

netsh interface ip show config

Set if to static

netsh interface ip set address name="Local Area Connection" static 192.168.0.81 255.255.255.0 192.168.0.1

Set DNS for DHCP

netsh interface ip set dns "Local Area Connection" source=dhcp

Set DNS to static value

Tags

SpecFlow: 00 - Quick Setup & Test

  • Getting started with SpecFlow begins with setting up the environment & getting proof of concept working
  • Install VS2017, SpecFlow IDE Extension
  • Add Project
  • Install NuGet Packages for SpecFlow, NUnit & NUnit3 Test Adapter
  • Add SpecFlow Feature File
  • Generate Test Definitions
  • Replace method statement stubs with Console.Writeln() statements
  • Build project & Run Test
  • Ensure Test Passed & produced output

VisualStudio Setup

Install Visual Studio 2017 & Dependencies

SpecFlow IDE Plugin

Tools > Extensions and Updates

Search for SpecFlow & Install

SpecFlow NuGet

References > Manage NuGet Packages

Search for SpecFlow & Install

NUnit NuGet

References > Manage NuGet Packages

Search for NUnit & Install

Tags

Java POM: 09-Selenium Tricks

Common Selector Strategies

Page Title

return driver.getTitle();

 

findElement(By.id

element = driver.findElement(By.id("edit-field-tags-target-id"));
return element;

 

findElement(By.xpath

element = driver.findElement(By.xpath("//iframe[@title='Rich Text Editor, Body field']"));

 

Explicit Waits

int timeoutSec = 15;
WebDriverWait wait = new WebDriverWait(driver, timeoutSec);
wait.until((driver) -> driver.findElements(By.xpath("//a[@href='/uc/user/login']")).size()>0);
wait.until((driver) -> driver.findElement(By.xpath("//a[@href='/uc/user/login']")).isDisplayed());

 

Tags

CucumberJVM: 00 - Gherkin Language

Basic Gherkin Feature Model

Feature: User can create an article

Scenario: user logs in
Given user is on HomePage
When user navigates to LoginPage
And user enters UserName and Password
Then message displayed Login Successful

Scenario: user creates a new article
Given user is logged in and on HomePage
When user clicks CreateArticleLink
And user enters ArticleTitle
And user enters ArticleBody
And user neters ArticleTags
And user clicks NewArticleSubmitButton
Then message is displayed Article Created Successfully
And NewArticlePage title is MyNewArticle

Feature Keyword

  • Defines the functionality the test targets
  • Multiple scenarios can be created to cover this functionality
Feature: User can create an article
Feature: User can create an article

This feature will ensure a user can login and the product handles invalid credentials correctly
Feature: User can create an

SpecFlow: C# BDD Framework Runner Example(SpecFlow.org)

SpecFlow+ Getting Started

This section guides you through the process of installing SpecFlow and SpecFlow+ Runner1 and setting up a simple project in Visual Studio. The getting started guide for SpecFlow+ Excel can be found here.

The sample project is intentionally kept very simple and consists of a basic “calculator” that adds two numbers and returns the result. You will define a test scenario to automate the testing of the calculator’s code.

This guide contains the following sections:

Subscribe to