Tuesday, May 17, 2016

3rd party plugin/api’s for writing better test cases in Mvc

Tools for automating test cases are WaitN , Lightweight Test Automation Framework, Selenium(automating web applications for testing purposes).

SpecBind Selenium Module -- An extension to SpecBind that allows it to integrate with Selenium

1. What is SpecBind?

SpecBind is an extension to SpecFlow that uses common language steps to allow a user to define interaction with an application. Unlike conventional SpecFlow where the user needs to define how each step definition interacts with the host system, SpecBind uses conventions and a thin page model to minimize coding efforts and maximize flexibility when defining the link between specifications and working sites.
Bridges the SpecFlow and popular UI automation frameworks to simplify acceptance tests. For more info https://github.com/dpiessens/specbind/wiki#Linking-Navigation http://www.specflow.org/
If you are new to spec flow please go through the link http://www.specflow.org/getting-started/

2. What is Fluent Assertions?

Fluent Assertions is a set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test.
FluentAssertions is an alternative assertion library for unit tests, to use instead of the methods in Assert class that Microsoft provides. It has much better support for exceptions and some other stuff that improves readability and makes it easier to produce tests.

3. What is moq testing? 

Moq is a third party library/framework that enables you to create the dummy class and its methods’ dummy implementation without actually creating a class with actual method implementation. Here you need to note that you need to provide the interface name for creating dummy class which will implement interface methods as dummy. This is very useful in the scenarios where you want to test the functionality of a class without implementing the other classes and their methods on which the test candidate class is dependent on.

4. Create test data with NBuilder and Faker

For many web applications you may want to generate some initial, semi-realistic test data for your development and testing environments. Entity Framework provides a handy mechanism through which you can achieve this, namely seed data.
When it comes to generating the test data, I personally make use of two 3rd party libraries, namely NBuilder and Faker.NET. Both these libraries have not been updated for a long time, but they still work just fine. http://www.jerriepelser.com/blog/creating-test-data-with-nbuilder-and-faker
Faker.NET is a port of a popular Ruby project called faker. It allows you to generate a wide range of realistic looking data, including names, addresses, telephone numbers, internet domains, sentences, etc.

6. What is AutoMapper in mvc? 

AutoMapper is used to reduce the complexity we find when binding the model and communicating with entities. http://www.c-sharpcorner.com/UploadFile/tirthacs/using-automapper-in-mvc/

AutoMapper is an open source library provided by GitHub. The Codeplex page says about AutoMapper: “AutoMapper is an object-object mapper. Object-object mapping works by transforming an input object of one type into an output object of a different type. What makes AutoMapper interesting is that it provides some interesting conventions to take the dirty work out of figuring out how to map type A to type B. As long as type B follows AutoMapper's established conventions, almost zero configurations is needed to map two types”. As per the definition it solves our issue. You can get the AutoMapper from the following website:AutoMapper.


No comments:

Post a Comment