From the course: Advanced Selenium: Page Objects and GUI Automation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Code-based DSLs with fluent interfaces

Code-based DSLs with fluent interfaces

From the course: Advanced Selenium: Page Objects and GUI Automation

Start my 1-month free trial

Code-based DSLs with fluent interfaces

- So here is a test a code based DSL test. And you can see that it's using the domain objects very similar to the ones we've created before. There's a user object, a to do list name object. And I've written a comment here that I want to expand the test. Now ideally, I would like the test to look like my comment or read like the comment. So what I'm going to do is I'm going to enhance these domain objects to work as a code based domain specific language. So the first thing I want to do is have the user think of a to do list name, which is what the comment actually says. And if I use alt Enter, then I can create that method. And we've actually got the code to do that in the test. So I bring this in and make the list Name field, then that will be stored in here. So when the user thinks of a to do list name, it generates it and stores it. And I can see that my create To Do List also takes a…

Contents