DSL in test automation

11
DSL IN TEST AUTOMATION Magus Chen [email protected] http://magustest.com/blog/ Company Logo

description

 

Transcript of DSL in test automation

Page 1: DSL in test automation

DSL IN TEST AUTOMATION

Magus [email protected]

http://magustest.com/blog/

Company Logo

Page 2: DSL in test automation

Agenda

• What is DSL• DSL and Software Testing• Example

Page 3: DSL in test automation

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)

Page 4: DSL in test automation

GPPL

DSL

External DSL and Internal DSL

GPPL DSL

Page 5: DSL in test automation

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

Page 6: DSL in test automation

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

Page 7: DSL in test automation

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

Page 8: DSL in test automation

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

Page 10: DSL in test automation

Q & A

Page 11: DSL in test automation

Thank You