DSL in test automation
-
Upload
magus-chen -
Category
Technology
-
view
45 -
download
1
description
Transcript of DSL in test automation
Agenda
• What is DSL• DSL and Software Testing• Example
What is DSL
• Domain Specific Language:
– A computer programming language of limited
expressiveness focused on a particular domain.
– DSLs are very common in computing: examples include
CSS, regular expressions, make, ant, SQL, etc
• Two main styles of DSL
– External (SQL, CSS and XML configuration file)
– Internal (LINQ, jQuery)
GPPL
DSL
External DSL and Internal DSL
GPPL DSL
DSL and Software Testing
• What is the biggest problem in
Software Testing?
– Insufficient test coverage
– Tight schedule
• How can we survive?
– Test automationAutomation everything…How about business logic??
DSL and Software Testing
• Solution– One part of the people develop
automation test suite, another people design test cases.
• ExampleAction Check
Book a campaign Book successfully
Insert an IO Ditto
Insert a placement Ditto
Book an ad, target on v1 Ditto
User view asset v1 Ad n delivered
Example
• What to test?
– Unique report
• What challenge did I meet?
– Copy cookie every time
– Switch network id every time
– Modify asset id every time
– Too many information to mark down
• How to deal with these?
– Using Python as the host language to implement an internal DSL
Example
• The DSL looks like:
– test.user('a').view('magus-asset-1').anetwork('1').
onsite('MYSS').snetwork('1').
dnetwork('1').times(1).go()
• Pro
– All information in one place
– More readable test code
• How this works?
– Method Chaining
References
• http://en.wikipedia.org/wiki/Domain-specific_language
• http://www.martinfowler.com/bliki/DomainSpecificLanguage.html
• http://martinfowler.com/dslwip/MethodChaining.html
• http://www.infoq.com/presentations/domain-specific-languages
• http://www.ibm.com/developerworks/cn/java/j-lo-rubytesting/index.html
• http://martinfowler.com/dslwip/
Q & A
Thank You