DSL in test automation

5,041 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
5,041
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Quotes from Martin Fowlercomputer programming language: A DSL is used to humans to instruct a computer to do something, as well as helping communication between humans.language nature: A DSL is a programming language, and as such should have a sense of fluency where the expressiveness comes not just from individual expressions but also the way they can by composed together.limited expressiveness: a general purpose programming language provides lots of capabilities, supporting varied data, control, and abstraction structures. All of this is useful but makes it harder to learn and use. A DSL supports a bare minimum of features needed to support its domain. You can't build an entire software system in a DSL, rather you use a DSL for one particular aspect of a system.domain focus: a limited language is only useful if it has a clear focus on a limited domain. The domain focus is what makes a limited language worthwhile.External DSLs are DSLs that use a different language to the main language of the application that uses them.Internal DSLs use the same general purpose programming language that the wider application uses, but uses that language in a particular and limited style. Only a subset of language constructs are used, and only to drive a particular aspect of the application.
  • DSL in test automation

    1. 1. DSL in Test Automation<br />Magus Chen<br />maguschen@hotmail.com<br />http://magustest.com/blog/<br />
    2. 2. Agenda<br />What is DSL<br />DSL and Software Testing<br />Example<br />
    3. 3. What is DSL<br />Domain Specific Language: <br />A computer programming language of limited expressiveness focused on a particular domain.<br />DSLs are very common in computing: examples include CSS, regular expressions, make, ant, SQL, etc<br />Two main styles of DSL<br />External (SQL, CSS and XML configuration file)<br />Internal (LINQ, jQuery)<br />
    4. 4. GPPL<br />DSL<br />External DSL and Internal DSL<br />GPPL<br />DSL<br />
    5. 5. DSL and Software Testing<br />What is the biggest problem in Software Testing?<br />Insufficient test coverage<br />Tight schedule<br />How can we survive?<br />Test automation<br />Automation everything…<br />How about business logic??<br />
    6. 6. DSL and Software Testing<br />Solution<br />One part of the people develop automation test suite, another people design test cases.<br />Example<br />
    7. 7. Example<br />What to test?<br />Unique report<br />What challenge did I meet?<br />Copy cookie every time<br />Switch network id every time<br />Modify asset id every time<br />Too many information to mark down<br />How to deal with these?<br />Using Python as the host language to implement an internal DSL<br />
    8. 8. Example<br />The DSL looks like:<br />test.user('a').view('magus-asset-1').anetwork('1').onsite('MYSS').snetwork('1').dnetwork('1').times(1).go()<br />Pro<br />All information in one place<br />More readable test code<br />How this works?<br />Method Chaining<br />
    9. 9. References<br />http://en.wikipedia.org/wiki/Domain-specific_language<br />http://www.martinfowler.com/bliki/DomainSpecificLanguage.html<br />http://martinfowler.com/dslwip/MethodChaining.html<br />http://www.infoq.com/presentations/domain-specific-languages<br />http://www.ibm.com/developerworks/cn/java/j-lo-rubytesting/index.html<br />http://martinfowler.com/dslwip/<br />
    10. 10. Q & A<br />
    11. 11. Thank You<br />

    ×