SlideShare a Scribd company logo
Automated Testing with Team Test Unit, Web, Performance, Load, Manual, and Ordered Tests  Code Coverage and Code Analysis
Quality Challenges “ Software bugs, or errors, are so prevalent and so detrimental that they cost the U.S. economy an estimated $59.5 billion annually, or about 0.6 percent of the gross domestic product…an estimated $22.2 billion, could be eliminated by an improved testing infrastructure that enables earlier and more effective identification and removal of software defects.” (Source: NIST 2002) Satisfying users Business interruption risks Ongoing maintenance costs rising Less avail. resources
How Does VSTS/TFS Help? Increased Communication and Integration… Code Analysis Tools Code Profiling Tools Unit Testing and Code Coverage Load Testing Other Testing Tools Test Case Management
Unit Testing Each unit is tested independently A large percentage of defects are identified during unit testing Automatic and repeatable code testing Simplifies integration Self documenting Auto-generate Isolate small portion of code & determine whether it works correctly
Benefits of Automated Unit Testing Repeatable unit that verifies code still works Confirm code is tested Build a set of regression tests Make changes with confidence Aid in understanding code Limits: integration, web and Windows UI testing, load, performance testing
Unit Test Types Class (standard) Test the properties and methods of a class Data-driven Bind unit test parameters to a datasource ASP.NET Test classes (or business logic) inside an ASP.NET application  Run in the context of the web server (ASP objects available) Web Services Define a web reference to the service
Extensions of Unit Testing Regression Testing Modifications are validated with regression tests Write new code and verify system continues to function correctly Integration Testing Helps validate how tested components interact with one another Can identify problems that occur when units are combined Scenario Testing Combine sequence of unit tests to cover a scenario
Writing Effective Unit Tests Atomic Should not require others tests to be run first Cover all cases  One test for each sceneario Cover all conditions, exceptions, nulls, etc. Able to re-run without configuration Database create/read/update/delete without having to modify the database before or after the test is run Test a common application state Unit tests should be …
Unit Test Conditions Success baseline Common, successful, most-likely call to your code Parameter mix Pass a varied set of parameters Data-driven Bounds checking Stress the upper and lower limits of your parameters Null values Determine outcome of passing nulls to parameters Error conditions Trigger error conditions and validate expected outcomes Code coverage scenarios Test all conditions in your code
Creating Unit Tests (1 of 2) Attributes are used to denote which methods and classes should be loaded for tests TestClass – denotes a class for testing TestMethod – denotes a method for testing must return void (Sub for VB.NET) and have no parameters Certain attributes are associated with initialization TestInitialize – run before each test TestCleanup – run after each test ClassInitialize – run once before running any tests in the class ClassCleanup – run once after running all tests in the class Assert – static type used for asserting test values ExpectedException – attribute used for determining the exception that should be thrown from the test
Creating Unit Tests (2 of 2) Methods on the Assert type AreSame / AreNotSame AreEqual / AreNotEqual IsNull / IsNotNull IsInstanceOfType / IsNotInstanceOfType IsTrue / IsFalse Other Assert types CollectionAssert – collection equivalency StringAssert – string comparison/regex matching Web test types HtmlDocument – grants access to tags in the html document Validate*/Extract* - types used for reading field values from the request and response
Unit Tests
Code Coverage Improves effectiveness of tests Show a measurable indication of code that was covered by unit tests Strive for 75% and higher Shows the ratio of executed logic to the total logic Can be used in conjunction with unit and load testing Helps to find unused code Determine code that is exercised by tests
Code Coverage
Static Code Analysis Provides a means to enforce coding standards Configurable Reduction in code reviews for small issues Provides guidance on how to fix Define a check-in policy to enforce code analysis pass Coverage includes issues with design, globalization, interoperability, maintainability, naming, performance, reliability, security, and usage Warning: developers can supress messages with attirbute [SuppressMessage("AdventureWorks.Rules", "AW14441")]  MORE INFO  see, “Writing Quality Code” in TFS documentation
Static Code Analysis
Web Testing Record page navigation and user interactions with web pages Run tests back to determine errors Seed tests from a database Run tests from a group of users Validation rules Extractions
Web Testing
Load Testing Load Testing: ensure application works under expected, concurrent user load Create test cases that simulate real user conditions Distribute tests across cases based on user behavior Assume standard think times Distribute across connection types Simulate an application performance  in a production environment Provide repository to look at a  performance trend over time, to see  if changes are helping or hurting  Simulate multiple users against an application simultaneously
Stress Testing Stress Testing: determine breaking points in your application  Find scalability issues before the application is deployed Step (increase) user load over time, monitor Find breaking point and use to monitor application Change software Add hardware
Performance Testing Test at single user Test at normal load Test at peak load (1.5x normal load) Measure against expected performance Peak load should allow for a 20-30% increase in metric Set thresholds on the output to avoid digging through data
Load, Stress, and Performance Testing
Manual Test Tracked like other tests when executing test groups Presented to the tester to enter and confirm results Defined as text file or Word document
Generic Test Wrap existing code and have that code executed as part of the testing process Centralized results of all tests
Ordered Test Test to group (and order) other tests Results of ordered tests either succeed or fail as a group Used for scenario and module-level testing Add any test except a load test to an ordered test
Manual Test
Test Case Management Organize tests into lists Run tests Filter and group the display of the tests Import additional tests Export tests Organize and manage test cases
The Test Lab Clients Tester machine Used to create and edit tests / view results Servers Deployed test environment (web servers, load balancer, database server, etc.) Agents Computers running tests (multiple-threads, each a user) Listen for commands from controller Execute tests and pass results back to controller Controller Central computer that administers agents and collects results Distributes load by applying weights to agents
The Test Lab Database Run against a test version of the database Test data should be same nature and size as production Test a steady state of the database Automate the initialization of the database Extract data using rules to obfuscate personal information Visual Studio Database Developer
Test Lab Database Initialization
Ad

Recommended

Fundamentals of Software Engineering
Fundamentals of Software Engineering
Madhar Khan Pathan
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering
Madhar Khan Pathan
 
Test Automation Framework Designs
Test Automation Framework Designs
Sauce Labs
 
Keyword Driven Testing using TestComplete
Keyword Driven Testing using TestComplete
srivinayak
 
12 functional-system-testing
12 functional-system-testing
nickynicks76
 
Keyword-driven Test Automation Framework
Keyword-driven Test Automation Framework
Mikhail Subach
 
Ch23
Ch23
phanleson
 
Software Testing
Software Testing
Kiran Kumar
 
Regression Test Automation Framework
Regression Test Automation Framework
Infosys
 
Object-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & Programming
Allan Mangune
 
Automation framework
Automation framework
ITeLearn
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - Kenya
Erick M'bwana
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit design
Maitree Patel
 
04 test controlling and tracking
04 test controlling and tracking
Clemens Reijnen
 
upload ppt by browse button
upload ppt by browse button
techweb08
 
ugodmjc
ugodmjc
bspsudle
 
Visual Art Christopher Gilbert
Visual Art Christopher Gilbert
Iago Fernández
 
testing ppt
testing ppt
techweb08
 
upload ppt by browse button
upload ppt by browse button
techweb08
 
เตรียมตัวพบกับการรายงานตัว
เตรียมตัวพบกับการรายงานตัว
suwaluk
 
Justin Presentation PPT Upload
Justin Presentation PPT Upload
techweb08
 
Jjustin presentation upload PPT
Jjustin presentation upload PPT
techweb08
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Automated testing overview
Automated testing overview
Alex Pop
 
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...
Comunidade NetPonto
 
03 test specification and execution
03 test specification and execution
Clemens Reijnen
 
Quality Coding with Visual Studio 2012
Quality Coding with Visual Studio 2012
Imaginet
 
Streamlining Testing with Visual Studio 2012
Streamlining Testing with Visual Studio 2012
Imaginet
 
Test Automation Framework Designs
Test Automation Framework Designs
Test Automaton
 

More Related Content

What's hot (6)

Regression Test Automation Framework
Regression Test Automation Framework
Infosys
 
Object-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & Programming
Allan Mangune
 
Automation framework
Automation framework
ITeLearn
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - Kenya
Erick M'bwana
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit design
Maitree Patel
 
04 test controlling and tracking
04 test controlling and tracking
Clemens Reijnen
 
Regression Test Automation Framework
Regression Test Automation Framework
Infosys
 
Object-oriented Analysis, Design & Programming
Object-oriented Analysis, Design & Programming
Allan Mangune
 
Automation framework
Automation framework
ITeLearn
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - Kenya
Erick M'bwana
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit design
Maitree Patel
 
04 test controlling and tracking
04 test controlling and tracking
Clemens Reijnen
 

Viewers also liked (7)

upload ppt by browse button
upload ppt by browse button
techweb08
 
ugodmjc
ugodmjc
bspsudle
 
Visual Art Christopher Gilbert
Visual Art Christopher Gilbert
Iago Fernández
 
testing ppt
testing ppt
techweb08
 
upload ppt by browse button
upload ppt by browse button
techweb08
 
เตรียมตัวพบกับการรายงานตัว
เตรียมตัวพบกับการรายงานตัว
suwaluk
 
upload ppt by browse button
upload ppt by browse button
techweb08
 
Visual Art Christopher Gilbert
Visual Art Christopher Gilbert
Iago Fernández
 
upload ppt by browse button
upload ppt by browse button
techweb08
 
เตรียมตัวพบกับการรายงานตัว
เตรียมตัวพบกับการรายงานตัว
suwaluk
 
Ad

Similar to upload ppt1 by browse button (20)

Justin Presentation PPT Upload
Justin Presentation PPT Upload
techweb08
 
Jjustin presentation upload PPT
Jjustin presentation upload PPT
techweb08
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Automated testing overview
Automated testing overview
Alex Pop
 
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...
Comunidade NetPonto
 
03 test specification and execution
03 test specification and execution
Clemens Reijnen
 
Quality Coding with Visual Studio 2012
Quality Coding with Visual Studio 2012
Imaginet
 
Streamlining Testing with Visual Studio 2012
Streamlining Testing with Visual Studio 2012
Imaginet
 
Test Automation Framework Designs
Test Automation Framework Designs
Test Automaton
 
Introduction to Automated Testing
Introduction to Automated Testing
Lars Thorup
 
Introduction to-automated-testing
Introduction to-automated-testing
BestBrains
 
Quality Coding: What’s New with Visual Studio 2012
Quality Coding: What’s New with Visual Studio 2012
Imaginet
 
Quality Coding: What's New with Visual Studio 2012
Quality Coding: What's New with Visual Studio 2012
Imaginet
 
Introduction to software testing
Introduction to software testing
Venkat Alagarsamy
 
Automated Testing vs Manual Testing
Automated Testing vs Manual Testing
didev
 
Automated Testing vs Manual Testing
Automated Testing vs Manual Testing
Directi Group
 
Automated+Testing+Vs+Manual+Testing
Automated+Testing+Vs+Manual+Testing
gueste1e4db
 
TeDevelopment Testing in Software Engineering
TeDevelopment Testing in Software Engineering
Karthik Rohan
 
Agile Testing Pasadena JUG Aug2009
Agile Testing Pasadena JUG Aug2009
Grig Gheorghiu
 
Software Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails Applications
Bhavin Javia
 
Justin Presentation PPT Upload
Justin Presentation PPT Upload
techweb08
 
Jjustin presentation upload PPT
Jjustin presentation upload PPT
techweb08
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Automated testing overview
Automated testing overview
Alex Pop
 
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...
Comunidade NetPonto
 
03 test specification and execution
03 test specification and execution
Clemens Reijnen
 
Quality Coding with Visual Studio 2012
Quality Coding with Visual Studio 2012
Imaginet
 
Streamlining Testing with Visual Studio 2012
Streamlining Testing with Visual Studio 2012
Imaginet
 
Test Automation Framework Designs
Test Automation Framework Designs
Test Automaton
 
Introduction to Automated Testing
Introduction to Automated Testing
Lars Thorup
 
Introduction to-automated-testing
Introduction to-automated-testing
BestBrains
 
Quality Coding: What’s New with Visual Studio 2012
Quality Coding: What’s New with Visual Studio 2012
Imaginet
 
Quality Coding: What's New with Visual Studio 2012
Quality Coding: What's New with Visual Studio 2012
Imaginet
 
Introduction to software testing
Introduction to software testing
Venkat Alagarsamy
 
Automated Testing vs Manual Testing
Automated Testing vs Manual Testing
didev
 
Automated Testing vs Manual Testing
Automated Testing vs Manual Testing
Directi Group
 
Automated+Testing+Vs+Manual+Testing
Automated+Testing+Vs+Manual+Testing
gueste1e4db
 
TeDevelopment Testing in Software Engineering
TeDevelopment Testing in Software Engineering
Karthik Rohan
 
Agile Testing Pasadena JUG Aug2009
Agile Testing Pasadena JUG Aug2009
Grig Gheorghiu
 
Software Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails Applications
Bhavin Javia
 
Ad

More from techweb08 (20)

Sample Presentation Asset
Sample Presentation Asset
techweb08
 
Presentation for test
Presentation for test
techweb08
 
NG Test - Presentation
NG Test - Presentation
techweb08
 
NG_TEST_SR_Presentation
NG_TEST_SR_Presentation
techweb08
 
NG_TEST_Presentation_0510
NG_TEST_Presentation_0510
techweb08
 
NG_TEST_PRESENTATION
NG_TEST_PRESENTATION
techweb08
 
NGTEST - presentation title - 041219
NGTEST - presentation title - 041219
techweb08
 
ngtest-presen-0419
ngtest-presen-0419
techweb08
 
ngtest_presentation_0418
ngtest_presentation_0418
techweb08
 
NGTEST_Presentation
NGTEST_Presentation
techweb08
 
Next Gen - case study
Next Gen - case study
techweb08
 
Next Gen Testing Asset
Next Gen Testing Asset
techweb08
 
Reducing network complexity and boosting performance with IRF technology
Reducing network complexity and boosting performance with IRF technology
techweb08
 
Test DB user
Test DB user
techweb08
 
Sample Presentation Asset
Sample Presentation Asset
techweb08
 
Presentation for test
Presentation for test
techweb08
 
NG Test - Presentation
NG Test - Presentation
techweb08
 
NG_TEST_SR_Presentation
NG_TEST_SR_Presentation
techweb08
 
NG_TEST_Presentation_0510
NG_TEST_Presentation_0510
techweb08
 
NG_TEST_PRESENTATION
NG_TEST_PRESENTATION
techweb08
 
NGTEST - presentation title - 041219
NGTEST - presentation title - 041219
techweb08
 
ngtest-presen-0419
ngtest-presen-0419
techweb08
 
ngtest_presentation_0418
ngtest_presentation_0418
techweb08
 
NGTEST_Presentation
NGTEST_Presentation
techweb08
 
Next Gen - case study
Next Gen - case study
techweb08
 
Next Gen Testing Asset
Next Gen Testing Asset
techweb08
 
Reducing network complexity and boosting performance with IRF technology
Reducing network complexity and boosting performance with IRF technology
techweb08
 
Test DB user
Test DB user
techweb08
 

Recently uploaded (20)

Best Practices for Creating Clear and Effective BPMN Diagrams
Best Practices for Creating Clear and Effective BPMN Diagrams
RUPAL AGARWAL
 
Enterprise Architecture Professional Journal Vol IX June 2025.pdf
Enterprise Architecture Professional Journal Vol IX June 2025.pdf
Darryl_Carr
 
5 Smart Ways to Build a Highly Productive Team
5 Smart Ways to Build a Highly Productive Team
RUPAL AGARWAL
 
The Future State Of Work - Actionable Summary for Startup Founders
The Future State Of Work - Actionable Summary for Startup Founders
vikram sood
 
Vaden Consultancy: Transforming Businesses with Integrated HR, IT, and Cloud ...
Vaden Consultancy: Transforming Businesses with Integrated HR, IT, and Cloud ...
Vaden Consultancy
 
IEA_Press_Release_Tullow_Agreement-16-6-2025-1.pdf
IEA_Press_Release_Tullow_Agreement-16-6-2025-1.pdf
businessweekghana
 
Integrating Customer Journey Insights into Your Business Process Management S...
Integrating Customer Journey Insights into Your Business Process Management S...
RUPAL AGARWAL
 
Appreciations - June 25.pptxggggggghhhhhh
Appreciations - June 25.pptxggggggghhhhhh
anushavnayak
 
SACRS_Spring Mag 2025 Graceada Article.pdf
SACRS_Spring Mag 2025 Graceada Article.pdf
matthieu81
 
Power of the Many: Digital Energy Masterclass
Power of the Many: Digital Energy Masterclass
mariana491193
 
MOOJAY Wireless Keyboard & Mouse Ergonomic Combo – Comfort, Silence, and Styl...
MOOJAY Wireless Keyboard & Mouse Ergonomic Combo – Comfort, Silence, and Styl...
Topmate
 
What Drives Collectors in Sports and Beyond, and How Mantel is Bringing Them ...
What Drives Collectors in Sports and Beyond, and How Mantel is Bringing Them ...
Neil Horowitz
 
Integration of Information Security Governance and Corporate Governance
Integration of Information Security Governance and Corporate Governance
Tokyo Security Community
 
Salary_Wage_Computation_3Day_Lesson.pptx
Salary_Wage_Computation_3Day_Lesson.pptx
DaryllWhere
 
Oleksandr Osypenko: Управління обсягом (Scope) (UA)
Oleksandr Osypenko: Управління обсягом (Scope) (UA)
Lviv Startup Club
 
Essar 2.0 Rising with a New Approach.pptx
Essar 2.0 Rising with a New Approach.pptx
essarupdate
 
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry.pdf
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry.pdf
Noah Loul
 
Filter Test machine .pdf
Filter Test machine .pdf
FILTRATION ENGINEERING & CUNSULTANT
 
QuickBooks Keeps Freezing: Causes & Solutions.pptx
QuickBooks Keeps Freezing: Causes & Solutions.pptx
robastwilliams
 
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry
Noah Loul
 
Best Practices for Creating Clear and Effective BPMN Diagrams
Best Practices for Creating Clear and Effective BPMN Diagrams
RUPAL AGARWAL
 
Enterprise Architecture Professional Journal Vol IX June 2025.pdf
Enterprise Architecture Professional Journal Vol IX June 2025.pdf
Darryl_Carr
 
5 Smart Ways to Build a Highly Productive Team
5 Smart Ways to Build a Highly Productive Team
RUPAL AGARWAL
 
The Future State Of Work - Actionable Summary for Startup Founders
The Future State Of Work - Actionable Summary for Startup Founders
vikram sood
 
Vaden Consultancy: Transforming Businesses with Integrated HR, IT, and Cloud ...
Vaden Consultancy: Transforming Businesses with Integrated HR, IT, and Cloud ...
Vaden Consultancy
 
IEA_Press_Release_Tullow_Agreement-16-6-2025-1.pdf
IEA_Press_Release_Tullow_Agreement-16-6-2025-1.pdf
businessweekghana
 
Integrating Customer Journey Insights into Your Business Process Management S...
Integrating Customer Journey Insights into Your Business Process Management S...
RUPAL AGARWAL
 
Appreciations - June 25.pptxggggggghhhhhh
Appreciations - June 25.pptxggggggghhhhhh
anushavnayak
 
SACRS_Spring Mag 2025 Graceada Article.pdf
SACRS_Spring Mag 2025 Graceada Article.pdf
matthieu81
 
Power of the Many: Digital Energy Masterclass
Power of the Many: Digital Energy Masterclass
mariana491193
 
MOOJAY Wireless Keyboard & Mouse Ergonomic Combo – Comfort, Silence, and Styl...
MOOJAY Wireless Keyboard & Mouse Ergonomic Combo – Comfort, Silence, and Styl...
Topmate
 
What Drives Collectors in Sports and Beyond, and How Mantel is Bringing Them ...
What Drives Collectors in Sports and Beyond, and How Mantel is Bringing Them ...
Neil Horowitz
 
Integration of Information Security Governance and Corporate Governance
Integration of Information Security Governance and Corporate Governance
Tokyo Security Community
 
Salary_Wage_Computation_3Day_Lesson.pptx
Salary_Wage_Computation_3Day_Lesson.pptx
DaryllWhere
 
Oleksandr Osypenko: Управління обсягом (Scope) (UA)
Oleksandr Osypenko: Управління обсягом (Scope) (UA)
Lviv Startup Club
 
Essar 2.0 Rising with a New Approach.pptx
Essar 2.0 Rising with a New Approach.pptx
essarupdate
 
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry.pdf
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry.pdf
Noah Loul
 
QuickBooks Keeps Freezing: Causes & Solutions.pptx
QuickBooks Keeps Freezing: Causes & Solutions.pptx
robastwilliams
 
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry
Noah Loul Shares 5 Key Impacts of AI Agents on the Sales Industry
Noah Loul
 

upload ppt1 by browse button

  • 1. Automated Testing with Team Test Unit, Web, Performance, Load, Manual, and Ordered Tests Code Coverage and Code Analysis
  • 2. Quality Challenges “ Software bugs, or errors, are so prevalent and so detrimental that they cost the U.S. economy an estimated $59.5 billion annually, or about 0.6 percent of the gross domestic product…an estimated $22.2 billion, could be eliminated by an improved testing infrastructure that enables earlier and more effective identification and removal of software defects.” (Source: NIST 2002) Satisfying users Business interruption risks Ongoing maintenance costs rising Less avail. resources
  • 3. How Does VSTS/TFS Help? Increased Communication and Integration… Code Analysis Tools Code Profiling Tools Unit Testing and Code Coverage Load Testing Other Testing Tools Test Case Management
  • 4. Unit Testing Each unit is tested independently A large percentage of defects are identified during unit testing Automatic and repeatable code testing Simplifies integration Self documenting Auto-generate Isolate small portion of code & determine whether it works correctly
  • 5. Benefits of Automated Unit Testing Repeatable unit that verifies code still works Confirm code is tested Build a set of regression tests Make changes with confidence Aid in understanding code Limits: integration, web and Windows UI testing, load, performance testing
  • 6. Unit Test Types Class (standard) Test the properties and methods of a class Data-driven Bind unit test parameters to a datasource ASP.NET Test classes (or business logic) inside an ASP.NET application Run in the context of the web server (ASP objects available) Web Services Define a web reference to the service
  • 7. Extensions of Unit Testing Regression Testing Modifications are validated with regression tests Write new code and verify system continues to function correctly Integration Testing Helps validate how tested components interact with one another Can identify problems that occur when units are combined Scenario Testing Combine sequence of unit tests to cover a scenario
  • 8. Writing Effective Unit Tests Atomic Should not require others tests to be run first Cover all cases One test for each sceneario Cover all conditions, exceptions, nulls, etc. Able to re-run without configuration Database create/read/update/delete without having to modify the database before or after the test is run Test a common application state Unit tests should be …
  • 9. Unit Test Conditions Success baseline Common, successful, most-likely call to your code Parameter mix Pass a varied set of parameters Data-driven Bounds checking Stress the upper and lower limits of your parameters Null values Determine outcome of passing nulls to parameters Error conditions Trigger error conditions and validate expected outcomes Code coverage scenarios Test all conditions in your code
  • 10. Creating Unit Tests (1 of 2) Attributes are used to denote which methods and classes should be loaded for tests TestClass – denotes a class for testing TestMethod – denotes a method for testing must return void (Sub for VB.NET) and have no parameters Certain attributes are associated with initialization TestInitialize – run before each test TestCleanup – run after each test ClassInitialize – run once before running any tests in the class ClassCleanup – run once after running all tests in the class Assert – static type used for asserting test values ExpectedException – attribute used for determining the exception that should be thrown from the test
  • 11. Creating Unit Tests (2 of 2) Methods on the Assert type AreSame / AreNotSame AreEqual / AreNotEqual IsNull / IsNotNull IsInstanceOfType / IsNotInstanceOfType IsTrue / IsFalse Other Assert types CollectionAssert – collection equivalency StringAssert – string comparison/regex matching Web test types HtmlDocument – grants access to tags in the html document Validate*/Extract* - types used for reading field values from the request and response
  • 13. Code Coverage Improves effectiveness of tests Show a measurable indication of code that was covered by unit tests Strive for 75% and higher Shows the ratio of executed logic to the total logic Can be used in conjunction with unit and load testing Helps to find unused code Determine code that is exercised by tests
  • 15. Static Code Analysis Provides a means to enforce coding standards Configurable Reduction in code reviews for small issues Provides guidance on how to fix Define a check-in policy to enforce code analysis pass Coverage includes issues with design, globalization, interoperability, maintainability, naming, performance, reliability, security, and usage Warning: developers can supress messages with attirbute [SuppressMessage("AdventureWorks.Rules", "AW14441")] MORE INFO see, “Writing Quality Code” in TFS documentation
  • 17. Web Testing Record page navigation and user interactions with web pages Run tests back to determine errors Seed tests from a database Run tests from a group of users Validation rules Extractions
  • 19. Load Testing Load Testing: ensure application works under expected, concurrent user load Create test cases that simulate real user conditions Distribute tests across cases based on user behavior Assume standard think times Distribute across connection types Simulate an application performance in a production environment Provide repository to look at a performance trend over time, to see if changes are helping or hurting Simulate multiple users against an application simultaneously
  • 20. Stress Testing Stress Testing: determine breaking points in your application Find scalability issues before the application is deployed Step (increase) user load over time, monitor Find breaking point and use to monitor application Change software Add hardware
  • 21. Performance Testing Test at single user Test at normal load Test at peak load (1.5x normal load) Measure against expected performance Peak load should allow for a 20-30% increase in metric Set thresholds on the output to avoid digging through data
  • 22. Load, Stress, and Performance Testing
  • 23. Manual Test Tracked like other tests when executing test groups Presented to the tester to enter and confirm results Defined as text file or Word document
  • 24. Generic Test Wrap existing code and have that code executed as part of the testing process Centralized results of all tests
  • 25. Ordered Test Test to group (and order) other tests Results of ordered tests either succeed or fail as a group Used for scenario and module-level testing Add any test except a load test to an ordered test
  • 27. Test Case Management Organize tests into lists Run tests Filter and group the display of the tests Import additional tests Export tests Organize and manage test cases
  • 28. The Test Lab Clients Tester machine Used to create and edit tests / view results Servers Deployed test environment (web servers, load balancer, database server, etc.) Agents Computers running tests (multiple-threads, each a user) Listen for commands from controller Execute tests and pass results back to controller Controller Central computer that administers agents and collects results Distributes load by applying weights to agents
  • 29. The Test Lab Database Run against a test version of the database Test data should be same nature and size as production Test a steady state of the database Automate the initialization of the database Extract data using rules to obfuscate personal information Visual Studio Database Developer
  • 30. Test Lab Database Initialization