SlideShare uma empresa Scribd logo
1 de 21
Unit Tests & Automated Testing Lee Englestone presents.. www.manchesterdeveloper.com
Agenda Terminology What, Why, How Automating unit tests & testing Advanced stuff Test driven development (TDD) Code coverage What we wont be covering Continuous Integration (in any depth)
Terminology (for the next hour) Unit test Tests a small bit of code (from code) Integration test Test after addition of code System test / functional test Test for adherence to user requirements  Regression test Test that fixing / adding code hasn’t introduced bugs Continuous integration Automated checkout, building and testing of code from source control Source : Lee & Wikipedia
Why should we TEST? Why should we test at all? £ £ REMEMBER Testing is just one step in QA £ £ £ £ £
Testing different layers Business Logic Unit Tests Web UI Selenium
Three tier architecture Web UI ASPX, ASCX, HTML, Flash, EpiServer Page Templates etc Business Logic Code libraries (DLLs) Business Logic (DLL) Database access Data Access Layer
Testing business logic Code libraries (DLLs) Business Logic (DLL) Unit Tests (DLL) Unit Tests (DLLs) Database access Data Access Layer
Why have unit tests? Why have unit tests? Find bugs early / fast feedback Increase QA Why not to have unit tests Increases development time? CostOfWritingUnitTests  <  Sum(BugFixing)
Unit Testing  is not a Silver Bullet
What is a unit test? “..tests if individual units of source code are fit for use.” Should be Small Specific (only test 1 thing) Clear pass / fail criteria
What does a unit test look like?  Using NUnit.Framework; [TestFixture] public class CarTests { 	[Test] 	public void Test_Car_Paint ()  	{ 		// Arrange Color paint = Color.Red; 		Car car = new Car(); 		// Act car.paint(Color.Red); 	// Assert Assert.AreEqual(car.Color, paint); 	} 	… } Arrange Act Assert
Example unit test : Running Running unit tests manually with NUnit
An example scenario { Code Example } Objects Car Properties ColorColor double Value double FuelLevel double FuelCapacity FuelTypeEnumFuelType Methods Car.Crush() Car.Paint(Color) Car.AddFuel(FuelTypeEnum, double) Car.VeryImportantMethod()
Automating unit testing
Testing Web UI (Selenium) What if we want to test the UI?  Manual recording and running Can export to NUnit Examples :  Community Fund Form H1 checking** { Code Example }
Test driven development (TDD) Write your tests, even BEFORE your code! Make sure all tests initially fail Then implement the code that the tests are testing (Encourages Designing for Testing)
Code coverage What % of your code base are you testing?
Summary	 Test as early as possible Design code to test Separate BL from UI Improve QA Make unit tests part of CI
Appendixes Wikipedia testing definitions
Testing Terminology (Wikipedia) Unit test “..a programmer tests if individual units of source code are fit for use.” Integration test “..individual software modules are combined and tested as a group. It occurs after unit testing and before system testing.” System test / functional test “..testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements.  Regression test “..seeks to uncover software errors by partially retesting a modified program. The intent of regression testing is to assure that a bug fix has been successfully corrected .. , while providing a general assurance that no other errors were introduced in the process of fixing the original problem.” Continuous integration Automated checkout, building and testing of code from source control Source : Wikipedia

Mais conteúdo relacionado

Mais procurados

UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
suhasreddy1
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practices
nickokiss
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
Confiz
 
Unit Test Presentation
Unit Test PresentationUnit Test Presentation
Unit Test Presentation
Sayedur Rahman
 

Mais procurados (20)

Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practices
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
 
Junit
JunitJunit
Junit
 
Unit testing
Unit testingUnit testing
Unit testing
 
Google test training
Google test trainingGoogle test training
Google test training
 
Test Automation
Test AutomationTest Automation
Test Automation
 
Automated Testing with Agile
Automated Testing with AgileAutomated Testing with Agile
Automated Testing with Agile
 
Unit testing
Unit testingUnit testing
Unit testing
 
Code Coverage
Code CoverageCode Coverage
Code Coverage
 
Test automation
Test automationTest automation
Test automation
 
Test Driven Development (TDD)
Test Driven Development (TDD)Test Driven Development (TDD)
Test Driven Development (TDD)
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 
Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
Unit Test Presentation
Unit Test PresentationUnit Test Presentation
Unit Test Presentation
 
Automation testing & Unit testing
Automation testing & Unit testingAutomation testing & Unit testing
Automation testing & Unit testing
 

Destaque

Automated Unit Testing
Automated Unit Testing Automated Unit Testing
Automated Unit Testing
Simon Boorsma
 
Test automation: the ROI myth
Test automation: the ROI mythTest automation: the ROI myth
Test automation: the ROI myth
Gilles Mantel
 
Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective   Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective
Engineering Software Lab
 

Destaque (18)

Automated Unit Testing
Automated Unit Testing Automated Unit Testing
Automated Unit Testing
 
Unit tests for dummies
Unit tests for dummiesUnit tests for dummies
Unit tests for dummies
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
 
Introduction to Test Automation
Introduction to Test AutomationIntroduction to Test Automation
Introduction to Test Automation
 
Using evolutionary testing to improve efficiency and quality
Using evolutionary testing to improve efficiency and qualityUsing evolutionary testing to improve efficiency and quality
Using evolutionary testing to improve efficiency and quality
 
Test automation: the ROI myth
Test automation: the ROI mythTest automation: the ROI myth
Test automation: the ROI myth
 
Automated Web Testing and Open Source Tools
Automated Web Testing and Open Source ToolsAutomated Web Testing and Open Source Tools
Automated Web Testing and Open Source Tools
 
자라나는 소프트웨어
자라나는 소프트웨어자라나는 소프트웨어
자라나는 소프트웨어
 
Managing Projects With HomeSpot
Managing Projects With HomeSpotManaging Projects With HomeSpot
Managing Projects With HomeSpot
 
Robot Chickens! How a Netduino runs our backyard chicken coop
Robot Chickens!  How a Netduino runs our backyard chicken coopRobot Chickens!  How a Netduino runs our backyard chicken coop
Robot Chickens! How a Netduino runs our backyard chicken coop
 
Building data driven mobile apps with phone gap and webapi
Building data driven mobile apps with phone gap and webapiBuilding data driven mobile apps with phone gap and webapi
Building data driven mobile apps with phone gap and webapi
 
What's New in ASP.NET Identity - TRINUG Sept 2014
What's New in ASP.NET Identity - TRINUG Sept 2014What's New in ASP.NET Identity - TRINUG Sept 2014
What's New in ASP.NET Identity - TRINUG Sept 2014
 
Automated Testing Tools for Desktop, Web and Mobile Software
Automated Testing Tools for Desktop, Web and Mobile SoftwareAutomated Testing Tools for Desktop, Web and Mobile Software
Automated Testing Tools for Desktop, Web and Mobile Software
 
Automation roi microsoft e4 d event
Automation roi microsoft e4 d eventAutomation roi microsoft e4 d event
Automation roi microsoft e4 d event
 
sql introduction
sql introductionsql introduction
sql introduction
 
#1 unit testing
#1 unit testing#1 unit testing
#1 unit testing
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
 
Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective   Code Coverage in Theory and in practice form the DO178B perspective
Code Coverage in Theory and in practice form the DO178B perspective
 

Semelhante a Unit Tests And Automated Testing

Automated+Testing+Vs+Manual+Testing
Automated+Testing+Vs+Manual+TestingAutomated+Testing+Vs+Manual+Testing
Automated+Testing+Vs+Manual+Testing
gueste1e4db
 
Unit testing and test driven development using vs
Unit testing and test driven development using vsUnit testing and test driven development using vs
Unit testing and test driven development using vs
Abhimanyu Singhal
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presented
Vijayan Reddy
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Jacinto Limjap
 
No More No Repro
No More No ReproNo More No Repro
No More No Repro
Anna Russo
 
Ukfs Snr Dev Arch Forum Pres3 Re
Ukfs Snr Dev Arch Forum Pres3 ReUkfs Snr Dev Arch Forum Pres3 Re
Ukfs Snr Dev Arch Forum Pres3 Re
AllyWick
 

Semelhante a Unit Tests And Automated Testing (20)

Automated Testing vs Manual Testing
Automated Testing vs Manual TestingAutomated Testing vs Manual Testing
Automated Testing vs Manual Testing
 
Automated Testing vs Manual Testing
Automated Testing vs Manual TestingAutomated Testing vs Manual Testing
Automated Testing vs Manual Testing
 
Automated+Testing+Vs+Manual+Testing
Automated+Testing+Vs+Manual+TestingAutomated+Testing+Vs+Manual+Testing
Automated+Testing+Vs+Manual+Testing
 
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
Mohammed Kharma-A flexible framework for quality assurance and testing of sof...
 
Vsts 2
Vsts 2Vsts 2
Vsts 2
 
Lap Around Visual Studio 2010 Ultimate And TFS 2010
Lap Around Visual Studio 2010 Ultimate And TFS 2010Lap Around Visual Studio 2010 Ultimate And TFS 2010
Lap Around Visual Studio 2010 Ultimate And TFS 2010
 
Regression Testing with Symfony
Regression Testing with SymfonyRegression Testing with Symfony
Regression Testing with Symfony
 
12 Rational Solo Pruebas 2009
12 Rational Solo Pruebas 200912 Rational Solo Pruebas 2009
12 Rational Solo Pruebas 2009
 
Microsoft Stack Visual Studio 2010 Overview
Microsoft  Stack   Visual Studio 2010 OverviewMicrosoft  Stack   Visual Studio 2010 Overview
Microsoft Stack Visual Studio 2010 Overview
 
Coding Naked
Coding NakedCoding Naked
Coding Naked
 
Unit testing and test driven development using vs
Unit testing and test driven development using vsUnit testing and test driven development using vs
Unit testing and test driven development using vs
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presented
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)Whats New In 2010 (Msdn & Visual Studio)
Whats New In 2010 (Msdn & Visual Studio)
 
No More No Repro
No More No ReproNo More No Repro
No More No Repro
 
The Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs PublicThe Magic Of Application Lifecycle Management In Vs Public
The Magic Of Application Lifecycle Management In Vs Public
 
Ukfs Snr Dev Arch Forum Pres3 Re
Ukfs Snr Dev Arch Forum Pres3 ReUkfs Snr Dev Arch Forum Pres3 Re
Ukfs Snr Dev Arch Forum Pres3 Re
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
 

Mais de Lee Englestone

Familee bootstrapped-biz
Familee bootstrapped-bizFamilee bootstrapped-biz
Familee bootstrapped-biz
Lee Englestone
 

Mais de Lee Englestone (12)

Introduction to C#
Introduction to C#Introduction to C#
Introduction to C#
 
Augmented Reality On iOS With ARKit Xamarin and C#
Augmented Reality On iOS With ARKit Xamarin and C#Augmented Reality On iOS With ARKit Xamarin and C#
Augmented Reality On iOS With ARKit Xamarin and C#
 
Reinventing Education Hackathon - LeARn
Reinventing Education Hackathon - LeARnReinventing Education Hackathon - LeARn
Reinventing Education Hackathon - LeARn
 
.NET Foundation website suggestions for improvement
.NET Foundation website suggestions for improvement.NET Foundation website suggestions for improvement
.NET Foundation website suggestions for improvement
 
25 Tips for Visual Studio
25 Tips for Visual Studio25 Tips for Visual Studio
25 Tips for Visual Studio
 
Tweet From Every Country Barcamp Manchester
Tweet From Every Country Barcamp ManchesterTweet From Every Country Barcamp Manchester
Tweet From Every Country Barcamp Manchester
 
Organisational Learning
Organisational LearningOrganisational Learning
Organisational Learning
 
Lincoln Hack 2018
Lincoln Hack 2018Lincoln Hack 2018
Lincoln Hack 2018
 
MVC Training Part 2
MVC Training Part 2MVC Training Part 2
MVC Training Part 2
 
MVC Training Part 1
MVC Training Part 1MVC Training Part 1
MVC Training Part 1
 
Familee bootstrapped-biz
Familee bootstrapped-bizFamilee bootstrapped-biz
Familee bootstrapped-biz
 
Visual Studio 2010 and ASP.Net 4
Visual Studio 2010 and ASP.Net 4Visual Studio 2010 and ASP.Net 4
Visual Studio 2010 and ASP.Net 4
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

Unit Tests And Automated Testing

  • 1. Unit Tests & Automated Testing Lee Englestone presents.. www.manchesterdeveloper.com
  • 2. Agenda Terminology What, Why, How Automating unit tests & testing Advanced stuff Test driven development (TDD) Code coverage What we wont be covering Continuous Integration (in any depth)
  • 3. Terminology (for the next hour) Unit test Tests a small bit of code (from code) Integration test Test after addition of code System test / functional test Test for adherence to user requirements Regression test Test that fixing / adding code hasn’t introduced bugs Continuous integration Automated checkout, building and testing of code from source control Source : Lee & Wikipedia
  • 4. Why should we TEST? Why should we test at all? £ £ REMEMBER Testing is just one step in QA £ £ £ £ £
  • 5. Testing different layers Business Logic Unit Tests Web UI Selenium
  • 6. Three tier architecture Web UI ASPX, ASCX, HTML, Flash, EpiServer Page Templates etc Business Logic Code libraries (DLLs) Business Logic (DLL) Database access Data Access Layer
  • 7. Testing business logic Code libraries (DLLs) Business Logic (DLL) Unit Tests (DLL) Unit Tests (DLLs) Database access Data Access Layer
  • 8. Why have unit tests? Why have unit tests? Find bugs early / fast feedback Increase QA Why not to have unit tests Increases development time? CostOfWritingUnitTests < Sum(BugFixing)
  • 9. Unit Testing is not a Silver Bullet
  • 10. What is a unit test? “..tests if individual units of source code are fit for use.” Should be Small Specific (only test 1 thing) Clear pass / fail criteria
  • 11. What does a unit test look like? Using NUnit.Framework; [TestFixture] public class CarTests { [Test] public void Test_Car_Paint () { // Arrange Color paint = Color.Red; Car car = new Car(); // Act car.paint(Color.Red); // Assert Assert.AreEqual(car.Color, paint); } … } Arrange Act Assert
  • 12. Example unit test : Running Running unit tests manually with NUnit
  • 13. An example scenario { Code Example } Objects Car Properties ColorColor double Value double FuelLevel double FuelCapacity FuelTypeEnumFuelType Methods Car.Crush() Car.Paint(Color) Car.AddFuel(FuelTypeEnum, double) Car.VeryImportantMethod()
  • 15. Testing Web UI (Selenium) What if we want to test the UI? Manual recording and running Can export to NUnit Examples : Community Fund Form H1 checking** { Code Example }
  • 16. Test driven development (TDD) Write your tests, even BEFORE your code! Make sure all tests initially fail Then implement the code that the tests are testing (Encourages Designing for Testing)
  • 17. Code coverage What % of your code base are you testing?
  • 18. Summary Test as early as possible Design code to test Separate BL from UI Improve QA Make unit tests part of CI
  • 19.
  • 21. Testing Terminology (Wikipedia) Unit test “..a programmer tests if individual units of source code are fit for use.” Integration test “..individual software modules are combined and tested as a group. It occurs after unit testing and before system testing.” System test / functional test “..testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements. Regression test “..seeks to uncover software errors by partially retesting a modified program. The intent of regression testing is to assure that a bug fix has been successfully corrected .. , while providing a general assurance that no other errors were introduced in the process of fixing the original problem.” Continuous integration Automated checkout, building and testing of code from source control Source : Wikipedia

Notas do Editor

  1. There are no silver bullets in development.Developers have are there disposal an arsenal tools, and they must be used in the right way to fit company processes