Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

DSL in test automation

7,159 views

Published on

Published in: Technology
  • Be the first to comment

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 />

×