Several days ago I was asked to complete one technical challenge task.
Task description is to prepare automation for set of settings for e-mail processing.
In details you should automate processing of the following:
In this article I would not like to go deeper into tests. I would like to share several steps how I configure my project in Eclipse
Folder structure in the project |
You may download required Selenium drivers from this repository
3) Next step is to add required list of libraries into the project:
Added user-libraries in the project |
4) After that I added file 'HomePage.java' under the 'test.java.junit.pages' package. This file contains class 'HomePage', that extends the 'Page Object' class. Also I've added 'DemoSettings.java' file under the 'test.java' package and allocated special variables in class 'DemoSettings' with defult url.
5) Next step is to add class with user steps. This class should extends the 'ScenarioSteps' class:
Initial class with user steps |
6) On the next step I've added step that will open the home page and prepare the story file for the launch, that locates under 'test.resources.stories.homepage' package:
Open home page story file |
7) Next stage is to added required class for handling the home page. So, I've created required file 'OpenHomePageTests.java' with class 'OpenHomePageTests' into package 'test.java.junit'. After adding it is required to attach the @RunWith (Serenity blog, JUnit) attribute to the class:
OpenHomePageTests class |
8) Resolve errors by adding required import statements and adding JUnit library to reference.
9) Create instance of the WebDriver (as a result you will added two additional import statements into the project):
Instance of the WebDriver |
10) Add special variables to have access to user steps:
Variable to handle user steps |
11) After that we can added our first step that just open the home page. Name of the test should be the same like name of scenario from the story:
Adding test that just open the home page |
12) If we launch current project as JUnit test we will receive due to class loading. So to avoid problems with any dependencies let convert the project to Maven project:
Create new POM description for Maven |
13) After converting to POM we no need libraries for both Selenium and Serenity that was created earlier. All dependencies will be downloaded by Maven. Example of the user's dependencies tab is the following:
POM file. Dependency tab. |
14) To avoid of additional errors following dependency has been added:
Additional dependency |
15) Used version of dependencies:
Versions of dependencies |
16) We should added required information about Maven Compiler Plugin to avoid errors during the 'mvn install' operation. As well as several plugins that was pointed in Serenity documentation: http://thucydides.info/docs/serenity-staging/
No comments:
Post a Comment