Hi,
Since a lot of people have been asking me how to use your XText DSL project to publish your artefacts to be used via the Eclipse update manager I decided to outline the structure of the project in a couple of posts.
I am not gonna explain how XText works, nor will I give an in-depth explanation of any of the other tools used. You should be somewhat familiar with the frameworks mentioned. In addition, for the packaging you should be familiar with the concepts of OSGi, as the final result will be assembled as "bundles".
A word about me: My name is Sebastian, I am a professional software developer living in Cape Town, South Africa. I was born and raised in Germany, decided to move to this side of the world 5 years ago.
So, what tools do we need?
1) First and foremost you need Eclipse as an IDE.
3) Maven, with a couple of plugins...later more. The tycho plugin allows to package the artefacts so they can be installed via the Eclipse update manager.
Those are the basics, the non-negotiables...everything below are tools I like to use but those can easily be replaced or even removed.
4) Since the purpose of my DSL was to browser-test a third-party application which we are configuring for our clients, Selenium. Selenium is fantastic to do cross-browser testing, it provides an IDE which is in fact a plugin into Firefox; it also allows you to connect several clients to Selenium-Grid to load-test and multi-browser test your application.
The CI server we use, Jenkins, has a Selenium grid plugin so your CI server also acts a Selenium-Grid server...but that's not part of this blog.
5) Scala and Scalatest. I cannot imagine developing software without Scala anymore, and Scalatest already provides a simplified DSL to interact with Selenium.
6) TestNG. I personally prefer TestNG to JUnit, due to various reasons - in this project however I simply chose TestNG because of the nice reports one can produce in combination with ReportNG.
Thats's about it...we are ready to start. Needless to say all of the frameworks mentioned above nicely integrate with Eclipse and are open-source!
The project - what do we want to achieve
The objective of my project was to allow a non-technical person (in my case testers) to write tests that can be executed automatically, without the person having to know any of the tools mentioned above. A prospective tool had to be easy to use, the setup as simple as possible. Thus XText, packaged as an Eclipse plugin was the obvious choice with Eclipse's support of code completion, on-the-fly validation and mouse-hover support to show pop-ups with help/documentation. The hover support turned out to be the most difficult part of the exercise as I wanted hover support for the keywords and not only for the modeled variables.
A test should ideally look something like this:
Login with "<username>", "<password>" into <URL>
Click menu-item "<Open Form ABC>"
Enter "<1980-05-12>" in DateOfBirth
Enter "<Smith>" in Lastname
Tick NewContact
In the above sample the words in dark purple indicate code-completion; i.e. the user simply has to press <Ctrl><Space> in Eclipse and can then select from a list. There is not much to type, is there? In addition, I modelled my DSL so you have to start with login, put in a little regex to show a warning if an incorrect date is entered, and show an error when you try to enter text/strings in a date field. So, that's the objective. In the next post I start with the skeleton maven project.