The first thing to do with Atomic34 is to create the definition file for the site you want to test. We will create a small demo using Google. All the code is available in the mercurial repository, in the net.sf.atomic34.example project.
In many of my projects I use Apache Ivy to resolve dependencies. If you don't know Ivy, it's a bit like Maven, but only the part about managing dependencies. Inside Eclipse, you can use the IvyDE project to integrate Eclipse with Ivy.
The steps to create a new project with Atomic34 are:
- Create a new Java Project in Eclipse
- Add an ivy.xml file with dependencies on joda-time, commons-beanutils, commons-codec and org.seleniumhq.selenium
- Create a package for your site definition, net.sf.atomic34.example.google in our demo
- Create a new source folder named "src-gen", which will hold the generated files
- You need to link dependencies for the project to work. I often use Apache Ivy for this (with IvyDE inside Eclipse), but you can use maven also. The dependencies are:
- org.seleniumhq.selenium / selenium-java (2.4.0+)
- com.google.guava / guava (r09)
- joda-time / joda-time (2.0)
- There is also a dependency on atomic34 definition library (not available on maven yet) that you can download on this site.
- In the package, create a file with the extension .a34 (google.a34)
- When asked to add XText nature to the project, answer yes.
- Enter some content in the a34 file (see google.a34)
- Upon saving, some code will be generated in the src-gen folder based on your definition
- Write a jUnit test based on the generated code.
To understand the writing of the a34 file -> [A34File]