Giter Club home page Giter Club logo

rest-assured-authentication's Introduction

rest-assured-authentication

This project shows how to do login authentication with restAssured for Web Services Testing.

Sample Test Application

I have used https://github.com/jmeterbyexample/digital-toys-web-application project for doing testing the authentication mechanism via restAssured.

Clone this sample application somewhere in your machine and follow below instructions to run web application.

Starting Web Application

###Windows

C:\> set SESSION_IN_URL=true
C:\> startDt.bat
2016-12-02 22:02:37.384:INFO::main: Logging initialized @445ms
2016-12-02 22:02:37.405:INFO:oejr.Runner:main: Runner
2016-12-02 22:02:37.755:INFO:oejs.Server:main: jetty-9.3.7.v20160115
2016-12-02 22:02:53.593:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
SESSION_IN_URL specified in environment - enabling session in URL if cookies are not enabled.
2016-12-02 22:02:55.096:INFO:/:main: Initializing Spring root WebApplicationContext
SESSION_IN_URL specified in environment - enabling session in URL if cookies are not enabled.
Populating products
2016-12-02 22:03:16.034:INFO:/:main: Initializing Spring FrameworkServlet 'grails'
2016-12-02 22:03:17.265:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@707f7052{/,file:///C:/Users/msys/A
ppData/Local/Temp/jetty-0.0.0.0-8080-dt-1.0.war-_-any-1135464954042676645.dir/webapp/,AVAILABLE}{..}
2016-12-02 22:03:17.337:INFO:oejs.ServerConnector:main: Started ServerConnector@1af6974c{HTTP/1.1,[http/1.1]}{0.0.0.0:80
80}
2016-12-02 22:03:17.339:INFO:oejs.Server:main: Started @40405ms

###Linux/MacOS

$ export SESSION_IN_URL=true
$ startDt.sh
2016-12-02 22:06:40.069:INFO::main: Logging initialized @406ms
2016-12-02 22:06:40.088:INFO:oejr.Runner:main: Runner
2016-12-02 22:06:40.388:INFO:oejs.Server:main: jetty-9.3.7.v20160115
2016-12-02 22:06:56.158:INFO:/:main: No Spring WebApplicationInitializer types detected on classpath
SESSION_IN_URL specified in environment - enabling session in URL if cookies are not enabled.
2016-12-02 22:06:57.409:INFO:/:main: Initializing Spring root WebApplicationContext
SESSION_IN_URL specified in environment - enabling session in URL if cookies are not enabled.
Populating products
2016-12-02 22:07:16.593:INFO:/:main: Initializing Spring FrameworkServlet 'grails'
2016-12-02 22:07:17.674:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@707f7052{/,file:///C:/cygwin64/tmp/jetty-0.0.0.0-8080-dt-1.0.war-_-any-7531697417074887308.dir/webapp/,AVAILABLE}{..}
2016-12-02 22:07:17.730:INFO:oejs.ServerConnector:main: Started ServerConnector@6d035815{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2016-12-02 22:07:17.731:INFO:oejs.Server:main: Started @38071ms

Login to Digital Toys Web Application

username: [email protected]
login: user1

Running Test

After starting web application, come back to this project and execute:

mvn clean test

You will see that JSESSIONID will be printed on console. You can use this JSESSION ID and hit further REST APIs which required authentication.

rest-assured-authentication's People

Contributors

jagdeepjain avatar

Watchers

James Cloos avatar

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.