FADI - Ingest, store and analyse big data flows
The FADI framework is tested using Puppeteer and Jest.
Puppeteer 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 is a JavaScript Testing Framework with a focus on simplicity. It works with projects using: Babel, TypeScript, Node, React, Angular, Vue and more!
To test the FADI framework, you need to implement the following instructions:
docker container run --name testing-fadi fzalila/docker-puppeteer-jest:latest
git clone https://github.com/cetic/fadi.git
Configure here the urls and paths of different FADI platform services
Go to the tests
folder and launch the tests:
cd fadi/tests
npm run test
If tests pass, you should obtain the following results:
The following example checks the creation of a example_basic
table in the postgres
database.
it('should create a table', async () => {
// Go to the indicated page
await page.goto(url)
// Click on SQL query button
await click(page, '.ltr > #menu > .links > a:nth-child(1)')
// type the query
await typeText(page, 'CREATE TABLE example_basic (measure_ts TIMESTAMP NOT NULL,temperature FLOAT (50));', '.ltr > #content > #form > p > .jush')
// Execute the table creation query
await click(page, '.ltr > #content > #form > p > input:nth-child(1)')
// Check the creation of the table
await shouldExist(page, '#content > p.message')
})
More examples are available in the test-scripts folder.
Test cases of the FADI framework are specified using Cockburns[1] templates, available here.
Test scripts specifications are available here.
Two templates are available in order to define a new test case and a new test script.
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:
stages:
- deployWithHelm
- test
deployWithHelm:
[...]
test:
stage: test
image: ceticasbl/puppeteer-jest
script:
- cd tests/
- npm run test
[1] Alistair Cockburn. 2000. Writing Effective Use Cases (1st. ed.). Addison-Wesley Longman Publishing Co., Inc., USA.