test automation architecture that works by bhupesh dahal
TRANSCRIPT
![Page 1: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/1.jpg)
Test Automation Architecture One that works!
Presented by Bhupesh Dahal
![Page 2: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/2.jpg)
Who am I?&
Why am I here?
![Page 3: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/3.jpg)
Agenda• Background - Why test automation, common
view of test automation?• Define Problems - Issues most organizations
face with test automation.• Fixing the above issues with architecture that
has the most ROI.• Review
![Page 4: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/4.jpg)
Why Test Automation?Dev Team’s Perspective• Increase effectiveness,
efficiency, and coverage of software testing.
• For regression testing.• Improve quality.
Boss’s Perspective• Reduce operational cost.• Increase revenue.
![Page 5: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/5.jpg)
What comes to your mind when you hear the term “We have
Automated Tests”?
![Page 6: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/6.jpg)
Replicating Manual testing - GUI Testing Functional Test
![Page 7: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/7.jpg)
Take the weight off of the manual testers
![Page 8: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/8.jpg)
Focused on GUI testing • Hire consultants onshore/offshore with
mantra “Automate everything”.• Qtp, Watir, Selenium Webdriver etc. use tools
specific to GUI tests.• Every single small scenario gets added to GUI
automation.
![Page 9: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/9.jpg)
Test starts failing randomly
![Page 10: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/10.jpg)
When you need the test to run - It never works.
Please work!
![Page 11: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/11.jpg)
What’s the problem eh?• Test execution is slow.• Tests are fragile. • Tests are not reusable.• Tests needs more infrastructure.• Test never works on my box but
fails on daily run.
More time spent on figuring why the tests are failing. Resource tied up just reviewing failures.Maintenance takes way too much time.
![Page 12: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/12.jpg)
![Page 13: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/13.jpg)
Goal of Automation Ends up being
![Page 14: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/14.jpg)
Why do we end up in this situation?
![Page 15: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/15.jpg)
Ignoring the fundamentals.
![Page 16: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/16.jpg)
Golden Rule
Testing different layers.
![Page 17: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/17.jpg)
GUI Layer test• Test the whole application end to end.• Sensitive to UI changes.• Does not require good code.• Works for Legacy system and with newer software
architecture like SOA as it is independent of backend technology.
e.g. Open a browser, fill in the form and submit the data.
![Page 18: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/18.jpg)
API/Service Layer test• Test the application logic by making service calls.• Faster than UI testing.• Requires service to exist.• E.g. Instantiate the calculator service and get it to
add two numbers.
![Page 19: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/19.jpg)
Unit level test
• Test individual classes.• Much faster than service level testing. • Requires good design.
![Page 20: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/20.jpg)
Application UI
Tightly Coupled
Automated UI tests
Service LayerAutomated One Level Below UI
DAO Layer
Fragile
Lag with Current Development
Robust & Stable
With Current Dev cycle
Fast Execution
UI Independent
![Page 21: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/21.jpg)
So how to build your pyramid ?
![Page 22: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/22.jpg)
Start with Unit Test (Quality is not just QA’s responsibility)
• Isolation.• Test small piece of code - preferably separate test for
each method.• Biggest test should be one test for a class.• Use mock services to remove dependency.• Test only public endpoints. • This forces to use good design.
![Page 23: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/23.jpg)
Invest more in Service Layer Test • Independent functional test.• Use BDD tools like Cucumber, SpecFlow,
Jbehave.• Use mocks but also have specific tests to
check third party calls.• Add data validation tests.• Tests for boundary condition.• Tests for error handling - wrong data
type, missing data.• Tests around calculations, business rules
etc.
Gherkin/Plain test
DSL(Domain Specific Language)
Set up projects/helpers,
mock
Framework
Nunit,Junit,Rspec, xunit
GUI
Service Layer
![Page 24: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/24.jpg)
Limit the Number of GUI test
• Ask if it can be tested in Service layer before starting.• Start out with use and throw style test.• Gradually build the framework.• Use GUI test as an assistance for manual testing.• Create fewer tests but with broader end to end
coverage.
![Page 25: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/25.jpg)
Quick Guide to Building GUI Test Framework
• Do basic meta - programming and start automation. Don’t design the entire framework right away.
• Re - factor often.• Review test automation architecture
regularly.• Run daily.
Gherkin/Plain test
Framework
Watir/Selenium Webdriver/QTP
WorkFlows
Pages
Navigation UI Utilities
![Page 26: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/26.jpg)
GUI
Service/Api Layer
Unit Test
Unit Test
Business Logic
Data access layer
Mocked Data access layer
Mocked Database
Unit tests that isolate dependencies with fakes,
mocks, stubs etc
Database
Can use just unit test framework like Nunit, Xunit prefer BDD style
like Cucumber, specflow , Jbehave etc
End to end UI test with tools
like Watir, Selenium, QTP
etc
Automated UI Test
UI
Unit TestIntegration
TestIntegration
TestIntegration
Test
Business Logic Business Logic
Data access layer
Data access layer
Data access layer
Mocked Database
DatabaseDatabase
Data access layer
Business Logic
![Page 27: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/27.jpg)
Once you get the pyramid built
![Page 28: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/28.jpg)
Review
• Prioritize Unit and API/Service test automation.
• Limit the number of GUI tests, have a fixed number of stable end-to-end tests.
• It’s ok to use multiple technologies.• It’s ok to use Record/Play tools like
Selenium IDE for throwaway tests.• It is better to have 50 stable test
cases than 500 fragile ones that breaks regularly.
![Page 29: Test Automation Architecture That Works by Bhupesh Dahal](https://reader035.vdocument.in/reader035/viewer/2022062503/5874bd2f1a28ab1b098b8c87/html5/thumbnails/29.jpg)
Hope you all catch tons of Bugs!!
https://www.linkedin.com/in/bhupeshdahal