Context

As a software developer, I write code (a lot !).

As a TDD addict and because I don’t want to ship s#!+, this code is always preceded by tests.

When working with the UI5 framework, the recommendation for testing is to use either QUnit or OPA.

These two frameworks are used to cover the three lower stacks of the test pyramid : unit, component and integration testing. This is usually the location where the testing is focused. Everything is already written down in the book Testing SAPUI5 Applications.

This article presents the point of view of the developer working on…


In this first article, we setup the runner by building a configurable platform that serves the web application and offers basic services.

Defining and configuring a job

To centralize the different parameters of the runner, a job object is defined with a list of properties.

const job = {
cwd: process.cwd(),
port: 0,
ui5: 'https://ui5.sap.com/1.87.0',
webapp: 'webapp',
logServer: false
}

Job definition with named parameters

The list of parameters will be changed while covering the different steps but we begin with :

  • cwd : the current working directory, it is initialized with the process current one
  • port : the port used to serve the application…

Image from https://www.flickr.com/photos/emsl/7658449002/

In this second article, we fetch the list of test pages by triggering a specific URL that references all the tests to execute. This requires the use of script substitution as well as offering an endpoint to receive the collected tests.

Declaring the tests

Most of the UI5 applications have a similar testing structure : the page called webapp/test/testsuite.qunit.html is the entry point. Its content declares the test pages contained in the project. It also includes the qunit-redirect module which bootstraps a web test runner provided by UI5.

One big projects, it is recommended to segregate the OPA tests pages…


In this third article, the runner is improved to enable the execution of the tests (qUnit and OPA). The web server is modified to inject hooking scripts and new endpoints are provided to receive the tests results. Also, a basic execution queue is implemented so that we can control the number of instances that are executed simultaneously.

QUnit hooks

The OPA framework is a layer on top of QUnit. Developped by John Resig, the QUnit framework was originally designed to test jQuery. In 2008, it became a standalone project and, since, it is widely used.

Because of its popularity, the library offers…


In this last article, we explain how nyc is used to instrument the sources and the runner is modified to handle code coverage. The web server switches between instrumented sources and the original ones (in case one does not want to measure the coverage of specific files). Because of the way OPA tests are designed (and the use of IFrames), the instrumented files are altered on the fly to update their scope. Once every individual coverage information is extracted, nyc is called again to merge the coverage and generate a report.

Fundamentals

Before jumping to the implementation details, I would like…


What do you do when you need HTML templates but you don’t want to include any heavy library or framework ? You experiment and write your own implementation… Welcome to a journey within DOM, regular expressions and function builders.

This article was initially published in 2016 under https://gpf-js.blogspot.com/2016/08/my-own-templates-implementation.html

The need

In the GPF-JS library, the source and test files are organized with the help of one special configuration file: sources.json. It is the vertebral column of the project as all the tools related to building, testing or even documenting are based on it.

Documentation generation relies on JSDoc and a grunt plugin


This article was initially published in 2017 under https://gpf-js.blogspot.com/2017/06/5-ways-to-make-http-request.html

The version 0.2.1 of the GPF-JS library delivers an HTTP request helper that can be used on all supported hosts. It was quite a challenge as it implied 5 different developments, here are the details.

The need for HTTP requests

In a world of interoperability, internet of things and microservices, the — almost 30 years old — HTTP protocol defines a communication foundation that is widely known and implemented.

Originally designed for human-to-machine communication, this protocol also supports machine-to-machine communication through standardized concepts and interfaces:


3 years ago, the release 0.2.2 of GPF-JS delivered a polymorphic modularization mechanism that mimics RequireJS and CommonJS implementation of NodeJS. It was surprisingly easy to make it happen on all supported hosts since the library offers the basic services. This API combines lots of technologies, here are the context and implementation details.

Release 0.2.2

The GPF-JS release 0.2.2 went out and it delivered several improvements:

  • Better code quality
  • Better documentation
  • Some tests were rewritten

But the exciting part of it is the new gpf.require namespace that exposes a modularization helper.

To give a bit of context, the article will start by…


With version 1.8.0, REserve offers the capture helper that enables the copy of the response content while processing a request. In this article, an example will be presented in two different flavors to illustrate the new possibilities introduced by this tool.

Caching the content of a site

Redirecting

First, let’s build a local web server with REserve that redirects received requests to an existing remote site thanks to the url handler. The source file is listed below.

A simple web server built with REserve

When opening the browser to localhost:8005, the content of http://facetheforce.today/ is displayed as shown in the following preview.


According to wikipedia, a particle accelerator is a machine that uses electromagnetic fields to propel charged particles to very high speed and energies. A collider accelerator causes them to collide head-on, creating observable results scientists can learn from.

(photo of CERN / LHC tunnel from Ars Electronica)

Sometimes, I feel like an idea collider producing experiments I can learn from.

The idea

I have millions of ideas: some are stupid (and it’s ok) and some may be interesting. Sadly, for most of them, time and resources are missing to shape and mature them properly. Somehow, we must choose our battles.

On rare…

Arnaud Buchholz

Passionate developer, always keen on finding new ways to do things, welcome to my thoughts.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store