Posts

Showing posts with the label C#

Cheatsheet from Java to C# to Swift to VS2017

Image

From Delegates to Anonymous Delegates to Lambda

Image
" Delegate " is actually the name for a variable that holds a reference to a method A delegate is comparable to a function-pointer; a "method handle" as an object, if you like, i.e. Func < int , int , int > add = ( a , b ) => a + b ; is a way of writing a delegate that I can then call. Delegates also underpin eventing and other callback approaches. Anonymous methods are the 2.0 short-hand for creating delegate instances, for example: someObj . SomeEvent += delegate { DoSomething (); }; they also introduced full closures into the language via "captured variables" C# 3.0 introduces Lambdas , which can produce the same as anonymous methods: Lambda expressions are a simpler syntax for anonymous delegates and can be used everywhere an anonymous delegate can be used. However, the opposite is not true. Lambdas can also be compiled into expression trees for full LINQ against (for example) a database. You can't...

Duck Casting Framework / Duck Typing

Image
What is Duck Casting / Duck typing Framework ? (also sometimes incorrectly described as  Latent Typing as Ian Griffiths explains in his campaign to disabuse that notion ) for .NET languages The term duck typing is popularly explained by the phrase If it walks like a duck and quacks like a duck, it must be a duck. Wiki Says: In computer programming with object-oriented programming languages, duck typing is a style of typing in which an object's methods and properties determine the valid semantics, rather than its inheritance from a particular class or implementation of an explicit interface. The name of the concept refers to the duck test. What it actually means: Duck typing allows an object to be passed in to a method that expects a certain type even if it doesn’t inherit from that type. All it has to do is support the methods and properties of the expected type in use by the method. I emphasize that last phrase for a reason. Suppose we have a method ...

Crawler-Lib Concurrency Testing

Image
The Crawler-Lib Concurrency Testing Helper allows to write unit tests with multiple threads to test the concurrency behavior of components. It has synchronization mechanisms to control the workflow of the threads and to record the execution steps.  It is also possible to use it for client/server tests like PNUnit, but in one test.  It can be used in conjunction with any unit test framework or with simply handwritten tests. It is also possible to use it for client/server tests.

Coypu - magic for Selenium

Image
Coypu is an advanced wrapper for Selenium. Coypu supports browser automation in .Net to help make tests readable, robust, fast to write and less tightly coupled to the UI. If your tests are littered with sleeps, retries, complex XPath expressions and IDs dug out of the source with FireBug then Coypu might help. As coypu has evolved over a period of time, the tool understood the pain points of selenium testers, hence you don’t really have to think of Creating browser object and working with different browsers Finding controls by complex Xpaths, CSS etc Coypu is A robust wrapper for browser automation tools on .Net, such as Selenium WebDriver that eases automating ajax-heavy websites and reduces coupling to the HTML, CSS & JS A more intuitive DSL for interacting with the browser in the way a human being would, inspired by the ruby framework Capybara -  http://github.com/jnicklas/capybara install nuget package  Install-Package Coypu visit https...

How to fix .NET Framework 3.5 Error 0x800f081f in Windows 10

Image

VS 2017 + SpecFlow + Random error + Windows10 + .Net Framework 2.0 and 3.0

Image
Error The "TechTalk.SpecFlow.Tools.MsBuild.GenerateAll" task could not be loaded from the assembly ~\packages\SpecFlow.Plus.Excel.1.2.0\tools\specflow.exe. Could not load file or assembly 'Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask Solution: So I decided to get to specflow.exe from here ~\packages\SpecFlow.Plus.Excel.1.2.0\tools and when I double click the exe Voila: It says that my machine is missing .NET Framework 2.0 3.0 and 3.5 in Windows 10 This particular app requires the older .NET Framework 3.0. Although the newer .NET Frameworks will try to emulate backwards compatibility, and developers can code to allow different versions,...

Tools and technologies - Test Automation awesomeness - C#

Image
Here is a quick overview of the top 6 programming languages used and the various flavors of testing: Let's continue with C#: 2.  C# Happy C# testing!

Open Source Test Automation Frameworks

Image
Every-time I read Joe Colantonio's posts I learn something new and this time it was a newbie called Gauge. If you don't know what it is here are the 6 opensource frameworks Joe talks about: Serenity (Formally Thucydides) Robot Framework RedwoodHQ Sahi Galen  Framework Gauge Update:  Two more to the list: An old one  Open2Test New:  Extensive Testing Further Reading:  http://www.joecolantonio.com/2016/05/10/6-open-source-test-automation-frameworks-need-know/

LeanFT - Proof of Concept

Image
Findings and POC for using LeanFT as part of the Contentious Integration build: LeanFT uses the UFT SDK  Allows coding your tests in C# and Java in your favorite IDE (documentation is focused around Visual Studio and Eclipse) Any add-in can be automated Standard Windows, WPF, .NET, Mobile etc.. Prerequisite: You should now see:  C:\Program Files (x86)\HP\LeanFT\bin Browser Prerequisite: In the Firefox browser menu, select Add-ons and then click Extensions. Drag the Agent.xpi file from the%LeanFT%\Installations\Firefox folder to the Firefox Extension page and click ‘Install now’. If you are testing against Chrome ensure the LeanFT plugin is enabled from Chrome Settings -> Extensions. With IE, go to Settings -> Manage Addons where HP Functional Testing Agent must be enabled. Download the sdk jars/dll: https://github.com/upgundecha/lftexamples SDK reference: http://leanft-help.saas.hp.com/en/latest/JavaSDKReference/index.html