Download presentation
Presentation is loading. Please wait.
Published byJared Fleming Modified over 9 years ago
2
Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe
3
Agenda ●What is Model View Controller (MVC)? ●Common approaches and frameworks ●How can we use it? 3
4
What this is not ●this is not a silver bullet ●this might not work for all projects ●I have not built a complete framework around this approach YET 4
6
What is MVC Design pattern separating: ●logic ●data ●view into different components 6
7
View Submits user actions and user data to Controller Controller Submits data to Model Returns data from Model to View Model Persists data in databases Returns data to Controller
8
Model ●provides business objects to controller ●data access is uniform regardless of the data source ●if data source or the way data is stored changes, it requires changing only this layer 8
9
View ●submits actions to Controller ●presents the model in a user friendly way ●usually called UI, GUI … 9
10
Controler ●links User, View and Model ●responds to user input ●has no implication in business logic but mostly handles application flow 10
11
Benefits ●clear separation of layers ●code reusability ●enables parallel development and developer specialization 11
12
Disadvantages ●increased complexity ●not suitable for small applications 12
14
Record and playback
15
Pros: ●easy setup ●rapid development Cons: ●not easy to customize ●not easy maintain ●some workflows cannot be automated 15
16
Script Modularity Framework
17
Pros: ●cost efficient maintenance ●scalable ●changes easily integrated Cons: ●sharing data between scripts is challenging ●test data duplicated 17
18
Test Library Architecture
19
Pros: ●low cost efficient maintenance and scalability ●great degree of reusability Cons: ●data lives in the test scripts ●library can grow to be complicated 19
20
Keyword-Driven
21
Pros: ●reduced number of test scripts ●keywords are highly reusable ●Increases flexibility and maintainability Cons: ●high degree of programming knowledge ●becomes complicated gradually ●process is complex 21
22
Why change? Because: ●we write rigid tests ●tests depend on lengthy setup ●maintenance costs can be high 22
24
How can we use it? Implement the best bits: ●clear separation of concerns ●one layer to share data across our tests ●create reusable components 24
25
Data layer (MODEL) ●one layer to store data and share across all tests ●uniform structure for simple reuse ●aggregate data from setup methods and other tests 25
26
User interaction layer (View) ●simulates users interaction ●also contains page objects ●submits actions to controller 26
27
Test layer (Controller) ●contains all test assertion ●decides assertions based on context and data ●is called by the user interaction layer 27
28
28
29
Test commenting form
30
30 function testCommentingForm (languageCode){ page.open(languageCode); controller.isPageLoaded(); page.clickAddComment(); controller.isCommentFormOpen(languageCode); page.addComment(”Test”); controller.isSuccessMessVisible(); }
31
31 function isCommentFormOpen(languageCode){ if(languageCode == ‘us’){ assertEquals( page.getNameFieldText(), data.getNameFieldTextValue(‘us’)); … } else{ assertEquals( page.getNameFieldText(), data.getNameFieldTextValue(‘ro’)); … }
32
Benefits ●clear separation of layers ●enables parallel development ●multiple asserts on each step 32
33
Disadvantages ●if one assert fails, all the tests in that script fail ●requires coding discipline ●coding knowledge above average 33
34
Solutions Design patterns: ●MVC ●Observer pattern Frameworks: ●Spring ●Google Guice 34
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.