Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017
-
Upload
tobias-schneck -
Category
Software
-
view
148 -
download
3
Transcript of Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017
![Page 1: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/1.jpg)
Containerized End-2-End Testing
+
, Tobias Schneck ConSol Software GmbH
![Page 2: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/2.jpg)
Characteristics of End-2-End Testing
Different types of testing:Regression testsFunctional approval tests
Parallel tests with GUIs are complexStateful tests: user logins, sessions, historySetup and cleanup of test data
Manual effort > effort for test automation
![Page 3: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/3.jpg)
Advantages of Container Technology
Isolation of environmentsRepository for versioning and distributionReproducible application environment
Dockerfile, docker-compose.ymlOptimized for parallel execution and cloud systems
Less memory and CPU overhead (shared Linux kernel)Starting containers on-the-flyUnique command line interface (orchestration tools)
![Page 4: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/4.jpg)
Containerized GUIs### start the docker container via x-forwarding docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw rasch/inkscape
### start the docker container with VNC interface # connect via URL: http://localhost:6911/vnc_auto.html?password=vncpassword docker run -it -p 5911:5901 -p 6911:6901 consol/ubuntu-xfce-vnc docker run -it -p 5912:5901 -p 6912:6901 consol/centos-xfce-vnc docker run -it -p 5913:5901 -p 6913:6901 consol/ubuntu-icewm-vnc:dev docker run -it -p 5913:5901 -p 6914:6901 consol/centos-icewm-vnc:dev
![Page 5: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/5.jpg)
What's provided by ?
CategoryWeb tests through HTML selectors
Restricted to browser content
Open Source & Java API
Headless execution
Test writing assistance(recorder, tag finder)
Automatable / Test result reporting(CI, DB, monitoring environment)
![Page 6: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/6.jpg)
Monitoring Integration Nagios OMD Incinga Check_MK
![Page 7: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/7.jpg)
Test Definition (Java Script)
![Page 8: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/8.jpg)
Test Case Structure// testcase.js
/************************************* * Initialization *************************************/ _dynamicInclude($includeFolder); var testCase = new TestCase(60, 70); var env = new Environment(); var appNotepad = new Application( "gedit"); var region = new Region();
/****************************** * Description of the test case ******************************/ try {
//...
/************************************************ * Exception handling and shutdown of test case **********************************************/ } catch (e) { testCase.handleException(e); } finally { testCase.saveResult(); }
![Page 9: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/9.jpg)
Call all Sahi Functions for Web Testing// testacase.js /************************ * Call Sahi Functions ***********************/
_navigateTo( "http://sahi.example.com/_s_/dyn/Driver_initialized" ); _highlight(_link( "SSL Manager" )); _isVisible(_link( "SSL Manager" )); _highlight(_link( "Logs")) _click(_link( "Logs"))
testCase.endOfStep( "Test Sahi landing page" , 5);
![Page 10: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/10.jpg)
Fluent API for UI Testing// testacase.js
/*** open calculator app ***/ var calculatorApp = new Application( "galculator" ).open(); testCase.endOfStep( "Open Calculator" , 3);
/*** calculate 525 + 100 ***/ var calculatorRegion = calculatorApp.getRegion(); calculatorRegion.type( "525") .find("plus.png") .click() .type("100");
calcRegion.find( "result.png" ).click(); calcRegion.waitForImage( "625", 5);
testCase.endOfStep( "calculate 525 +100" , 20);
![Page 11: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/11.jpg)
Custom Functions// e.g. excluded into a separate common.js
/********** * Combine click and highlight *********/function clickHighlight ($selector) { _highlight($selector); _click($selector); }
/*************** * Open PDF in native viewer **************/ var PDF_EDITOR_NAME = "masterpdfeditor3" ;
function openPdfFile(pdfFileLocation ) { return new Application(PDF_EDITOR_NAME + ' "' + pdfFileLocation + '"').open(); }
![Page 12: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/12.jpg)
Test Definition (Java)public class FirstExampleTest extends AbstractSakuliTest {
private static final String CITRUS_URL = "http://www.citrusframework.org/" ; private Environment env; private Region screen;
@BeforeClass @Override public void initTC() throws Exception { super.initTC(); env = new Environment(); screen = new Region(); browser.open(); }
@Override protected TestCaseInitParameter getTestCaseInitParameter () throws Exception { return new TestCaseInitParameter( "test_citrus" ); }
@Test public void testMyApp() throws Exception { // ... testcode }}
For the Maven dependencies, take a look at the .Java DSL Documentaion
![Page 13: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/13.jpg)
Test Definition (Java)public class FirstExampleTest extends AbstractSakuliTest {
// ... initializing code
@Test public void testCitrusHtmlContent () throws Exception { browser.navigateTo(CITRUS_URL); ElementStub heading1 = browser.paragraph( "Citrus Integration Testing" ); heading1.highlight(); assertTrue(heading1.isVisible());
ElementStub download = browser.link( "/Download v.*/" ); download.highlight(); assertTrue(download.isVisible()); download.click();
ElementStub downloadLink = browser.cell( "2.6.1"); downloadLink.highlight(); assertTrue(downloadLink.isVisible()); }
@Test public void testCitrusPictures () throws Exception { browser.navigateTo(CITRUS_URL); env.setSimilarity( 0.8); screen.find( "citrus_logo.png" ).highlight(); env.type(Key.END); screen.find( "consol_logo.png" ).highlight(); }}
![Page 14: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/14.jpg)
Sakuli End-2-End Testing Container
![Page 15: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/15.jpg)
Demo - Sakuli Container# start the docker container docker run -it -p 5911:5901 -p 6911:6901 consol/sakuli-ubuntu-xfce docker run -it -p 5912:5901 -p 6912:6901 consol/sakuli-centos-xfce docker run -it -p 5913:5901 -p 6913:6901 consol/sakuli-ubuntu-xfce-java docker run -it -p 5914:5901 -p 6914:6901 consol/sakuli-centos-xfce-java
# start in parallel via docker-compose # use docker-compos.yml from https://github.com/ConSol/sakuli/tree/master/docker docker-compose up
![Page 18: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/18.jpg)
Bakery Demogit clone https://github.com/toschneck/sakuli-example-bakery-testing.git
# start jenkins jenkins/deploy_jenkins.sh # start OMD montioring omd-nagios/deploy_omd.sh
# start the build of the application images bakery-app/app-deployment-docker-compose/deploy_app.sh
#start tests sakuli-tests/execute_all.sh #start tests for monitoring sakuli-tests/execute_all_4_monitoring.sh
![Page 19: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/19.jpg)
What's next?
Headless execution - Linux: VNC & Docker Windows: ?Cloud-ready container for OpenShift (security, source-2-image)Video recording of the test execution (error documentation)Web UI to handle Sakuli test suitesConnect 3rd-party test management tools (HP QC, TestRail, ...)Improve test result presentation in CI toolsSelenium as an alternative to SahiImplement Junit 5 test runner
![Page 20: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/20.jpg)
Links
ConSol/sakuli
ConSol/sakuli-examples
toschneck/sakuli-example-bakery-testing
[email protected] @sakuli_e2e
![Page 21: Containerized End-2-End Testing - Agile Testing Meetup at Süddeutsche Zeitung Munich 19.01.2017](https://reader031.fdocuments.us/reader031/viewer/2022030207/58a930d41a28ab3f778b5345/html5/thumbnails/21.jpg)
Thank you!
Tobias Schneck
ConSol Software GmbHFranziskanerstraße 38D-81669 MünchenTel: +49-89-45841-100Fax: +49-89-45841-111
tobias.schneck@consol. toschneck
ConSol