Skip to Content
Author's profile photo Steffen Froehlich

Introducing ProjectX – an open source tool for HTTP API exploration and testing built with OpenUI5

pX_overview.png

Content

  • Features
  • Download
  • Intro scenario based on ES4 Gateway service
    • Set up a new project
    • Get Service Document
    • Get Metadata with Gateway statistics
    • Read products entityset from service
    • Read a specific product ID
    • Create a new product
  • Contact

Features

  • Create HTTP requests to explore and test your HTTP API
  • Sources on Github (feel free to create a pull request)
  • Built with OpenUI5
  • Fetches CSRF-Token and automatically sets it in the header of a request (e.g. for OData post requests)
  • Run multiple request in sequences to test full CRUD scenarios
  • Assertions on HTTP header and body response to automatically validate the result of a request
  • Pre- and Post-scripts to modify almost everything with Javascript code
  • SAP Gateway statistic checks and evaluation
  • Export single request or all your projects to share them easily with your team members
  • Use projects and grouping to organize your requests
  • Support for Batch requests
  • Quickly create requests based on OData metadata
  • Run it as native Windows/Mac OS application or deploy it to your own webserver (e.g. SAP Gateway)

Download

Sources: GitHub – pensoffsky/projectX: OData Testing Tool

Download latest release for Windows and Mac: Releases · pensoffsky/projectX · GitHub

Intro scenario based on ES4 Gateway service

The ES4 Gateway service is used to give you an introduction to this OData testing tool and its capabilities.

In order to play around with ES4 Gateway service, please register first on the demo system. A detailed documentation can be found here: Sign up and get started with the SAP Gateway – Demo Consumption System

Set up a new project

  • Click on the ‘Add’ button with the plus sign

pX_add_project.png

  • Enter project details
    • Project Name
    • Prefix URL – Endpoint of ES4 Gateway service
    • CSRF token URL – here you have the possibility to enter a different URL to fetch CSRF tokens, other than your service endpoint URL
    • activate basic authentication switch for ES4 Gateway server
    • Username – user of ES4 server
    • Password

pX_project_details.png

Get Service Document

  • Enter the whole service URL into the URL input and provide a name
    • Quick tip: switch ‘Use Prefix Url’ on and off the put it into the URL input control
  • You can provide a Group name to group various requests in the request list on the left side

pX_request_details_get.png

  • Click on ‘Send’ button (Keyboard shortcut: F7)
  • After that the response body is displayed
  • It’s possible to change the output rendering to XML, JSON, HTML or plain RAW output format

pX_request_details_get_response.png

  • Congratulations, your first request is live and can be extended with assertions and test

Get Metadata with Gateway statistics

  • You can enter another request for receiving Metadata document. It can be copied from Service Document request in the master list via the copy icon, therefor the group name is already set.
  • This time enter in the URL only ‘$metadata’ and activate the switch for using Prefix URL, though you have more space in the URL input and it’s more readable.

pX_metadata_details.png

  • Add request header for ‘sap-statistics’ and set the value to ‘true’
    • Quick tip: use Add common headers

pX_request_header_statistics.png

  • After sending this request, you’ll see sap-statistics HTTP header in response header with its timing information
    • Since metadata is cached in Gateway-Hub you’ll see no timing data for app, gwrfcoh, gwapp nor gwnongw

pX_statistics_response.png

Read products entityset from service

After the metadata is fetched, you can dig deeper into your service and read an entityset:

  • Copy metadata request from master list via the Copy-Button on the right

    pX_copy_metadata.png

  • Adjust URL to ProductSet
  • Adjust request name and group at will
  • Click on Send button (keyboard shortcut F7)

pX_products_payload.png

In the received payload body you’ll see all products from this entityset. Let’s move on and read a single product, in this case the product ID ‘HT-1000’.

Read a specific product ID

  • Copy the request from last step, add (‘HT-1000’) at the end of the URL and adjust name and group. The result could look like this:

    pX_get_HT-1000.png

  • Click on Send button
  • Check the response body

Create a new product

Now let’s raise the bar a little bit and create a new product via the ES4 Gateway service.

  • Create new request via the Add button in the master list on top
  • Set HTTP method to POST
  • Set URL to ProductSet
  • Adjust name and group at will

    pX_newProduct_PX-1234_01.png

  • Go to tab Authorization and switch option Fetch CSRF Token to ON
    If the CSRF URL is empty, you can set it up in the project settings.

    pX_newProduct_PX-1234_02.png

  • Go to Request Headers tab and use Add common headers button to add Post Content-Type: JSON

    pX_newProduct_PX-1234_03.png

  • Go to Payload tab and insert the following lines:

{
    "ProductID": "PX-1234",
    "TypeCode": "PR",
    "Category": "Notebooks",
    "Name": "Mac Book Pro 15",
    "NameLanguage": "EN",
    "Description": "Mac Book Pro 15“ 2,7 GHz Intel Core i7, 16GB 1600 MHz DDR3",
    "DescriptionLanguage": "EN",
    "SupplierID": "0100000001",
    "SupplierName": "Apple",
    "TaxTarifCode": 1,
    "MeasureUnit": "EA",
    "WeightMeasure": "2.200",
    "WeightUnit": "KG",
    "CurrencyCode": "EUR",
    "Price": "2200.00",
    "Width": "30.000",
    "Depth": "18.000",
    "Height": "3.000",
    "DimUnit": "CM"
}


  • The result should look like this:

    pX_newProduct_PX-1234_04.png

  • After sending this request the receiving payload is the following, the product is created and can be retrieve with a GET request again.

    pX_newProduct_PX-1234_05.png


Contact


This software is open source, please don’t hesitate to ask questions, create issues, fork it and send us pull requests. Feedback is always welcome.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      We can use Chrome Inspector or Firefox right, what is the purpose of this tool over Inspector or firebug.. etc