SlideShare a Scribd company logo
Boise Code Camp 2010 John Sonmez http://simpleprogrammer.com
Automated regression testing is hard Fragile tests Difficult to write tests Tools are expensive Recording is not flexible enough Tests failures don’t indicate code problem
 
#1 Problem with automated tests is the tests break easily. Screen changes cause multiple tests to break. Functionality or text changes cause tests to break. Why?  Multiple tests are dependant on parts of the user interface.
Recording is easy at first, until you need variables or reuse. Scripting the tests requires knowledge of HTML, CSS, Javascript and a high level programming language such as C# or Java. QA or business person thinks in terms of domain knowledge, not button clicks and HTML divs.
Most of the record tools have license costs from several hundred to several thousand dollars. Cost prohibitive, so only certain people in organization get license. Support contracts. Upgrade costs. “ Automation Experts” trained in the vendor specific tool are expensive.
Recording seems to work at first, but then the scenarios get more complicated. When the UI changes scripts have to be re-recorded. Recording limits the kinds of testing you can do. Test result interactions Check against external data source
False failures reduce the confidence in the tests.
Start treating test code like real code. Instead of building “test scripts”, build a “testing application.” Apply the same tools of good software craftmanship to test code craftmanship. Bridge the gap between domain knowledge and test writing.
User: Add a person to the case. Tester: 1. Click button with id=“loginPage123”. 2. Set focus userName field.  Add username to field. 3. Set focus passWord field.  Add password to field. 3. Click button with id=“login”. 4. Check HTML title for text containing “successful”. 5. Click div in top navigation with id of addPerson. 6. blah blah blah… blah blah blah
User: Add a person to the case. Tester: 1. Case.AddPerson(“Joe Smith”); 2. AssertTrue(Case.isPersonOnCase(“Joe Smith”)); Abstraction… Business language becomes testing language.
Internal Domain Specific Language (DSL) A language to write tests which uses the same or similar vocabulary as the business or user. Framework built specific to the application, not a general purpose testing framework. Framework developed by developers and testers collaboratively.  User of framework is test automation resources.
Domain Specific Language According to Wikipedia: A programming language or specification language dedicated to a particular problem domain, a particular problem representation technique, and/or a particular solution technique. Basically a custom programming language designed for a specific problem or set of problems.
A DSL that is a set of APIs still in the native language used to approximate a full DSL. Writing a language is hard. Writing an API is easier. Objected oriented programming techniques already lead us in this direction. We use internal DSLs in English all the time. Company acronyms and language. Programmer speak Slang
Remember the gap? Bridge the gap by building an application specific layer that exposes a DSL for writing tests. Hide the details about web pages, HTML, CSS, Javascript from the tests. Easy to use, fluent design.
 
The web browser provides us a layer we can use to abstract away the notion of parsing HTML, CSS and Javascript. Without the browser, we would have to write code to open HTTP connections and GET web pages. We would have to parse CSS, and Javascript, to verify functionality.
Web testing framework interacts with the browser for us. Operates on the DOM the browser provides. Without the Web Testing Framework, we would have to write code to manipulate the browser, and change it’s state through COM or some other interface.
We build this on top of the Web Testing Framework. Abstracts away all concepts having to do with browsers and HTML. Uses the Web Testing Framework to translate business language into web functionality. Contains all our changing things about the application. Without this layer our code would contain hard coded ids of elements and would have to deal with page layouts.
Uses only the application framework. Uses the internal DSL. Simple Written as close to business language as possible.
A good starting place is to start writing the test. Pretend like you don’t know anything about the web, but you do know about the application. Think “fluent.” Think easy to use.
Web based store. Write a test to create a new account and buy bananas. Account.Create(“Joe Smith”, “123 Main Street, Boise ID 83713”,  “joe@joesmith.com ”); Category.Fruits.GoTo(); Cart.AddItem(Items.BANANAS, 1); Cart.CheckOut(PaymentType.CreditCard); Simple, business logic based syntax.
Similar to Test Driven Development when unit testing. Build the business objects and methods needed to make the test syntax possible. Don’t worry about all the variations, only add what is needed for the test you are working on. Here the identifiers are hard coded in the business objects, NOT in the tests.
Account.Create Make an account class with a static method called create, that takes in a name, address, and email. In the method use the web testing framework to navigate to the account creation page and enter the information into the fields. After the information is entered create the new account. Default non-important selections.  (You can make them specific later if needed.)
Actual test layer. Think about how to achieve the same amount with fewer lines of code. The simpler and fewer lines of code to write the tests, the easier to write the tests. Eliminate variables that are not important to the test. Eliminate any steps that cannot vary.
Do we are about the account name, address, etc? Account.Create(“Joe Smith”, “123 Main Street, Boise ID 83713”,  “joe@joesmith.com ”); becomes Account.Create(People.Base_Case); Do we need to explicitly go to the fruits page to add a banana? Category.Fruits.GoTo(); Cart.AddItem(Items.BANANAS, 1); becomes Cart.AddItem(Items.BANANAS, 1);
Created for Dept of Health and Welfare IBES System to automate web testing. Creates test cases in very few lines of code. Able to write a test cases which goes through 30+ screens in a few minutes.
Test frameworks Watij ( http://watij.com/ ) Watin ( http://watin.sourceforge.net/ ) Watir ( http://watir.com/ ) My Blog, posts on automation and Watij. http://simpleprogrammer.com Contact me I can help you build your framework [email_address] Twitter jsonmez
 
Ad

Recommended

DSL in test automation
DSL in test automation
test test
 
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
DSL, Page Object and WebDriver – the path to reliable functional tests.pptx
Mikalai Alimenkou
 
Design patterns in web testing automation with WebDriver
Design patterns in web testing automation with WebDriver
Mikalai Alimenkou
 
Using Specflow for BDD
Using Specflow for BDD
Abhimanyu Singhal
 
Code Camp Applying Modern Software Development Techniques To Ui Testing
Code Camp Applying Modern Software Development Techniques To Ui Testing
ChristopherGTaylor
 
Behavior Driven Development
Behavior Driven Development
Dhawal Joshi
 
01 introduction to entity framework
01 introduction to entity framework
Maxim Shaptala
 
Acceptance Test Driven Development With Spec Flow And Friends
Acceptance Test Driven Development With Spec Flow And Friends
Christopher Bartling
 
Behavior Driven Development by Example
Behavior Driven Development by Example
Nalin Goonawardana
 
Selenium training
Selenium training
Robin0590
 
Java script
Java script
ITz_1
 
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
NCCOMMS
 
C++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of Class
Yogendra Rampuria
 
iOS development best practices
iOS development best practices
Michal Juhas
 
Java script
Java script
umesh patil
 
06 integrating extra features and looking forward
06 integrating extra features and looking forward
Марина Босова
 
Introduction to Java Script
Introduction to Java Script
Vijay Kumar Verma
 
Getting Started with Selenium
Getting Started with Selenium
Dave Haeffner
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
Adam Englander
 
Testing Web Services - QA or the Highway 2016
Testing Web Services - QA or the Highway 2016
Steinn 'Stan' Jónsson
 
Java Script
Java Script
husbancom
 
Selenium training in pune course content advanto software
Selenium training in pune course content advanto software
Advanto Software
 
Aspect-Oriented Programming for PHP
Aspect-Oriented Programming for PHP
William Candillon
 
Unit tests benefits
Unit tests benefits
Kate Semizhon
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
Shawn Jones
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Learning Slot
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
Learning Slot
 
TDD and BDD and ATDD
TDD and BDD and ATDD
Anuar Nurmakanov
 
The Testing Planet Issue 2
The Testing Planet Issue 2
Rosie Sherry
 
Test Automation Best Practices (with SOA test approach)
Test Automation Best Practices (with SOA test approach)
Leonard Fingerman
 

More Related Content

What's hot (20)

Behavior Driven Development by Example
Behavior Driven Development by Example
Nalin Goonawardana
 
Selenium training
Selenium training
Robin0590
 
Java script
Java script
ITz_1
 
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
NCCOMMS
 
C++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of Class
Yogendra Rampuria
 
iOS development best practices
iOS development best practices
Michal Juhas
 
Java script
Java script
umesh patil
 
06 integrating extra features and looking forward
06 integrating extra features and looking forward
Марина Босова
 
Introduction to Java Script
Introduction to Java Script
Vijay Kumar Verma
 
Getting Started with Selenium
Getting Started with Selenium
Dave Haeffner
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
Adam Englander
 
Testing Web Services - QA or the Highway 2016
Testing Web Services - QA or the Highway 2016
Steinn 'Stan' Jónsson
 
Java Script
Java Script
husbancom
 
Selenium training in pune course content advanto software
Selenium training in pune course content advanto software
Advanto Software
 
Aspect-Oriented Programming for PHP
Aspect-Oriented Programming for PHP
William Candillon
 
Unit tests benefits
Unit tests benefits
Kate Semizhon
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
Shawn Jones
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Learning Slot
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
Learning Slot
 
TDD and BDD and ATDD
TDD and BDD and ATDD
Anuar Nurmakanov
 
Behavior Driven Development by Example
Behavior Driven Development by Example
Nalin Goonawardana
 
Selenium training
Selenium training
Robin0590
 
Java script
Java script
ITz_1
 
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
NCCOMMS
 
C++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of Class
Yogendra Rampuria
 
iOS development best practices
iOS development best practices
Michal Juhas
 
06 integrating extra features and looking forward
06 integrating extra features and looking forward
Марина Босова
 
Getting Started with Selenium
Getting Started with Selenium
Dave Haeffner
 
PHPConf.asia 2016 - BDD with Behat for Beginners
PHPConf.asia 2016 - BDD with Behat for Beginners
Adam Englander
 
Testing Web Services - QA or the Highway 2016
Testing Web Services - QA or the Highway 2016
Steinn 'Stan' Jónsson
 
Selenium training in pune course content advanto software
Selenium training in pune course content advanto software
Advanto Software
 
Aspect-Oriented Programming for PHP
Aspect-Oriented Programming for PHP
William Candillon
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
Shawn Jones
 
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Interview question & Answers for 3+ years experienced in Selenium | LearningSlot
Learning Slot
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
Learning Slot
 

Similar to Internal DSLs For Automated Functional Testing (20)

The Testing Planet Issue 2
The Testing Planet Issue 2
Rosie Sherry
 
Test Automation Best Practices (with SOA test approach)
Test Automation Best Practices (with SOA test approach)
Leonard Fingerman
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
Troyfawkes
 
Access tips access and sql part 4 building select queries on-the-fly
Access tips access and sql part 4 building select queries on-the-fly
quest2900
 
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Sean Burgess
 
HNDIT1022 Week 08, 09 10 Theory web .pptx
HNDIT1022 Week 08, 09 10 Theory web .pptx
IsuriUmayangana
 
GCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptx
azida3
 
Getting Started with Iron Speed Designer
Getting Started with Iron Speed Designer
Iron Speed
 
Intro to mobile web application development
Intro to mobile web application development
zonathen
 
Getting Started in Custom Programming for Talent Sourcing
Getting Started in Custom Programming for Talent Sourcing
Glenn Gutmacher
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Sean Burgess
 
How websites and search engines work
How websites and search engines work
Brian Duffy
 
Autonomous End-to-End Testing for Online Banking Applications Presented with ...
Autonomous End-to-End Testing for Online Banking Applications Presented with ...
Applitools
 
Lecture-7.pptx
Lecture-7.pptx
vishal choudhary
 
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
John Head
 
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
akassabov
 
INTRODUCTIONS OF HTML
INTRODUCTIONS OF HTML
SURYANARAYANBISWAL1
 
SELJE_Database_Unit_Testing.pdf
SELJE_Database_Unit_Testing.pdf
Eric Selje
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
dominion
 
Code review
Code review
Abhishek Sur
 
The Testing Planet Issue 2
The Testing Planet Issue 2
Rosie Sherry
 
Test Automation Best Practices (with SOA test approach)
Test Automation Best Practices (with SOA test approach)
Leonard Fingerman
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
Troyfawkes
 
Access tips access and sql part 4 building select queries on-the-fly
Access tips access and sql part 4 building select queries on-the-fly
quest2900
 
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
BP304 - Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Sean Burgess
 
HNDIT1022 Week 08, 09 10 Theory web .pptx
HNDIT1022 Week 08, 09 10 Theory web .pptx
IsuriUmayangana
 
GCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptx
azida3
 
Getting Started with Iron Speed Designer
Getting Started with Iron Speed Designer
Iron Speed
 
Intro to mobile web application development
Intro to mobile web application development
zonathen
 
Getting Started in Custom Programming for Talent Sourcing
Getting Started in Custom Programming for Talent Sourcing
Glenn Gutmacher
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Sean Burgess
 
How websites and search engines work
How websites and search engines work
Brian Duffy
 
Autonomous End-to-End Testing for Online Banking Applications Presented with ...
Autonomous End-to-End Testing for Online Banking Applications Presented with ...
Applitools
 
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
John Head
 
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
LotusUserGroup.org Virtual User Group Meeting - The Real World Integration
akassabov
 
SELJE_Database_Unit_Testing.pdf
SELJE_Database_Unit_Testing.pdf
Eric Selje
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
dominion
 
Ad

Recently uploaded (20)

FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
Cluster-Based Multi-Objective Metamorphic Test Case Pair Selection for Deep N...
janeliewang985
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
Information Security Response Team Nepal_npCERT_Vice_President_Sudan_Jha.pdf
ICT Frame Magazine Pvt. Ltd.
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Ad

Internal DSLs For Automated Functional Testing

  • 1. Boise Code Camp 2010 John Sonmez http://simpleprogrammer.com
  • 2. Automated regression testing is hard Fragile tests Difficult to write tests Tools are expensive Recording is not flexible enough Tests failures don’t indicate code problem
  • 3.  
  • 4. #1 Problem with automated tests is the tests break easily. Screen changes cause multiple tests to break. Functionality or text changes cause tests to break. Why? Multiple tests are dependant on parts of the user interface.
  • 5. Recording is easy at first, until you need variables or reuse. Scripting the tests requires knowledge of HTML, CSS, Javascript and a high level programming language such as C# or Java. QA or business person thinks in terms of domain knowledge, not button clicks and HTML divs.
  • 6. Most of the record tools have license costs from several hundred to several thousand dollars. Cost prohibitive, so only certain people in organization get license. Support contracts. Upgrade costs. “ Automation Experts” trained in the vendor specific tool are expensive.
  • 7. Recording seems to work at first, but then the scenarios get more complicated. When the UI changes scripts have to be re-recorded. Recording limits the kinds of testing you can do. Test result interactions Check against external data source
  • 8. False failures reduce the confidence in the tests.
  • 9. Start treating test code like real code. Instead of building “test scripts”, build a “testing application.” Apply the same tools of good software craftmanship to test code craftmanship. Bridge the gap between domain knowledge and test writing.
  • 10. User: Add a person to the case. Tester: 1. Click button with id=“loginPage123”. 2. Set focus userName field. Add username to field. 3. Set focus passWord field. Add password to field. 3. Click button with id=“login”. 4. Check HTML title for text containing “successful”. 5. Click div in top navigation with id of addPerson. 6. blah blah blah… blah blah blah
  • 11. User: Add a person to the case. Tester: 1. Case.AddPerson(“Joe Smith”); 2. AssertTrue(Case.isPersonOnCase(“Joe Smith”)); Abstraction… Business language becomes testing language.
  • 12. Internal Domain Specific Language (DSL) A language to write tests which uses the same or similar vocabulary as the business or user. Framework built specific to the application, not a general purpose testing framework. Framework developed by developers and testers collaboratively. User of framework is test automation resources.
  • 13. Domain Specific Language According to Wikipedia: A programming language or specification language dedicated to a particular problem domain, a particular problem representation technique, and/or a particular solution technique. Basically a custom programming language designed for a specific problem or set of problems.
  • 14. A DSL that is a set of APIs still in the native language used to approximate a full DSL. Writing a language is hard. Writing an API is easier. Objected oriented programming techniques already lead us in this direction. We use internal DSLs in English all the time. Company acronyms and language. Programmer speak Slang
  • 15. Remember the gap? Bridge the gap by building an application specific layer that exposes a DSL for writing tests. Hide the details about web pages, HTML, CSS, Javascript from the tests. Easy to use, fluent design.
  • 16.  
  • 17. The web browser provides us a layer we can use to abstract away the notion of parsing HTML, CSS and Javascript. Without the browser, we would have to write code to open HTTP connections and GET web pages. We would have to parse CSS, and Javascript, to verify functionality.
  • 18. Web testing framework interacts with the browser for us. Operates on the DOM the browser provides. Without the Web Testing Framework, we would have to write code to manipulate the browser, and change it’s state through COM or some other interface.
  • 19. We build this on top of the Web Testing Framework. Abstracts away all concepts having to do with browsers and HTML. Uses the Web Testing Framework to translate business language into web functionality. Contains all our changing things about the application. Without this layer our code would contain hard coded ids of elements and would have to deal with page layouts.
  • 20. Uses only the application framework. Uses the internal DSL. Simple Written as close to business language as possible.
  • 21. A good starting place is to start writing the test. Pretend like you don’t know anything about the web, but you do know about the application. Think “fluent.” Think easy to use.
  • 22. Web based store. Write a test to create a new account and buy bananas. Account.Create(“Joe Smith”, “123 Main Street, Boise ID 83713”, “[email protected] ”); Category.Fruits.GoTo(); Cart.AddItem(Items.BANANAS, 1); Cart.CheckOut(PaymentType.CreditCard); Simple, business logic based syntax.
  • 23. Similar to Test Driven Development when unit testing. Build the business objects and methods needed to make the test syntax possible. Don’t worry about all the variations, only add what is needed for the test you are working on. Here the identifiers are hard coded in the business objects, NOT in the tests.
  • 24. Account.Create Make an account class with a static method called create, that takes in a name, address, and email. In the method use the web testing framework to navigate to the account creation page and enter the information into the fields. After the information is entered create the new account. Default non-important selections. (You can make them specific later if needed.)
  • 25. Actual test layer. Think about how to achieve the same amount with fewer lines of code. The simpler and fewer lines of code to write the tests, the easier to write the tests. Eliminate variables that are not important to the test. Eliminate any steps that cannot vary.
  • 26. Do we are about the account name, address, etc? Account.Create(“Joe Smith”, “123 Main Street, Boise ID 83713”, “[email protected] ”); becomes Account.Create(People.Base_Case); Do we need to explicitly go to the fruits page to add a banana? Category.Fruits.GoTo(); Cart.AddItem(Items.BANANAS, 1); becomes Cart.AddItem(Items.BANANAS, 1);
  • 27. Created for Dept of Health and Welfare IBES System to automate web testing. Creates test cases in very few lines of code. Able to write a test cases which goes through 30+ screens in a few minutes.
  • 28. Test frameworks Watij ( http://watij.com/ ) Watin ( http://watin.sourceforge.net/ ) Watir ( http://watir.com/ ) My Blog, posts on automation and Watij. http://simpleprogrammer.com Contact me I can help you build your framework [email_address] Twitter jsonmez
  • 29.