Robot framework Sample with Selenium
Create Maven Project in Eclipse
- Open pom.xml
- Add the robotframework-maven-plugin
<plugins>
<plugin>
<groupId>com.googlecode.robotframework-maven-plugin</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<version>1.1.2</version>
<configuration>
<extraPathDirectories>
<extraPathDirectory>src/test/resources/robotframework/libraries</extraPathDirectory>
</extraPathDirectories>
</configuration>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
- Add the maven dependencies
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Setting Selinium Library
- Download the Library from here
- Create Library Location
- Create new folder Libraries inside the src/test/robotframework
- Copy the Library
- Copy the SeleniumLibrary folder inside robotframework-seleniumlibrary/src. Then paste to the src/test/robotframework/Libraries.
implementing Test Case
- Add the Test Suit txt file
- Create new folder named tests inside src/test/robotframework. The add text file KeywordSuit.txt.
- Then add the following code to the KeywordSuit.txt.
- Declare the Settings
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${browser} *firefox
${google_url} http://www.google.lk/
*** Test Cases ***
Open Browser To Google Page
Open Browser ${google_url} ${browser}
Title Should Be Google
Run the Test Case
- Execute Maven goal integration-test
- Solution will run and give the output
- report file will be in target\robotframework directory
Add Comment
Comments (1)
This is sample test