Upload
eleksdev
View
1.304
Download
0
Embed Size (px)
Citation preview
AutomationTesting introduction
eleks.com
Agenda
• What and why automated testing?• Types of automated testing• When, Why, What automated
testing is needed• Unit testing 101• Unit testing tools
Why automated testing?• Testing happens to be complex
and expensive• Application tends to be very
complex to completely retest• Frequent releases• Long-term application support• Need to tell if application is
working after each commit/sprint in short term
Types of automated testing
UnitIntegration
Performance
Load
Stress
Penetration
Functional
Many more
When automated testing is needed?
• Good to have it always if possible
• When application requires complex setup scenarios for testing
• When testing takes long time to be performed
When automate?
• During development collaboratively
• After development by separate team if it is even possible
Unit testing
Unit testing
• Smallest testable part• Method level• Isolated• Forces better design• “mock” out what your not
testing fake data access class when testing business logic
Good unit test
• Fast• Readable• Maintainable• Reasonable• Independent• Working
Test Driven Development
Demo
Unit tests naming practices
• MethodName_StateUnderTest_ExpectedBehavior
Add_TwoAndFive_ReturnsSeven• Test[feature being tested]
TestThrowExceptionIfDivideByZero
• Given_PreconditionsWhen_StateUnderTest
Then_ExpectedBehaviorGivenCalculator_When_DivideByZero_Then_ThrowDivideByZeroException
Arrange->Act->Assert
Black magic
Unit testing frameworks
.NET: • xUnit and nUnit (mostly same features)
Isolation techniques
• Dummy – no implementation• Fake/Stub – minimal
implementation• Mock – verify if being called• Spy – record what been called
Demo
Mocking frameworks
Free:• Moq, JustMockLiteCommercial:• TypeMock Isolator,
JustMock, Fakes
Inspired by Technology.Driven by Value.
Find us at eleks.com
Have a question? Write to [email protected]