DSL in test automation

Post on 28-Oct-2014

45 views 1 download

description

 

Transcript of DSL in test automation

DSL IN TEST AUTOMATION

Magus Chenmaguschen@hotmail.com

http://magustest.com/blog/

Company Logo

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

Q & A

Thank You