Flex Mock Testing Frameworks: Comparative Analysis
-
Upload
nitin-khattar -
Category
Technology
-
view
2.121 -
download
0
description
Transcript of Flex Mock Testing Frameworks: Comparative Analysis
![Page 1: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/1.jpg)
Mocking in ActionScript 3.0: Comparative Analysis of various
mocking frameworks
![Page 2: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/2.jpg)
Basic HighlightsImportance of Mocking in Unit TestingHow to Mock?Exploring various mocking frameworksHands On some frameworksQ & A
![Page 3: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/3.jpg)
What is Mocking?
What is Mock Object?
![Page 4: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/4.jpg)
mock objects are simulated objects that mimic the
behavior of complex, real objects in controlled ways
![Page 5: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/5.jpg)
Why to Mock?
When to Mock?
Mock == Actual Object?
![Page 6: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/6.jpg)
If an object has any of the following characteristics, it may be useful to use a mock object in its place:
- supplies non-deterministic results (e.g. the current time or the current temperature);- has states that are difficult to create or reproduce (e.g. a network error);- is slow (e.g. a complete database, which would have to be initialized before the test);- does not yet exist or may change behavior;- would have to include information and methods exclusively for testing purposes (and not for its actual task).
![Page 7: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/7.jpg)
How to mock?
![Page 8: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/8.jpg)
Example:
The Greeting component says Hello in any language.Greeting uses a Translator component to translate “Hello” from English to the selected language.
ITranslator is an interface containing the translate method – parameters from, to and word, which returns the translated word;
![Page 9: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/9.jpg)
Traditional Way
Vs
Mocking Frameworks
![Page 10: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/10.jpg)
Traditional Way
![Page 11: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/11.jpg)
Evolution of Mocking Frameworks
Mock4AS
MockAS3
Mockolate
![Page 12: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/12.jpg)
Mock4ASRecord, Expect & VerifyAdded Mock into Traditional ApproachMore of Traditional touch and posses similar
issuesLess mature
![Page 13: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/13.jpg)
MockAS3Expectation BasedSimilar to Mock4AS in approachEnhanced Setting Expectations
* Receive Count , Property, Ordering Expectations, Calling Functions
Posses problems similar as in Traditional approach
![Page 14: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/14.jpg)
FlexUnit:Runners & Rules
Runners are classes that implement IRunner, and have the capability to run specific types of
suites, tests, or methods.Rules are an advanced concept whose basic functionality is similar to
the [Before] and [After] concepts, allowing for reusable, dynamic classes that will execute
functionality before and after each test.
![Page 15: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/15.jpg)
Kick started the concept of proxy mock objects
Purely Record-Replay BasedTotally bypassed the Traditional ApproachDifficult & complex to implementEnhanced & Advance Features:
Mock RepositoryMulti-Platform support (Flexunit, Asunit, Fluint..)Argument ConstraintsStub | Dynamic | Strict MocksEvent Stubbing …
![Page 16: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/16.jpg)
Purely Expectation BasedBased on Mockito for JavaEasy to learn & integrateMatcher, Hamcrest API integratedEmploys the concept of Rule & Runner in
FlexunitNot much advanced & mature features like
ASMock
![Page 17: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/17.jpg)
MockolateInclude Good aspects of ASMock & Mockito Expectation & Record-Replay basedNice | Strict | Partial MocksMocking & StubbingTest SpiesDecorators like EventDispatcher, HttpServiceCannot mock classes in default package
![Page 18: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/18.jpg)
What Suites You??
![Page 19: Flex Mock Testing Frameworks: Comparative Analysis](https://reader036.fdocuments.net/reader036/viewer/2022062703/554f652db4c905c8088b4ce9/html5/thumbnails/19.jpg)
Questions??