Posts Tagged ‘QA’

http://www.barebonescoder.com/2010/06/mstest-vs-nunit-with-visual-studio-2010-tdd/

http://www.barebonescoder.com/2011/03/mstest-vs-nunit-with-visual-studio-2010-tdd-redux/

http://osherove.com/blog/2010/3/5/nunit-vs-mstest-nunit-wins-for-unit-testing.html

Advertisements

Below link has interesting article about code coverage testing using Visual Studio 2010.

http://www.buffington.com/Blog/post/2010/04/27/Visual-Studio-2010-Code-Coverage-Testing-in-10-Easy-Steps.aspx

You may not see result if you exactly follow those steps. In Step 4 don’t change selection to Trace and Test Impact. It should have Local selection as Code Coverage settings were asked to do on Local.testsettings file.

You can also use Test menu -> Test View option to run the tests.

If you are writing an API then you will have class library type projects (.dll output). You can quickly create test methods for your API methods by automatically generating the Unit Tests using “Create Unit Tests …” which you can see when you right click on any method. This will ask you to create Test Project and just follow the steps that it asks. Once Test methods are created you can comment out Assert.Inconclusive line in all test methods and provide proper input/expected variable values before running the Tests.

http://blog.coryfoy.com/2007/07/test-driving-stored-procedures-in-sql-server-in-vs2008/

Test-driven development requires developers to create automated unit tests that define code requirements (immediately) before writing the code itself. The tests contain assertions that are either true or false. Passing the tests confirms correct behavior as developers evolve and refactor the code. Developers often use testing frameworks, such as xUnit, NUnit … etc to create and automatically run sets of test cases.

Assemble Activate Assert or Arrange Act Assert is a good Pattern to follow as part of Unit Testing in TDD.

  • All TestCases first Assemble the data resources they intend to use.
  • Then they Activate a target method. (Preferrably the one you name your real test case after!)
  • Then they Assert that some side-effect, from that method, is within tolerance.

Visual Studio – supports built-in testing capabilities for following different types of tests. QAs can install Visual Studio Test Edition and can use Test Project for their testing. Use Test List Editor for selecting/running different tests.

  • Unit Test/Unit Test Wizard – helps in creating new Unit test for a class file. This will be helpful for both developers and testers to perform unit level testing.
  • Coded UI Test – used for recording the UI activities of a manual test. 
  • Database Unit Test – used for testing stored procedures and functions.
  • Generic Test – is for wrapping an executable as a test method. You can wrap the executable using generic Test and can include the same in test automation.
  • Ordered Test – is for executing multiple test scripts in a particular order. 
  • Web Performance Test – used for recording the URLs and generating the code for performance testing.
  • Load Test – is used for performing load test on an application. It simulates multiple users as virtual users and executes the test scripts to simulate the real user load on different servers like Application Server, Database server and Web server. Load test can be used with any of the test scripts. 
  1. Namespace – Microsoft.VisualStudio.TestTools.UnitTesting, Assembly – Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
  2. Few Main attributes – [TestClass], [Owner(“VJ”)], [TestMethod], [ExpectedException(typeof(ContractException), “SongId must be positive number”)]

NUnit –

  1. Uses Constraint-based modal.
  2. NUnit.Framework is the main namespace
  3. Following are the few main attributes used in many test cases …
    • [TestFixture], [SetUp], [Test], [ExpectedException(typeof(InsufficientFundsException))], [Ignore(“Decide how to implement transaction management”)], [Category(“LongRunning”)], [Culture(“fr-FR”)]
  4. Following are the main assertions used in Constraint based modal
    • Equality (Assert.AreEqual/.AreNotEqual), Condition (Assert.IsTrue/IsNull/IsEmpty/IsNan), Comparison (Assert.Greater/GreaterOrEqual/Less/LessOrEqual)

References

More about TDD refer http://en.wikipedia.org/wiki/Test-driven_development