Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun...
-
Upload
jared-fleming -
Category
Documents
-
view
218 -
download
0
Transcript of Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun...
![Page 1: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/1.jpg)
Adapting MVC for Test Automation
![Page 2: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/2.jpg)
Who am I?
●Catalin Comanici
●QA for 10 years, doing test automation for about 6 years
●fun guy and rock star wannabe
![Page 3: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/3.jpg)
Agenda
● What is Model View Controller (MVC)?
● Common approaches and frameworks
● How can we use it?
3
![Page 4: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/4.jpg)
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
![Page 5: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/5.jpg)
What is MVC
![Page 6: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/6.jpg)
What is MVC
Design pattern separating:● logic● data● view
into different components
6
![Page 7: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/7.jpg)
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
![Page 8: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/8.jpg)
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
![Page 9: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/9.jpg)
View
● submits actions to Controller
● presents the model in a user friendly way
● usually called UI, GUI …
9
![Page 10: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/10.jpg)
Controler
● links User, View and Model
● responds to user input
● has no implication in business logic but mostly handles application flow
10
![Page 11: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/11.jpg)
Benefits
● clear separation of layers
● code reusability
● enables parallel development and developer specialization
11
![Page 12: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/12.jpg)
Disadvantages
● increased complexity
● not suitable for small applications
12
![Page 13: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/13.jpg)
Common approaches totest automation
![Page 14: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/14.jpg)
Record and playback
![Page 15: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/15.jpg)
Record and playback
Pros:● easy setup● rapid development
Cons:● not easy to customize ● not easy maintain● some workflows cannot be automated
15
![Page 16: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/16.jpg)
Script Modularity Framework
![Page 17: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/17.jpg)
Script Modularity Framework
Pros:● cost efficient maintenance● scalable● changes easily integrated
Cons:● sharing data between scripts is
challenging● test data duplicated
17
![Page 18: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/18.jpg)
Test Library Architecture
![Page 19: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/19.jpg)
Test Library Architecture
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
![Page 20: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/20.jpg)
Keyword-Driven
![Page 21: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/21.jpg)
Keyword-Driven
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
![Page 22: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/22.jpg)
Why change?
Because:
● we write rigid tests
● tests depend on lengthy setup
● maintenance costs can be high
22
![Page 23: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/23.jpg)
How can we use it?
![Page 24: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/24.jpg)
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
![Page 25: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/25.jpg)
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
![Page 26: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/26.jpg)
User interaction layer (View)
● simulates users interaction
● also contains page objects
● submits actions to controller
26
![Page 27: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/27.jpg)
Test layer (Controller)● contains all test assertion
● decides assertions based on context and data
● is called by the user interaction layer
27
![Page 28: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/28.jpg)
28
![Page 29: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/29.jpg)
Test commenting form
![Page 30: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/30.jpg)
30
function testCommentingForm (languageCode){
page.open(languageCode);controller.isPageLoaded();
page.clickAddComment();controller.isCommentFormOpen(languageCode);
page.addComment(”Test”);controller.isSuccessMessVisible();}
![Page 31: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/31.jpg)
3131
function isCommentFormOpen(languageCode){
if(languageCode == ‘us’){ assertEquals(
page.getNameFieldText(), data.getNameFieldTextValue(‘us’));…
} else{ assertEquals(
page.getNameFieldText(), data.getNameFieldTextValue(‘ro’));…
}
}
![Page 32: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/32.jpg)
Benefits
● clear separation of layers
● enables parallel development
● multiple asserts on each step
32
![Page 33: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/33.jpg)
Disadvantages
● if one assert fails, all the tests in that script fail
● requires coding discipline
● coding knowledge above average
33
![Page 34: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/34.jpg)
Solutions
Design patterns:● MVC● Observer pattern
Frameworks:● Spring ● Google Guice
34
![Page 35: Who am I? ● Catalin Comanici ● QA for 10 years, doing test automation for about 6 years ● fun guy and rock star wannabe.](https://reader035.fdocuments.in/reader035/viewer/2022062321/56649db55503460f94aa5fbd/html5/thumbnails/35.jpg)
Q&A