Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Walkman

No description
by

Dattathreya Hassan Sathyamurthy

on 26 November 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Walkman

Walkman
Never write another unit test
Dattathreya Sathyamurthy, Akhil Hingane, Piyush Masrani,
Amarnath Palavalli, Hemanth Pannem

vmware Bangalore
Unit Tests
Why Unit Test
Whats a Unit Test
Ideal Development Cycle
Reality
Whats the reason?
Where is the opportunity?
Resulting Test case
Proxy
Create AOP configuration to cover Class Under Test (CUT)
Create a AOP configuration to cover all dependencies
Persist
Parse CUT Calls
Configure
Walkman-config.xml
Select Classes to Test
Select classes to mock
Choose online/offline mode
Set target directory

Add walkman-config.xml to ApplicationContext
Test your scenario
Deploy your application
Run your manual test case
JSON
A json is generated in configured output directory
Generate Test cases
Generated test case
Most generated test cases are ready to run
Fix the mock data if mock creation fails
Add any additional asserts
Present
XML based configuration
JSON for persisting class interaction
Unit Tests, Functional tests and IntegrationTests
Online and Offline Test generation
Future
Eclipse, Intellij plugins
Pure Java serialization for persistence
AOP outside spring
Ability to mark start and end of test case during manual test
Ability to generate Zero touch test cases
Walkman
Simple and fast to use
Not intrusive with real code
Automatic generation of test case including
Mocks
Asserts
Recorded data made available separately for other purposes
Very near to Business data as this is a result of manual testing
Generated Test cases are easy to maintain
Google Codepro
bit.ly/1uKmzaB
Generates Unit test cases
Eclipse integration
Spring, Mockito, Easymock support
Uses Heuristics to determine input combination
Mutation Testing
Performs combinatorial testing with series of inputs
Useful for finding peripheral check bugs
Easy Coverage, JUB etc..
Easy coverage tries to generate unit test cases with Asserts but does not cover mocking
JUB just generates boiler plate code and not real test cases
AppPerfect captures Input coming to API from JSP and can replay, but suits integration testing only
Try Us!
Why Walkman?
Really? How?
OK Lets Roll!
Whats Next?
Lets Compare
Coverage
Resilience
Repeatability
Result Test Case
Design
JSON Capture
Test case generation
Online Mode
Manual Testing
Offline Mode
Automated
Independent (isolated)
Tests Single Logical Concept
Fast
Use of mocks is a common practice to achieve above objectives
Code
Manual Test
Fix issues
Unit Test
Commit
Code
Manual Test
Fix issues
Unit Test
Commit
May be
Where is the time?
Writing unit test is so complex
Mocking is as much effort as coding
Needs creativity for creating test data at a fine grained level
I am anyway doing Manual test, so why again?
I will write one positive unit test and manually test others
All code goes through multiple rounds of manual testing, by Dev and QE
The data that flows through the classes during this is the data that can be used for unit tests
This data can help us with both Mocks and Asserts
CUT
Proxy
Dependency
Proxy
Seed File
User
Proxy Definition
<ClassUnderTest>
com.vmware.xxx.Class1
com.vmware.xxx.Class2
com.vmware.xxx.Class3
</ClassUnderTest>
CUT AOP Proxy Definition
Dependency
Proxy Definition
Manual Test
UI/API of the App
CUT
CUT
CUT
Dependency
Dependency
Dependency
Dependency
Dependency
Seed File
New test
`
Invoke CUT
method
Add Assert for
return value
Parse Dependency Calls
Seed File
Mock the
Dependency
Invocation
Advantages:
Easy setup
Generates full test case
Problems:
Heuristics not good enough
No complex object handling
Problems
Complex to use
Test Data input is statistically generated and can't be near actual business data
JSON Format
gen-test tool
Uses walkman-config.xml to read json
Add application class libraries to class path
Generate tests
Driven by walkman-config.xml
Traps all classes under test
Traps all classes to mock
When Test class method is invoked push to stack
When mock class method completes, push params and results to stack
When test method returns, pop everything and..
Offline mode: write to json
Online mode: generate test method
TestCaseGenerator.java
TrapIoAspect.java
Reads each test method stack
Generate a Test method for each call on CUT
For each call on dependency
Generate a mock statement
Convert params and response to json strings
Add each param to 'when' of mock
Embed return value as mock response
Add @Mock with class name to test case
Method Invocation
Which class
What Method
Arguments passed
Response from
method
Lets try magic combinations
Unit Test
Identify any class to test as CUT
Mark every dependency for mocking
Functional Test
Identify module driver class as CUT
Mark inter-module dependencies for mocking
Integration tests
Identify API entry point class as CUT
No dependencies for mocking
Full transcript