background preloader

Pruebas Unitarias

Facebook Twitter

Unit Testing Entity Framework 4.0: A-Z in 3 Easy Steps. This article gives you an ultra-fast run down on how to start Unit Testing in Entity Framework 4.0 using C#; applying a suitable Code Generation Item to your Entity Data Model (EDMX) file, and building a Unit Test Project in Visual Studio 2010. No external test harness is required, it doesn't rely on having a Repository pattern being implemented and you don't need to buy any new products. Just Visual Studio 2010 Professional Edition, Premium Edition or Ultimate Edition out of the box.

These steps will change your EDMX Code Generation Item to the ADO.NET Mocking Context Generator. This is what makes your C# code from your Entity Data Model (EDMX) file. Open your EDMX file, right click the background, and from the context menu select Add Code Generation Item.Select Online Templates->Database->ADO.NET Mocking Context Generator: Open your EDMX file, right click the background, and from the context menu select Properties.In the Properties change Code Generation Strategy to None. I don't unit test my classes. The "8 Commandments" of unit testing. Typemock, provider of unit testing software, recently shared what they call the "8 Commandements" of unit testing with me. It is now my turn to bestow them upon you. 1. Thou shalt not waste time on the learning curve When choosing a unit testing solution, you will want one that will require minimal time for implementation. It may be worthwhile to time a new developer within your team with the framework to get an accurate idea of how long it takes to get started.

For example – how long will it take them to write the first three tests for some class in your system? Is the API clear and simple? 2. 3. 4. Are your tests messy? 5. 6. 7. Ask yourself, what kind of technical support do you require? 8. Compare the following: Price of tool Time to get started and reach RTM test (readable, trustworthy, maintainable) Time to write tests Time to fix test because of production change (change resistance) Top 10 Mistakes in Unit Testing. JUnit: Rules (for Dummies) JUnit: Rules JUnit has a nice feature now: Rules. While I don’t like every detail of the implementation, they are basically a very good thing. This is a short introduction how to use them… What are rules Rules are basically wrappers around test methods.

How to use them Just create a public (non-static) field for the rule. Example One of my favorite rules is TemporaryFolder. The output of this test is (at least on my system): Creating tmp folder @ /tmp/junit8120700871928645940/aFolder What to do now? 1. It really is worth it. 2. No more long and ugly setup/tearDown methods. In the next posts I will show you some more rules that I find very useful…. Creating test plan in Selenium. Home > Programming / tutorials > Unit testing with Selenium September 7th, 2010 Vinay In our last Selenium – Web application testing tool , we had introduced selenium and explained different components of selenium.

In this post we will look at code examples. Selenium runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac, with plans to support Safari on iPhone soon. We will discuss here on how you can easily create automatic test scripts using Selenium IDE and convert them to JUnit tests (which uses Selenium Remote Control) which can be added to your JUnit based automatic regression test suite.

How to create a test plan in Selenium IDE Creating a test plan in Selenium IDE is very easy, so we will use it to create few simple tests to begin with. Install Selenium IDE 1.0.6 , a Firefox plugin. After installing Selenium please restart your Firefox browser for the plugin to be activated. Open / browse the site for which you want to prepare a test case.