Code Monkey home page Code Monkey logo

test-automation-quickstart's Introduction

test-automation-quickstart

Java quickstart project for test automation, covering performance, UI acceptance, API acceptance testing and security testing. Created with lessons learned from a large number of development projects to provide all commonly required components and concepts. The framework was first introduced on the OpenCredo.com Blog.

Concepts Included

  • Parallel test runs
  • Shared state across cucumber step definitions
  • Dependency injection
  • Page Object pattern
  • Common web page interaction methods
  • Common api interaction methods
  • Mavenised performance tests
  • Externalised test configuration
  • Commonly used test utility classes
  • Simple security tests

Tools

  • Maven
  • Cucumber-JVM
  • JUnit
  • Spring
  • Selenium Webdriver
  • Jackson
  • JMeter
  • OWASP Zed Attack Proxy

Requirements

In order to utilise this project you need to have the following installed locally:

  • Maven 3
  • Chrome and Chromedriver (UI tests use Chrome by default, can be changed in config)
  • Java 1.8
  • ZAP 2.7.0 (Run it in deamon mode using the following command: ./zap.sh -daemon -port 8888 -config api.disablekey=true)

In order for the api tests to pass, you will need to configure your test email. You may need to set up a testing email account (free ones can be made on gmail.com). Then you can either edit it in the API properties file, or supplied as maven parameters. E.g.

mvn install -Papi-acceptance-tests -Dapi.acceptance.test.email.address=MY_EMAIL_ADDRESS -Dapi.acceptance.test.email.password=MY_EMAIL_PASSWORD

Usage

The project is broken into separate modules for API, UI, Performance and Security testing. Each of these modules can be utilised independently of the others using maven profiles.

To run all modules, navigate to test-automation-quickstart directory and run:

mvn clean install

To run UI acceptance tests only, navigate to test-automation-quickstart directory and run:

mvn clean install -Pui-acceptance-tests

To run API acceptance tests only, navigate to test-automation-quickstart directory and run:

mvn clean install -Papi-acceptance-tests

To run performance tests only, navigate to test-automation-quickstart directory and run:

mvn clean install -Pperformance-tests

To run security tests only, navigate to test-automation-quickstart directory and run:

mvn clean install -Psecurity-acceptance-tests

Reporting

Reports for each module are written into their respective /target directories after a successful run.

UI acceptance tests result in a HTML report for each feature in test-automation-quickstart/ui-acceptance-tests/target/cucumber-parallel/. In the case of test failures, a screen-shot of the UI at the point of failure is embedded into the report.

API acceptance tests result in a HTML report for each feature in test-automation-quickstart/api-acceptance-tests/target/cucumber-parallel/.

Performance tests result in a .jtl results file and .png graphs showing response times and transactions per second, generated in test-automation-quickstart/performance-tests/target/jmeter/results.

Security acceptance tests result in a HTML report for each feature in test-automation-quickstart/security-acceptance-tests/target/cucumber-parallel/. They will also generate a security risks HTML report in test-automation-quickstart/security-acceptance-tests/security-reports/security-report.html.

NOTE: As mentioned, cucumber reports are written to a separate file for each feature. This occurs as a result of running tests in parallel, meaning that you do not get a single unified test report. If using CI, these individual reports can be joined using plugins such as the Jenkins Cucumber-JVM-Reports plugin.

For an alternative approach to combining the cucumber reports, see the parallel testing blog post on OpenCredo.com.

test-automation-quickstart's People

Contributors

burythehammer avatar carloslindo avatar mcalthrop avatar night0wl avatar pdiazmon avatar tristanmccarthy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

test-automation-quickstart's Issues

Parallel feature is not working

I downloaded examples and modified steps to print current thread name to console.
When I launch tests using Maven I see output for one thread only.
I tried Java 6, 7 and 8 and Maven 3.0.x, 3.1.x, 3.2.x and 3.3.x.
Please check if your examples are still working.

Branch selenium-grid

Selenium grid is not working using Firefox. I am using Selenium Plugin in Jenkins which uses Grid v.3.1.0. I guess we have to upgrade selenium version 3.x.x. If we do it the SharedDriver class requires some refactoring.

Executing Feature file under one package

Hi, is there a way to execute one feature file from ui-acceptance-tests by tag? just one dedicated scenario
I tried as mvn test -.tags=@TagName, but getting
None of the features at [location] mathes the filters: [@TagName], but feature file exists with that tag

mvn clean install -Pui-acceptance-tests not running any test

Hi,
I've cloned the repo and wanted to run ui-acceptance-tests to check cucumber-jvm-parallel-plugin

I executed command mvn clean install -Pui-acceptance-tests

none of the test cases were run, console output as below

vikram-anna-pro:test-automation-quickstart vikram-anna$ mvn clean install -Pui-acceptance-tests
[INFO] Scanning for projects...  test-automation-quickstart
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] com.opencredo.test.automation.quickstart:test-automation-reactor
[INFO] acceptance-tests-common
[INFO] ui-acceptance-tests
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building com.opencredo.test.automation.quickstart:test-automation-reactor 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test-automation-quickstart ---
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @test-automation-quickstart ---
[INFO] Installing /Users/vikram-anna/Documents/test-automation-quickstart/pom.xml to /Users/vikram-anna/.m2/repository/com/opencredo/test/test-automation-quickstart/0.1.0-SNAPSHOT/test-automation-quickstart-0.1.0-SNAPSHOT.pom
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building acceptance-tests-common 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ acceptance-tests-common ---
[INFO] Deleting /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ acceptance-tests-common ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ acceptance-tests-common ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/target/classes
[WARNING] /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/src/main/java/com/opencredo/test/utils/RandomUtils.java:[3,46] sun.reflect.generics.reflectiveObjects.NotImplementedException is internal proprietary API and may be removed in a future release
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ acceptance-tests-common ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ acceptance-tests-common ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ acceptance-tests-common ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ acceptance-tests-common ---
[INFO] Building jar: /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/target/acceptance-tests-common-0.1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ acceptance-tests-common ---
[INFO] Installing /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/target/acceptance-tests-common-0.1.0-SNAPSHOT.jar to /Users/vikram-anna/.m2/repository/com/opencredo/test/acceptance-tests-common/0.1.0-SNAPSHOT/acceptance-tests-common-0.1.0-SNAPSHOT.jar
[INFO] Installing /Users/vikram-anna/Documents/test-automation-quickstart/acceptance-tests-common/pom.xml to /Users/vikram-anna/.m2/repository/com/opencredo/test/acceptance-tests-common/0.1.0-SNAPSHOT/acceptance-tests-common-0.1.0-SNAPSHOT.pom
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building ui-acceptance-tests 0.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ui-acceptance-tests ---
[INFO] Deleting /Users/vikram-anna/Documents/test-automation-quickstart/ui-acceptance-tests/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ui-acceptance-tests ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/vikram-anna/Documents/test-automation-quickstart/ui-acceptance-tests/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ ui-acceptance-tests ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ui-acceptance-tests ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ ui-acceptance-tests ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 10 source files to /Users/vikram-anna/Documents/test-automation-quickstart/ui-acceptance-tests/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ ui-acceptance-tests ---

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ui-acceptance-tests ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/vikram-anna/Documents/test-automation-quickstart/ui-acceptance-tests/target/ui-acceptance-tests-0.1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (acceptance-test) @ ui-acceptance-tests ---
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ ui-acceptance-tests ---
[INFO] Installing /Users/vikram-anna/Documents/test-automation-quickstart/ui-acceptance-tests/target/ui-acceptance-tests-0.1.0-SNAPSHOT.jar to /Users/vikram-anna/.m2/repository/com/opencredo/test/ui-acceptance-tests/0.1.0-SNAPSHOT/ui-acceptance-tests-0.1.0-SNAPSHOT.jar
[INFO] Installing /Users/vikram-anna/Documents/test-automation-quickstart/ui-acceptance-tests/pom.xml to /Users/vikram-anna/.m2/repository/com/opencredo/test/ui-acceptance-tests/0.1.0-SNAPSHOT/ui-acceptance-tests-0.1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] com.opencredo.test.automation.quickstart:test-automation-reactor SUCCESS [  0.227 s]
[INFO] acceptance-tests-common ............................ SUCCESS [  1.129 s]
[INFO] ui-acceptance-tests ................................ SUCCESS [  1.223 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.680 s
[INFO] Finished at: 2017-08-01T17:58:11+02:00
[INFO] Final Memory: 25M/305M
[INFO] ------------------------------------------------------------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.