Getting Started

Overview

jSpringBot allows you to easily create java based robot framework libraries. This also leverages the use of spring and maven for setup and dependency management. Spring lets you define your robot framework keywords as beans while maven lets you create your library and run your tests with ease since dependencies are fetched and managed automatically.

RobotFramework

Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD). It has easy-to-use tabular test data syntax and utilizes the keyword-driven testing approach. Its testing capabilities can be extended by test libraries implemented either with Python or Java, and users can create new keywords from existing ones using the same syntax that is used for creating test cases.

Objectives

Here are the jSpringBot goals and objectives.

  • Ease of use.
  • To have a pure java based library.
  • To have a rich library accessible to automation developers.
  • For simple creation of dynamic libraries integrated with Spring and Maven.
  • For created libraries, to easily integrate with other JSpringBot Libraries.
  • Seamless support for continuous integration.

Requirements

For jspringbot to work, you need to have jdk 1.6 or up and maven 3. Once you've set this up, you're good to go.

Libraries

The jspringbot provides a rich support for testing and automation.

  • Browser automation is supported using jspringbot Selenium Library.
  • Restful Services Testing is supported using Http, XML and JSON Libraries.
  • Database Validation is supported using DB Library.
  • Contains support to access values in properties file using Config Library.
  • Enables support to access and execute command on a remote machine over an SSH connection using SSHLibrary.
  • Contains support to parse and query a CSV string or resource using CSV Library.
  • Support for internationalization, using i18n Library.
  • Also comes with advance support for expressions across all libraries with Expression Library.
  • And other utility libraries, like Date Library, Test Data Library.

Examples

Each of the library provides sample projects you can start to work with. To download and execute these sample projects follow these instructions.

1 You can download the sample project by using git. You can also download using the Download ZIP button on each of the sample projects.

  git clone https://github.com/jspringbot/sample-http.git

2 After downloading you can execute using following maven command.

  sample-http$ mvn clean integration-test

3 After which, you can check the generated logs and reports.

Log:     --/sample-http/target/robotframework-reports/log.html
Report:  --/sample-http/target/robotframework-reports/report.html

Test Project

The jspringbot acceptance test project is a maven project that runs under mvn integration-test phase.

File Structure

The following shows the typical jspringbot project structure.

test-project/
  ├── src/
  │   └── test/
  │       ├── resources/
  │       │   ├── jspringbot.properties
  │       │   └── spring/
  │       │       └── jspringbot-global.xml
  │       └── robotframework/
  │           ├── acceptance/
  │           │   ├── test-suite1.robot
  │           │   └── test-suite2.robot
  │           └── custom-resources.robot
  └── pom.xml

Where:
    pom.xml - contains the dependencies, here you identify what jspringbot libraries you want to use.
    jspringbot.properties - identify jsprintbot library properties. This can change the library behavior.
    jspringbot-global.xml - all jspringbot libraries spring configuration will be imported in this file.
    robotframework - this folder contains our robotframework test suites and resources.

pom.xml

This is what most pom.xml in a jspringbot project would look like.

Also see jspringbot-base project for more details.

1 The code below identifies what jspringbot version you want to use.

  <parent>
    <groupId>org.jspringbot</groupId>
    <artifactId>jspringbot-base</artifactId>
    <version>1.5</version>
  </parent>

2 The code below ensures that the project runs under mvn integration-test phase.

  <build>
    <plugins>
      <plugin>
        <groupId>org.jspringbot</groupId>
        <artifactId>jspringbot-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>integration-test</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

3 The code below identifies what jspringbot libraries we will use. In the example, we wanted to use selenium and db libraries.

  <dependencies>
    <dependency>
      <groupId>org.jspringbot</groupId>
      <artifactId>jspringbot-selenium</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jspringbot</groupId>
      <artifactId>jspringbot-db</artifactId>
    </dependency>
  </dependencies>

jspringbot-global.xml

In this file you import all jspringbot library specific jspringbot spring configurations. The example below configured a selenium firefox and db jspringbot libraries.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd">

  <import resource="classpath:spring/spring-selenium-firefox.xml"/>
  <import resource="classpath:spring/spring-db.xml"/>
</beans>

Comments

comments powered by Disqus