Test Automation Principles
-
Upload
netsuite -
Category
Technology
-
view
3.783 -
download
0
Transcript of Test Automation Principles
![Page 1: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/1.jpg)
Test Automation and xUnitTest Automation and xUnit
Author:Carlo Ibarra
Author:Carlo Ibarra
![Page 2: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/2.jpg)
ScopeScope
Does not cover TDD.Test automation, principles and best practices.
xUnit basics.
Does not cover TDD.Test automation, principles and best practices.
xUnit basics.
![Page 3: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/3.jpg)
TerminologyTerminology
SUT – system under test.
DOC – depended on component.
Fixture – preconditions to a test; everything a test needs to set up before assertion.
SUT – system under test.
DOC – depended on component.
Fixture – preconditions to a test; everything a test needs to set up before assertion.
![Page 4: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/4.jpg)
Test AutomationTest Automation
“What I need is a list of specific unknown problems we will
encounter.”
- a Dilbert Quotes contest entry
![Page 5: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/5.jpg)
Goals of Test AutomationGoals of Test Automation Tests should help us improve quality. Tests should help us improve quality.
Tests should help us understand the SUT. Tests should help us understand the SUT.
Tests should reduce (and not introduce) risks. Tests should reduce (and not introduce) risks.
Tests should be easy to run. Tests should be easy to run.
Tests should be easy to write. Tests should be easy to write.
Tests should require minimal maintenance as the system evolves around them. Tests should require minimal maintenance as the system evolves around them.
![Page 6: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/6.jpg)
Four-Phase TestFour-Phase Test
1. Fixture Setup- test data, mocks, expected results constants
1. Fixture Setup- test data, mocks, expected results constants
2. Exercise SUT- Interact with the SUT to exercise desired behavior
2. Exercise SUT- Interact with the SUT to exercise desired behavior
3. Result Verification- Determine if expected outcome is obtained
3. Result Verification- Determine if expected outcome is obtained
4. Teardown- Restore state back to the state before testing
4. Teardown- Restore state back to the state before testing
![Page 7: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/7.jpg)
The “Fragile Test” ProblemThe “Fragile Test” Problem
Behavior sensitivity- Change in requirements, functionality
Interface sensitivity- Change in UI
Data sensitivity- Change in source structures and state
Context sensitivity - Change in workflow or external DOCs
Behavior sensitivity- Change in requirements, functionality
Interface sensitivity- Change in UI
Data sensitivity- Change in source structures and state
Context sensitivity - Change in workflow or external DOCs
![Page 8: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/8.jpg)
Principles of Test Automation
“Quality is free, but only to those
who are willing to pay heavily for it.”
- Lister, Demarco: “Peopleware”
![Page 9: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/9.jpg)
Principle:
Write the Tests First.
![Page 10: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/10.jpg)
Principle:
Use the Front Door First.
![Page 11: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/11.jpg)
Principle:
Communicate Intent.
![Page 12: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/12.jpg)
Principle:
Don’t Modify the SUT.
![Page 13: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/13.jpg)
Principle:
Keep the Tests Independent.
![Page 14: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/14.jpg)
Principle:
Isolate the SUT.
![Page 15: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/15.jpg)
Principle:
Minimize Test Overlap.
![Page 16: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/16.jpg)
Principle:
Minimize Untestable Code.
![Page 17: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/17.jpg)
Principle:
Keep Test Logic Out of Production.
![Page 18: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/18.jpg)
Principle:
Verify One Condition Per Test.
![Page 19: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/19.jpg)
Principle:
Test Concerns Separately.
![Page 20: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/20.jpg)
Principle:
Ensure Commensurate Effort
and Responsibility.
![Page 21: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/21.jpg)
xUnit BasicsxUnit Basics
“In order to make an apple pie from scratch,you must first create the universe.”
- Carl Sagan
“In order to make an apple pie from scratch,you must first create the universe.”
- Carl Sagan
![Page 22: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/22.jpg)
Introducing xUnitIntroducing xUnit Make it easy for developers to write test without
learning a new language.
Make it easy to test individual classes and objects without needing to have the rest of the application available.
Make it easy to run test or many test in a single action.
Minimize the cost of running tests so programmers aren’t discourage from running existing tests.
Make it easy for developers to write test without learning a new language.
Make it easy to test individual classes and objects without needing to have the rest of the application available.
Make it easy to run test or many test in a single action.
Minimize the cost of running tests so programmers aren’t discourage from running existing tests.
![Page 23: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/23.jpg)
Common FeaturesCommon Features
Specify a test as a Test Method.
Specify the expected results within the test method in the form of calls to assertion methods.
Aggregate the tests into test suites that can be run as a single operation.
Run one or more tests to get a report on the results of a test run.
Specify a test as a Test Method.
Specify the expected results within the test method in the form of calls to assertion methods.
Aggregate the tests into test suites that can be run as a single operation.
Run one or more tests to get a report on the results of a test run.
![Page 24: Test Automation Principles](https://reader033.fdocuments.us/reader033/viewer/2022052505/555c2254d8b42a09438b4a2b/html5/thumbnails/24.jpg)
Q&AQ&A