DSL in Test Automation Magus Chen email@example.com http://magustest.com/blog/
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 automation Automation everything… How about business logic??
DSL and Software Testing Solution One part of the people develop automation test suite, another people design test cases. Example
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