SlideShare a Scribd company logo
1 of 17
Unit Testing and Test Driven Development Using VS 2010 Abhimanyu Singhal Lead Consultant iMentor Knowledge Services
Introduce Unit Testing Features How to create Team Test unit tests. Generating the unit test method stubs for an assembly Using a test driven development (TDD) Objectives
Thinking about tests pushes developer to understand better the gathered requirements Reduces the over engineered code (dead code) Unit Tests help to check that any new modification wont break the existing features. TDD increases software flexibility TDD code is more decoupled Why is TDD Good
A Visual Studio integrated unit-testing framework Code generation of test method stubs.  Running tests within the IDE.  Incorporation of test data loaded from a database.  Code coverage analysis once the tests have run.  Visual Studio Team Test
Designates a Method as a Test Method Found in Microsoft.VisualStudio.QualityTools.UnitTesting.Framework Namespace TestMethod has to be an instance method with no paramters Method name is irrelevant because reflection searches for TestMethod Attribute TestMethodAttribute Class
Class containing the test method is designated TestClass Attribute ,[object Object]
Team Test Uses Reflection to find Class with TestClass Attribute and Method with TestMethod Attribute and runs itTestClassAttribute Class
From Visual Studio As Part of Build Process From Command Line Running and Executing Tests
Takes a Parameter which is Exception Type to watch for If Exception does not occur test fails The Second parameter (string) is optional is the error message displayed when exception is not thrown ExpectedException Attribute
Use Test Properties Window Add TestData Attribute Source Type Connection String TableName DataAccessMethod Loading Test Data From Database
Provides associated data through  DataRow Property TestDirectory, TestName Mesuring Test Time using  BeingTimer()  EndTimer() The TestContext
Determines how much code is tested Shows Percentage of Code Executed Highlights code to show which lines are executed Code Coverage
TestInitialize Attribute TestCleanup Attribute Code to be run before and after each test method Other Attributes for Lifetime Methods AssemblyInitializeAttribute/AssemblyCleanupAttribute ClassInitializeAttribute/ClassCleanupAttribute. Initializing and Cleaning Up Tests
The Testing Framework
Keep Testing Code in Separate Assemblies Check for cleanup during test setup and execute the cleanup prior to the setup as necessary Avoid creating dependencies between tests, each test should be autonomous.  Create one test class corresponding to each class within the production code. Avoid creating other machine dependent tests Create mock objects to test interfaces Guidance – Unit Testing
To update the attendance for the session and obtain learning credits log on to https://ch1workspaces/sites/SW23/MS_Course_nominations/default.aspx Question and Answers Session
Thank You abhimanyu@imentor.co.in @abhi_singhal http://www.imentor.co.in/blog

More Related Content

What's hot (20)

Embrace Unit Testing
Embrace Unit TestingEmbrace Unit Testing
Embrace Unit Testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Unit test
Unit testUnit test
Unit test
 
NUnit Features Presentation
NUnit Features PresentationNUnit Features Presentation
NUnit Features Presentation
 
TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010
 
RIA 05 - Unit Testing by Ajinkya Prabhune
RIA 05 - Unit Testing by Ajinkya PrabhuneRIA 05 - Unit Testing by Ajinkya Prabhune
RIA 05 - Unit Testing by Ajinkya Prabhune
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 
Nguyenvandungb seminar
Nguyenvandungb seminarNguyenvandungb seminar
Nguyenvandungb seminar
 
Moq presentation
Moq presentationMoq presentation
Moq presentation
 
Test driven development in .Net - 2010 + Eclipse
Test driven development in .Net - 2010 + EclipseTest driven development in .Net - 2010 + Eclipse
Test driven development in .Net - 2010 + Eclipse
 
Workshop unit test
Workshop   unit testWorkshop   unit test
Workshop unit test
 
Unit Testing Concepts and Best Practices
Unit Testing Concepts and Best PracticesUnit Testing Concepts and Best Practices
Unit Testing Concepts and Best Practices
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
 
Unit tests and TDD
Unit tests and TDDUnit tests and TDD
Unit tests and TDD
 
Unit testing
Unit testingUnit testing
Unit testing
 
Unit Testing (C#)
Unit Testing (C#)Unit Testing (C#)
Unit Testing (C#)
 
Automated Unit Testing
Automated Unit TestingAutomated Unit Testing
Automated Unit Testing
 
Best practices unit testing
Best practices unit testing Best practices unit testing
Best practices unit testing
 
Intro To Unit and integration Testing
Intro To Unit and integration TestingIntro To Unit and integration Testing
Intro To Unit and integration Testing
 

Viewers also liked

How to do research in today’s digital environment
How to do research in today’s digital environmentHow to do research in today’s digital environment
How to do research in today’s digital environmentIryna Kuchma
 
Quesions paper
Quesions paperQuesions paper
Quesions paperbablup
 
Iqbal pamungkas 11131334
Iqbal pamungkas 11131334Iqbal pamungkas 11131334
Iqbal pamungkas 11131334IQBAL PAMUNGKAS
 
Career Reel
Career ReelCareer Reel
Career Reelmmarineg
 
스캠퍼1
스캠퍼1스캠퍼1
스캠퍼1ohj4321
 
Lead us not to Emigration
Lead us not to EmigrationLead us not to Emigration
Lead us not to EmigrationLoretto Leary
 
MZI Modulators
MZI ModulatorsMZI Modulators
MZI ModulatorsSuresh Jat
 
GLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVO
GLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVOGLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVO
GLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVOForum Appalti
 
Wireless Weather Station monitoring System
Wireless Weather Station monitoring SystemWireless Weather Station monitoring System
Wireless Weather Station monitoring SystemAlameluPriyadharshini
 

Viewers also liked (14)

How to do research in today’s digital environment
How to do research in today’s digital environmentHow to do research in today’s digital environment
How to do research in today’s digital environment
 
Quesions paper
Quesions paperQuesions paper
Quesions paper
 
Iqbal pamungkas 11131334
Iqbal pamungkas 11131334Iqbal pamungkas 11131334
Iqbal pamungkas 11131334
 
Certificate
CertificateCertificate
Certificate
 
Career Reel
Career ReelCareer Reel
Career Reel
 
창의적발상22
창의적발상22창의적발상22
창의적발상22
 
LORETTO LEARY
LORETTO LEARYLORETTO LEARY
LORETTO LEARY
 
Pdb resume
Pdb resumePdb resume
Pdb resume
 
아이디어2
아이디어2아이디어2
아이디어2
 
스캠퍼1
스캠퍼1스캠퍼1
스캠퍼1
 
Lead us not to Emigration
Lead us not to EmigrationLead us not to Emigration
Lead us not to Emigration
 
MZI Modulators
MZI ModulatorsMZI Modulators
MZI Modulators
 
GLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVO
GLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVOGLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVO
GLI APPALTI AGGREGATI DEI COMUNI: SEMINARIO OPERATIVO
 
Wireless Weather Station monitoring System
Wireless Weather Station monitoring SystemWireless Weather Station monitoring System
Wireless Weather Station monitoring System
 

Similar to Unit testing and test driven development using vs

justin presentation upload PPT june 19
justin presentation upload PPT june 19justin presentation upload PPT june 19
justin presentation upload PPT june 19techweb08
 
justin for ppt1 by browse button
justin for ppt1 by browse buttonjustin for ppt1 by browse button
justin for ppt1 by browse buttontechweb08
 
upload ppt by browse button
upload ppt by browse buttonupload ppt by browse button
upload ppt by browse buttontechweb08
 
justin presentation Slideshare PPT upload June 25 Final one
justin presentation Slideshare PPT upload June 25 Final onejustin presentation Slideshare PPT upload June 25 Final one
justin presentation Slideshare PPT upload June 25 Final onetechweb08
 
upload ppt1 by browse button
upload ppt1 by browse buttonupload ppt1 by browse button
upload ppt1 by browse buttontechweb08
 
upload ppt by browse button
upload ppt by browse buttonupload ppt by browse button
upload ppt by browse buttontechweb08
 
Justin Presentation PPT Upload June 25 adv
Justin Presentation PPT Upload June 25 advJustin Presentation PPT Upload June 25 adv
Justin Presentation PPT Upload June 25 advtechweb08
 
justin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCEDjustin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCEDtechweb08
 
justin presentation slideshare1
justin presentation slideshare1justin presentation slideshare1
justin presentation slideshare1techweb08
 
alka ppt test from13
alka ppt test from13 alka ppt test from13
alka ppt test from13 techweb08
 
alka ppt upload no code change
alka ppt upload no code changealka ppt upload no code change
alka ppt upload no code changetechweb08
 
Paper PsUpload
Paper PsUploadPaper PsUpload
Paper PsUploadtechweb08
 

Similar to Unit testing and test driven development using vs (20)

Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
 
Paper CS
Paper CSPaper CS
Paper CS
 
alkatest7
alkatest7alkatest7
alkatest7
 
justin presentation upload PPT june 19
justin presentation upload PPT june 19justin presentation upload PPT june 19
justin presentation upload PPT june 19
 
justin for ppt1 by browse button
justin for ppt1 by browse buttonjustin for ppt1 by browse button
justin for ppt1 by browse button
 
Paper Ps
Paper PsPaper Ps
Paper Ps
 
upload ppt by browse button
upload ppt by browse buttonupload ppt by browse button
upload ppt by browse button
 
justin presentation Slideshare PPT upload June 25 Final one
justin presentation Slideshare PPT upload June 25 Final onejustin presentation Slideshare PPT upload June 25 Final one
justin presentation Slideshare PPT upload June 25 Final one
 
Paper Ps
Paper PsPaper Ps
Paper Ps
 
upload ppt1 by browse button
upload ppt1 by browse buttonupload ppt1 by browse button
upload ppt1 by browse button
 
Paper Ps
Paper PsPaper Ps
Paper Ps
 
Paper Ps
Paper PsPaper Ps
Paper Ps
 
upload ppt by browse button
upload ppt by browse buttonupload ppt by browse button
upload ppt by browse button
 
Justin Presentation PPT Upload June 25 adv
Justin Presentation PPT Upload June 25 advJustin Presentation PPT Upload June 25 adv
Justin Presentation PPT Upload June 25 adv
 
justin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCEDjustin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCED
 
justin presentation slideshare1
justin presentation slideshare1justin presentation slideshare1
justin presentation slideshare1
 
alka ppt test from13
alka ppt test from13 alka ppt test from13
alka ppt test from13
 
alka ppt upload no code change
alka ppt upload no code changealka ppt upload no code change
alka ppt upload no code change
 
Paper PsUpload
Paper PsUploadPaper PsUpload
Paper PsUpload
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

More from Abhimanyu Singhal

Containerization with Microsoft Azure
Containerization with Microsoft AzureContainerization with Microsoft Azure
Containerization with Microsoft AzureAbhimanyu Singhal
 
Azure Functions & Serverless Computing
Azure Functions & Serverless ComputingAzure Functions & Serverless Computing
Azure Functions & Serverless ComputingAbhimanyu Singhal
 
Opportunity: Data, Analytic & Azure
Opportunity: Data, Analytic & Azure Opportunity: Data, Analytic & Azure
Opportunity: Data, Analytic & Azure Abhimanyu Singhal
 
Unit testing with visual studio 2012
Unit testing with visual studio 2012Unit testing with visual studio 2012
Unit testing with visual studio 2012Abhimanyu Singhal
 
Project management with team foundation server 11
Project management with team foundation server 11Project management with team foundation server 11
Project management with team foundation server 11Abhimanyu Singhal
 
Debugging application using visual studio 2010 and intellitrace
Debugging application using visual studio 2010 and intellitraceDebugging application using visual studio 2010 and intellitrace
Debugging application using visual studio 2010 and intellitraceAbhimanyu Singhal
 
Web and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 UltimateWeb and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 UltimateAbhimanyu Singhal
 
Database development with visual studio 2010
Database development with visual studio 2010Database development with visual studio 2010
Database development with visual studio 2010Abhimanyu Singhal
 

More from Abhimanyu Singhal (15)

ASP.NET Core
ASP.NET CoreASP.NET Core
ASP.NET Core
 
Containerization with Microsoft Azure
Containerization with Microsoft AzureContainerization with Microsoft Azure
Containerization with Microsoft Azure
 
Azure Functions & Serverless Computing
Azure Functions & Serverless ComputingAzure Functions & Serverless Computing
Azure Functions & Serverless Computing
 
Mobile devops
Mobile devopsMobile devops
Mobile devops
 
Opportunity: Data, Analytic & Azure
Opportunity: Data, Analytic & Azure Opportunity: Data, Analytic & Azure
Opportunity: Data, Analytic & Azure
 
Using Specflow for BDD
Using Specflow for BDDUsing Specflow for BDD
Using Specflow for BDD
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
Unit testing with visual studio 2012
Unit testing with visual studio 2012Unit testing with visual studio 2012
Unit testing with visual studio 2012
 
Exploratory testing
Exploratory testingExploratory testing
Exploratory testing
 
Project management with team foundation server 11
Project management with team foundation server 11Project management with team foundation server 11
Project management with team foundation server 11
 
Coded ui test
Coded ui testCoded ui test
Coded ui test
 
Visual Studio ALM
Visual Studio ALMVisual Studio ALM
Visual Studio ALM
 
Debugging application using visual studio 2010 and intellitrace
Debugging application using visual studio 2010 and intellitraceDebugging application using visual studio 2010 and intellitrace
Debugging application using visual studio 2010 and intellitrace
 
Web and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 UltimateWeb and load testing with Visual Studio 2010 Ultimate
Web and load testing with Visual Studio 2010 Ultimate
 
Database development with visual studio 2010
Database development with visual studio 2010Database development with visual studio 2010
Database development with visual studio 2010
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Unit testing and test driven development using vs

  • 1. Unit Testing and Test Driven Development Using VS 2010 Abhimanyu Singhal Lead Consultant iMentor Knowledge Services
  • 2. Introduce Unit Testing Features How to create Team Test unit tests. Generating the unit test method stubs for an assembly Using a test driven development (TDD) Objectives
  • 3. Thinking about tests pushes developer to understand better the gathered requirements Reduces the over engineered code (dead code) Unit Tests help to check that any new modification wont break the existing features. TDD increases software flexibility TDD code is more decoupled Why is TDD Good
  • 4. A Visual Studio integrated unit-testing framework Code generation of test method stubs. Running tests within the IDE. Incorporation of test data loaded from a database. Code coverage analysis once the tests have run. Visual Studio Team Test
  • 5. Designates a Method as a Test Method Found in Microsoft.VisualStudio.QualityTools.UnitTesting.Framework Namespace TestMethod has to be an instance method with no paramters Method name is irrelevant because reflection searches for TestMethod Attribute TestMethodAttribute Class
  • 6.
  • 7. Team Test Uses Reflection to find Class with TestClass Attribute and Method with TestMethod Attribute and runs itTestClassAttribute Class
  • 8. From Visual Studio As Part of Build Process From Command Line Running and Executing Tests
  • 9. Takes a Parameter which is Exception Type to watch for If Exception does not occur test fails The Second parameter (string) is optional is the error message displayed when exception is not thrown ExpectedException Attribute
  • 10. Use Test Properties Window Add TestData Attribute Source Type Connection String TableName DataAccessMethod Loading Test Data From Database
  • 11. Provides associated data through DataRow Property TestDirectory, TestName Mesuring Test Time using BeingTimer() EndTimer() The TestContext
  • 12. Determines how much code is tested Shows Percentage of Code Executed Highlights code to show which lines are executed Code Coverage
  • 13. TestInitialize Attribute TestCleanup Attribute Code to be run before and after each test method Other Attributes for Lifetime Methods AssemblyInitializeAttribute/AssemblyCleanupAttribute ClassInitializeAttribute/ClassCleanupAttribute. Initializing and Cleaning Up Tests
  • 15. Keep Testing Code in Separate Assemblies Check for cleanup during test setup and execute the cleanup prior to the setup as necessary Avoid creating dependencies between tests, each test should be autonomous. Create one test class corresponding to each class within the production code. Avoid creating other machine dependent tests Create mock objects to test interfaces Guidance – Unit Testing
  • 16. To update the attendance for the session and obtain learning credits log on to https://ch1workspaces/sites/SW23/MS_Course_nominations/default.aspx Question and Answers Session
  • 17. Thank You abhimanyu@imentor.co.in @abhi_singhal http://www.imentor.co.in/blog