Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
* Formatting, typos, TOC's, cleanup, ...
Browse files Browse the repository at this point in the history
* added CI/CD instructions
  • Loading branch information
Sebastien Dupont committed Jun 3, 2020
1 parent aa791ec commit 0f3df92
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 36 deletions.
14 changes: 14 additions & 0 deletions .gitlab-ci.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ stages:
- tf_plan
- tf_apply
- deployWithHelm
- test

variables:
KUBECONFIG: /etc/deploy/config
Expand Down Expand Up @@ -132,3 +133,16 @@ deployWithHelm:
url: http://$PROJECT
only:
- master

test:
stage: test
image: fzalila/docker-puppeteer-jest
script:
- ls
- cd tests/
- pwd
- npm run test
tags:
- docker
only:
- develop
1 change: 1 addition & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FADI Documentation
* [Users management](USERMANAGEMENT.md) - user identification and authorization (LDAP, RBAC, ...)
* [Reverse proxy](REVERSEPROXY.md) - Traefik reverse proxy configuration
* [Security](SECURITY.md) - SSL setup
* [Testing](/tests/README.md) - tests for the FADI framework
* [TSimulus](TSIMULUS.md) - how to simulate sensors and generate realistic data with [TSimulus](https://github.com/cetic/TSimulus)
* [Sample self-hosted infrastructure](RANCHER_PROXMOX.md) - How to install FADI on a self hosted infrastructure using
* [Proxmox](https://www.proxmox.com/en/) as a self-hosted private cloud (IaaS) provider. It provides virtual machines for the various Kubernetes nodes.
Expand Down
5 changes: 0 additions & 5 deletions tests/.vscode/settings.json

This file was deleted.

86 changes: 64 additions & 22 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,54 @@
# Testing FADI platform
<img src="https://miro.medium.com/max/1788/1*wby6AkTf3SggijT3GSTu4w.png" height="100" align="right">
# Testing the FADI framework

<img src="https://miro.medium.com/max/1788/1*wby6AkTf3SggijT3GSTu4w.png" height="100" align="right" alt="Jest Puppeteer">

[![implemented with puppeteer](https://img.shields.io/badge/implemented%20with-puppeteer-%2300D8A2)](https://pptr.dev) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)

* [Introduction](#introduction)
* [Quick start](#quick-start)
* [Example](#example)
* [Documentation](#documentation)
* [References](#references)

## Introduction

FADI platform is tested using Puppeteer and Jest.
The FADI framework is tested using Puppeteer and Jest.

[Puppeteer](https://pptr.dev) is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default, but can be configured to run full (non-headless) Chrome or Chromium.

[Jest](https://jestjs.io) is a delightful JavaScript Testing Framework with a focus on simplicity. It works with projects using: Babel, TypeScript, Node, React, Angular, Vue and more!
[Jest](https://jestjs.io) is a JavaScript Testing Framework with a focus on simplicity. It works with projects using: Babel, TypeScript, Node, React, Angular, Vue and more!

## Quick start

To test fadi platform, you need to implement the following instructions:
To test the FADI framework, you need to implement the following instructions:

1. Install FADI framework. Refer to [the INSTALL section](../INSTALL.md).
2. Create a Docker container using [the Puppeteer-Jest Docker image](https://hub.docker.com/repository/docker/fzalila/docker-puppeteer-jest). To achieve that, run the following command:

```bash
docker container run --name testing-fadi fzalila/docker-puppeteer-jest:latest
```

3. Inside the created container, clone the FADI repository:

1. Install FADI platform. Refer to [the INSTALL section](../INSTALL.md).
2. Create a Docker container using [this Docker image](https://hub.docker.com/repository/docker/fzalila/docker-puppeteer-jest). To acheive that, you can run the following command

`docker container run --name testing-fadi fzalila/docker-puppeteer-jest:latest`
3. Inside the created container, clone the fadi repository:
```bash
git clone https://github.com/cetic/fadi.git
```

`git clone https://github.com/cetic/fadi.git`
4. Configure [here](./lib/config.js) the urls and paths of different FADI platform services
4. Configure [here](./lib/config.js) the urls and paths of different FADI platform services

5. Go to the `tests` folder
5. Go to the `tests` folder and launch the tests:

`cd fadi/tests`
6. and run the following command
`npm run test`
```bash
cd fadi/tests
npm run test
```

If tests pass, you should obtain the following results:

<img src="./screenshot.png" height="500"/>

<img src="doc/images/test_results.png" height="500" alt="Tests results" />

## Example
## Examples

The following example checks the creation of a `example_basic` table in the `postgres` database.

Expand All @@ -59,12 +70,43 @@ The following example checks the creation of a `example_basic` table in the `pos
await shouldExist(page, '#content > p.message')
})
```

More examples are available in the [test-scripts folder](doc/test-scripts/).

## Documentation
Test cases specification of FADI platform are defined using cockburns[1] and available [here](doc/Cockburns-specification.md).

Test cases of the FADI framework are specified using Cockburns[1] templates, available [here](doc/Cockburns-specification.md).

Test scripts specifications are available [here](doc/Test-scripts-specifications.md).

Two templates are available in order to define a new [test case](doc/cockburns/TC-template.md) and a new [test script](doc/test-scripts/TS-template.md).

## Continuous integration

To automate testing inside a continuous integration process, you can for example add a `test` stage to a Gitlab-CI pipeline by editing the `.gitlab-ci.yml` configuration:

```yaml
stages:
- deployWithHelm
- test

deployWithHelm:
[...]

test:
stage: test
image: fzalila/docker-puppeteer-jest
script:
- ls
- cd tests/
- pwd
- npm run test
tags:
- docker
only:
- develop
```
## References
[1] Alistair Cockburn. 2000. Writing Effective Use Cases (1st. ed.). Addison-Wesley Longman Publishing Co., Inc., USA.
[1] Alistair Cockburn. 2000. Writing Effective Use Cases (1st. ed.). Addison-Wesley Longman Publishing Co., Inc., USA.
16 changes: 12 additions & 4 deletions tests/doc/Cockburns-specification.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# General definitions
Test cases specifications
================

* [General definitions](#general-definitions)
* [Abbreviations lists](#abbreviations-list)
* [Actors](#actors)
* [Test cases list](#test-cases-list)

## General definitions

In this section, the main concepts and technologies are introduced in order to ease the understanding of the different test use cases.

Expand All @@ -15,7 +23,7 @@ In this section, the main concepts and technologies are introduced in order to e
* **Jupyter** is a notebook that provides an easy interface to the Spark processing engine that runs on your cluster. It is used in the FADI platform to enable the use of Spark and explore data.


# Abbreviations list
## Abbreviations list


<table>
Expand All @@ -35,7 +43,7 @@ In this section, the main concepts and technologies are introduced in order to e



# Actors
## Actors


<table>
Expand Down Expand Up @@ -83,7 +91,7 @@ In this section, the main concepts and technologies are introduced in order to e



# Test case list
## Test cases list


<table>
Expand Down
4 changes: 2 additions & 2 deletions tests/doc/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test specification

Test cases specification using cockburns is available [here](./Cockburns-specification.md).
Test cases specification using Cockburn template is available [here](./Cockburns-specification.md).

Test scripts specification is available [here](./Test-scripts-specifications.md).
Test scripts specification is available [here](./Test-scripts-specifications.md).
15 changes: 12 additions & 3 deletions tests/doc/Test-scripts-specifications.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Actors abbreviations list
Test scripts specifications
============

* [Actors abbreviations list](#actors-abbreviations-list)
* [Description of the content of the table](#description-of-the-content-of-the-table)
* [Test scripts list](#test-scripts-list)

## Actors abbreviations list
<table>
<tr>
<td><strong>Abbreviation</strong>
Expand All @@ -20,7 +27,8 @@
</tr>
</table>

# Description of the content of the table
## Description of the content of the table

<table>
<tr>
<td><strong>Column</strong>
Expand Down Expand Up @@ -60,7 +68,8 @@
</tr>
</table>

# Test scripts list
## Test scripts list

<table>
<tr>
<td><strong>Test script ID</strong>
Expand Down
File renamed without changes

0 comments on commit 0f3df92

Please sign in to comment.