User Guide
  • Introduction
  • Overview
    • About 4WS.Platform
      • Architecture
      • Enterprise Edition
      • Tech specs and requirements
      • Warp SDK
    • Creating a web application
  • Core features
    • Tables
    • SqlTool
    • Definition of Data models and Relations
      • Relations
      • Reverse Engineering
      • Custom Fields
    • Defining business components
      • What are business components
      • Business components to fill-in panels
      • Creating business components
        • By a datastore entity
        • By a MongoDB collection
      • Defining Custom Java Business component
    • Defining the UI
      • App Designer
        • App Designer Menu
        • Definition of additional data sources
        • Panel containers and layouts
          • Tab panel
          • Alternative panel
          • Accordion panel
          • Vertical orientation panel
          • Horizontal orientation panel
          • Columns panel
          • Table panel
          • Generic panel
          • Responsive panel
        • Window content
          • Grid Panel
          • Form Panel
          • Filter Panel
          • Tree Panel
          • Google Map Panel
          • Preview Panel (old Image panel)
          • Tree + Grid Panel
          • Image Gallery
        • Windows list
        • Panel definition
          • Columns properties
          • Controls properties
          • Filter properties
          • Supported components
        • Variables
        • Code selectors
          • When not to use a dynamic combo-box
        • Smart Filter and Advanced Filter
        • Multi Value Combobox Filter
        • Multi Value Tree Filter
        • Buttons
        • Translations
          • Translations about GUI components and internationalization settings
          • Data coming from database
          • Custom code and translations
        • Application Menu
        • Bulk import binded to a grid
        • Range Date Filter
      • Web Interpreter
        • Grid components
        • Detail forms
        • Other components
        • Other features
          • Chat
        • Global variables
          • Client-side global variables
          • Server global variables
        • Forgot Password
    • Working with users and roles
      • Rule for roles
      • Permissions Administrator
    • Wizard
      • How to add a checkbox grid to select one or more rows
      • How to load a second grid when clicking on a row from the first grid
      • How to load a form when clicking on a row of the grid
      • How to open a window when double clicking on a row of the grid
      • How to open a window with right click on the popup menu
      • How to open a window when pressing a button on the grid toolbar
      • How to load a grid after loading a form
      • How to open a window when pressing a button on the form toolbar
      • How to load a grid when clicking on a tree node
      • How to load a form when clicking on a tree node
    • Defining events
      • Panel events
      • Column events
      • Control events
      • Filter events
      • Timer events
      • Start-End event
    • Server-side Javascript & Web Service
      • Server-side Javascript
      • Grid component filled by a server-side JS
      • Detail component filled by a server-side JS
      • How to define a server-side JavaScript action
      • Web service
  • Setting up the environment
    • How to install
    • Application parameters
    • Global parameters
  • Modules
    • Reports & Charts
      • Jasper Report + iReport
      • Online report
      • Docx templating
      • Charts
      • Pivot Grid
      • Multidimensional pivot grid
      • Data Export from SQL query
    • SSO
      • Identity management in Platform
        • Identity management on the internal Platform database
        • Identity management based on Google SSO
      • LDAP
        • LDAP support
        • Identity management based on LDAP and database
        • Identity management based on an embedded LDAP server used by Alfresco and or Activiti
        • Identity management based on a remote LDAP server to connect to Platform on the cloud
        • Connecting an LDAP server to Activiti BPM
        • Connecting an LDAP server to Alfresco ECM
      • Google SSO
        • Google SSO
        • Google OAuth2
        • Identity management based on Google SSO
      • Custom SSO
      • Firebase
    • Mobile
      • Mobile introduction
      • Offline vs Online
        • Server side features
        • Server side functionalities
        • Server side Platform features
        • Mobile app features
      • Mobile side specifics
        • Customizations
          • Custom theme editor
        • App Menu
        • Window content
          • Detail scrollable form
          • Scrollable paginated grid
          • Constraint layout
          • Constraint panel
          • Collection grid view
          • Preview panel (mobile)
        • Form Controls
      • Reference guide
      • Cleaning up data
      • How to
      • App deployment
        • App deployment for the iOS platform
        • App deployment for the Android platform
      • Style properties
      • Appendix : Synchronization flow
      • Translations
    • GSuite
      • Introduction
      • Client-side integration
      • GMail
      • Calendar
      • Drive
      • Contacts
    • Google Cloud Platform
      • Datastore
        • Google Datastore Introduction
        • How to create Datastore entities
      • Google Cloud Storage
    • Scheduler
      • Scheduler Introduction
      • Process settings
        • How to define a sequence of consecutive processes
        • How to define a Custom Java Business component
        • How to define a Grid Data Import
        • How to define a server-side Javascript action
      • Email notifications
      • Process executions
      • Manually start a scheduled process
      • Process input parameters
    • Queue Manager
    • Log & Analysis
      • Application Log
      • Log statistics
      • App analyzer
      • Table log
      • Threads
      • Sessions and heap memory
      • Heap memory analysis
      • Access Log
      • Datastore statistics
      • Total monthly costs with Google Datastore
      • Service Monitoring
        • Introduction
        • Defining a service to monitor
        • Notifications setup
        • Events automatically managed by Platform
        • Remote Platform servers
        • Knowledge base
        • Adding log programatically
        • Searching for logged data
        • Use cases
    • File Management
    • Export and Import of Metadata
      • Application Metadata Management
    • Trigger writing operations
    • Audit
    • BPM
      • BPMN Introduction
      • BPMN main parts
      • Activiti Setup
      • Platform integration
        • Processes
        • Models
        • Process instances
        • To-do list
        • Process history
      • Process Web Modeler
        • Model Creation
          • Start-End Event
          • Gateways
        • Supported objects
        • Start tasks and user tasks
        • Form properties
          • Important notes
          • Property types
        • Service tasks
          • Web service
          • SQL Query
          • SQL statement
        • Mail task
        • Script task
          • Example : how to get a value previously read from a SQL query
          • Example : how to get the current process instance id
        • Timer events
        • Subprocess and Call Activiti
      • Utility methods available in Platform
        • How to start a process from a JavaScript action
        • How to complete a user task from a JavaScript action
      • An example
        • Processes
        • Instances
        • Activities
        • History
    • Embedded CMS
    • ECM
      • Alfresco
        • Alfresco Introduction
        • Integration between 4WS.Platform and Alfresco
          • Integration at GUI level
          • Integration at model level
          • Integration at authentication and authorizations level
          • Additional features
        • How to use 4WS.Platform and Alfresco together
          • Set the same Identity Management system
          • Define document types and aspects in Alfresco
          • Import the document types and aspects definitions in 4WS.Platform
          • Define document types and aspects in 4WS.Platform
          • Reverse engineering of document types or aspects
          • Definition of business components to fill-in panels
          • Definition of the GUI
          • Additional server-side services
        • Requirements
        • Current limits in 4WS.Platform - Alfresco integration
      • Archiflow
        • Setup
        • Archiflow artifacts
        • How to
    • Lotus Notes Migration Tool
    • NoSQL databases
      • MongoDB
        • MongoDB Introduction
        • Setting up the environment
        • How to create collections
        • How to create business components
        • How to create windows filled with data coming from MongoDB collections
        • Design rules
      • Google Datastore
        • Google Datastore Introduction
        • Setting up the environment
        • How to create entities
        • How to create business components
        • How to create windows filled with data coming from Datastore entities
        • Design rules
    • TensorFlow
    • Web Page Development
      • Pure Web Page Development
      • Google Material Design development
      • Appendix A - a complete example without any lib
      • Appendix B - a complete example with Google MD
    • Jira Integration
    • Platform for GAE
    • SQL errors management
    • Multidimensional pivot grid
    • Quality
      • Automated Web Service Testing
      • Automated unit testing
      • Source code static analysis using ESlint
      • Source code static analysis using SonarQube
  • Troubleshootings
  • Best practises
    • Database design
    • Database maintenance
    • Creating a Web app : common use cases
    • Creating a mobile app : common use cases
Powered by GitBook
On this page
  • How to create a Test Case manually
  • Duplicating a Test Case
  • Changing a Test Case name
  • Bulk import of Test Cases
  • Editing the Test Case
  • How to execute a Test Case
  • How to create a Test Case from an action

Was this helpful?

  1. Modules
  2. Quality

Automated Web Service Testing

Platform allows to quickly create a large portion of your application, using the wizards it provides. Thanks to them, the generated part of application is likely to work perfectly, unless your business logic (SQL layer) has been defined wrongly.

Apart from that, there is another layer which can be considered critical from a quality point of view: server-side custom logic, written using javascript.

This part should be limited as possible but most of applications include a small part which is so custom that can be realized only using a programming language, which is Javascript in case of Platform.

You can create as many server-side javascript actions as you want. These actions represent a web service layer which can be invoked either by your web GUI, a mobile App or an external application.

In any case, the problem involved with this source code is that it should be tested.

Platform provides a module to quickly create Test Cases, i.e. HTTP requests you can use to invoke to call and test your web services (your server-side actions). It also allows to define testing conditions, in order to check out whether the response of the web service is the one expected.

This feature allows you to define:

  • HTTP method

  • HTTP request URL

  • query parameters (i.e. parameters included in the URL, after the ?)

  • header parameters

  • BODY content

As well as testing conditions on the response of the web service invokation.

Outcomes are also automatically saved in Platform Table Log feature, so that you can monitor the progress of the test results over time and collect an history of these executions.

How to create a Test Case manually

This feature can be accessed through the App Designer menubar: Services -> Automated Tests

You can create as many Test Cases as you want. They are reported in the list on the left, filtered by collection. On top of this list there is a combo-box you can use to filter Tests Cases by collection. If not specified, all Tests Cases are reported.

The main part of the window is about the detail of the selected Test Case.

You can create a new Test Case by pressing the New button on top of the list.

Here you have to specify:

  • a name for the Test Case (mandatory)

  • a collection it belongs to (mandatory); this editable combo-box allows you to choose an already existing collection or simply digit it for the first time

  • the HTTP request (mandatory), in terms of HTTP method and URL; here you can specify any number of variables, always expressed as

  • an optional action (web service), used to link many Test Cases to the same action; this setting does not have any real usage, expect for grouping many Test Cases to a specific action

  • an optional action (a server-side javascript action) to invoke just before testing the current one; helpful to setup all data needed to run repeatable tests

  • an optional action (a server-side javascript action) whose content must be appended at the beginning of the verifying code executed at the end of the test; this javascript code represent base code to include in multiple tests, sharing the same verifying logic

  • an optional automated test to invoke just before testing the current one; helpful in scenarios where there are tests connected to each other, like when there is a test for the login and another which uses the authentication token retrieved by the login test.

Once pressed the OK button, the Test Cases has been created and added to the list. At this point, it is possible to specify additional details for the test, for example: request parameters, headers, body content, tests to execute on the response.

Duplicating a Test Case

Since a Test Case definition can be time consuming, a Duplicate button is provided too, in order to speed up the definition of new Test Cases, when these are similar with each other. When pressing this button, a dialog is prompted to the user, in order to specify the new name for the Test Case, as well as additional info.

Changing a Test Case name

In case there is the need for changing the Test Case name, you can double click a row and then rename the Test Case name

Bulk import of Test Cases

One of the best products for testing web services is PostMan.

Platform provides an Import button you can use to import a JSON file, expressed in PostMan format, representing the export of a Collection of Test Cases defined in PostMan. Thanks to this button, you can quickly migrate from a costly PostMan to Platform and reuse all your Test Cases.

Supported Postman features are:

  • Collection name

  • Test case name

  • HTTP method and URL

  • request headers and query parameters

  • body content

  • one test script "after response", with a partial conversion of the Js Post API, for the most common scenarios

Editing the Test Case

Once created a new Test Case, the main panel of the window can be used to define the Test Case details. These details are organized in 4 folders:

  • Parameters

  • Headers

  • Body

  • Tests

Parameters and Headers contain a free grid composed of parameter name and value: you can define any parameter. The value can includes variables, expressed as .

That means the request can send dynamic data, whose content can be defined at runtime, and inherits values coming form previous requests: you could define a login request, where the Tests folder is used to save a token and then pass forward the token value to the next request.

Special variables are which gets back the current digest value for a mobile app and which gets back the current application version for a mobile app.

Body can only be expressed for text content.

Tests can contain javascript instructions, used for 2 purposes:

  • testing expected values, like a response containing an attribute whose value is true

  • saving the response content or part of it and reuse it in the next requests.

You can specify variables expressed as both in request parameters, request headers and body content. Predefined variables that do not require to be specified in Environment are: COMPANY_ID, SITE_ID, APPLICATION_ID, APP_VERSION, USERNAME, DAY, DOW, MONTH, TODAY, NOW, UUID, RANDOM, RANDOM10, RANDOM100, RANDOM1000, COUNTER

Moreover, a top-bar is included, in order to quickly change the URL and a series of buttons:

  • Send - when pressed, the request is executed and the Body folder is automatically shown, so that the response can be reported in the bottom area; a colored panel is also included in order to check out the outcome of the request: green for an OK request, red for NO OK.

  • Save - when pressed, the main area is saved, i.e. URL and all 4 folders content

  • Environment - this is a cross test case feature, used to define variables which can be referred through variables in the folders described above. Platform is able to recognize special variable names and auto-set a value for them, when losing focus on the variable name. Recognized variables are: companyId, siteId, username, languageId, applicationId

How to execute a Test Case

As reported above, the Send button can be used to execute the Test Case.

When pressing it, the request is executed and when it ends, the response is reported on the bottom.

In case of a request successfully executed, a green box is shown on the top, otherwise, the same box is red colored.

After the execution of each request, the corresponding Test script is automatically executed, if specified in the Tests folder: if it contains instructions like

utils.addCustomApplUserPar(name,value)

that value is stored in the current user session and can be referred in any subsequent request, through reference.

How to create a Test Case from an action

Another way to create a Test Case is starting from a server-side action:

  • click on the Execute server-side action button, on the bottom right part of the window

  • click on the Generate Test button, which will ask for retrieving the input parameters/headers/body

  • after confirming this dialog, another window is prompted.

The Generate Test window allows to specify the required information for creating a Test Case:

  • a Test Case name

  • a Collection the Test Case belongs to, through an editable combo-box

  • which kind of Test Case will be created, among 3 alternatives

PreviousQualityNextAutomated unit testing

Last updated 2 years ago

Was this helpful?