Tests E2E for ScadaLTS
-
Help for E2E options
scada-lts-e2e-cli-X.jar e2e -h
-
Help for advanced options, e.g. related to email/sms notification
scada-lts-e2e-cli-X.jar e2e run-app -h
-
Run - default, it expects the Scada-LTS application to be available from the address: http://localhost:8080/ScadaBR. If this is the case, just run the tests:
scada-lts-e2e-cli-X.jar e2e run-app
- Main types of E2E tests:
- PageObject - related to clicking after application ScadaLTS;
- ApiObject - related to testing of REST services;
- Project structure:
-
scada-lts-e2e-config - load configuration from properties, maven profiles/resources filtering/-Denv=dev/test;
-
scada-lts-e2e-pages - representation of the web part of the ScadaLTS application in the form of PageObject objects. Selenide has been used, Selenium may be used. There is a dependency on the module scada-lts-e2e-config. Page from ScadaLTS should have here representations in the form of the PageObject class, found in the package org.scadalts.e2e.pages.page.page_name;
-
scada-lts-e2e-api - representation of the web part of the ScadaLTS application in the form of ApiObject objects. There is a dependency on the module scada-lts-e2e-config. API from ScadaLTS should have here representations in the form of the ApiObject class, found in the package org.scadalts.e2e.api.service_name;
-
scada-lts-e2e-tests - module in which we write the right tests, using JUnit and Hamcrest, there is also a relationship to the modules: scada-lts-e2e-config, scada-lts-e2e-pages, scada-lts-e2e-api;
- Approach to writing tests:
- Page Objects pattern:
- the actual page or service is represented by the java class symbolically PageObject / ApiObject;
- the objects on the page or the service parameters are fields respectively PageObject / ApiObject class;
- actions on the website or service are methods of the PageObject / ApiObject class;
- We create the PageObjct or ApiObject object needed for testing, unless it exists and has the necessary fields, the PageObject / ApiObject objects wrap everything related to the actual page, service, here we use selenium / selenide;
- Using the PageObject / ApiObject objects, we write JUnit tests, we cannot use the selenium / selenide classes, if necessary it means that we need to implement something in the PageObject / ApiObject classes or create a tool class in scada-lts-e2e-pages;
- One test class tests one function: e.g. CreateGraphicalViewTest, DeleteGraphicalViewTest in the package: org.scadalts.e2e.tests.page.graphicalviews;
- org.scadalts.e2e.tests.page.page_name is package for test module scada-lts-e2e-pages;
- org.scadalts.e2e.tests.api.service_name is package for test module scada-lts-e2e-api;
- Build on:
- Windows 7 HP SP1 (64-bit);
- Java JDK 1.8.0_162 (64-bit);
- Maven 3.6.1;
- Run on:
- Windows 7 HP SP1/Linux Ubuntu 19.10 (64-bit)
- Java JRE 1.8.0_162-b12/OpenJDK RE 1.8.0_232-ea-8u232-b09-0ubuntu1-b09 (64-bit);
- Chrome 78.0.3904.108/79.0.3945.79-1 (64-bit);
- Instalation: (prefer IntelliJ, Windows 7 HP SP1/Linux Ubuntu 19.10)
- Download project Scada-LTS-E2E;
- Run in console: mvn clean install -De2eEnv=dev-local, file name: ${project.artifactId}-${project.version}-${e2eEnv}.jar;
- Run ScadaLTS; (http://localhost:8080/ScadaBR)
- Install browser Chrome;
- Run in console: java -jar scada-lts-e2e-tests-x.x.x-SNAPSHOT-dev-local.jar -De2eAll -De2eHeadless=false
- All options:
- -De2eUrl= - full url to application
- -De2eHeadless=true/false - headless option
- -De2eBrowser=chrome/firefox/opera - choose browser (chrome - full supported, opera - not supported headless, firefox - not supported)
- -De2eTimeout= - timeout in millisecond
- -De2eEnv=dev/test - environment
- -De2eUser= - username to account
- -De2ePassword= - password to account
- -De2eCtrl= - key ctrl windows/mac/linux
- -De2eTests='package.ClassTest1;package.ClassTest2;package.ClassTest3' - list class test to run
- -De2eAll - run all test (ScadaAllTestsSuite)
- -De2eApi - run api test (ScadaApiTestsSuite)
- -De2ePage - run page test (ScadaPageTestsSuite)
- -De2eCheck - run check test, tests readonly, monitoring (ScadaCheckTestsSuite)
- -De2eConfig - show current configuration
- Versioning rules: Major.Minor.Patch
- Major+ if backwards incompatible changes, public class/method removed, public api changed;
- Minor+ if adding new classes, methods, e.g. with tests;
- Patch+ if tiny corrections, typos, or a patch that works for something that didn't work before;
- mvn versions:set -DnewVersion=x.x.x-SNAPSHOT
- mvn versions:commit