+ All Categories
Home > Software > Sutol 2016 - Automation is developer's friend

Sutol 2016 - Automation is developer's friend

Date post: 12-Apr-2017
Category:
Upload: mpradny
View: 346 times
Download: 0 times
Share this document with a friend
42
Automation is developer’s friend Martin Přádný pristo solutions, s.r.o.
Transcript
Page 1: Sutol 2016 - Automation is developer's friend

Automation is

developer’s friend

Martin Přádný

pristo solutions, s.r.o.

Page 2: Sutol 2016 - Automation is developer's friend

Thanks to our sponsors!

Page 3: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Martin Přádný

• Notes/Domino– since 2000

• Java

• IBM BPM

• Sharepoint/K2 workflow

• @mpradny

• http://pradny.com

Page 4: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Warning

• This session is:

– collection of tools that can make you more

productive and your life easier

– personal selection of tools that I like

• (at time of writing)

• This session is NOT:

– best practices session

– web development basics course

4

Page 5: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Agenda

• Motivation

• Dev workstation

– Tools introduction

– Domino Designer integration

• CI server

– Jenkins Pipeline

– Selenium testing

5

Page 6: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Motivation

• Dev toolbox changed

– from

• complex, big

• (expensive) IDEs

– to

• small, open-source

• (free) single-purpose tools

• linked by build tools/process

6

Page 7: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Motivation II

• Application architecture shift

– from

• monolithic

• big and complex

– to

• orchestrated

• single-purpose components

• more complex flexible

7

Page 8: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Motivation III

• IBM Domino is part of the game

– source control enablement

– headless Domino Designer

• Domino works like small PaSS for ages

– provides Directory, Storage, Security, Mail… services

– simple app deployment model

– Domino Billing features

8

Page 9: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Demo application

• Simple TODO app

– React.js frontend

– running in Domino nsf XPages app

– using Domino data via REST calls

• Built automatically

– from GIT repository

– tested by Selenium tests

9

Page 10: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Dev workstation

• Not all developers use same setup

– OS differences

– Projects being worked on

– Personal preference• IDE/editor preference

• Not all developers need to build whole project

• Portable build tools to rescue

• Single place of truth – SCM repository

10

Page 11: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Toolbox

• Transpilers/Pre-processors

– from - syntax you want to write

– to - syntax that machine can work with

– (e.g. XPages to Java source code)

• Linters/Checkers

– analysis of code for potential problems

– ensures coding + formatting standards

11

Page 12: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Toolbox II

• Package managers

– download what you need

– maintain dependencies

• Builder/bundler tools

– take assets you give them

– produce runnable package

12

Page 13: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Toolbox III

• Task runners

– run and organize build workflow steps

• Dev servers

– fast preview of your changes

– integration with dev/debug tools

• Automated test tools

– verifies that all code still works

13

Page 14: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Frameworks/Ecosystems

• Tools that work nicely together

• Specialized for some language or subject domain

• JavaScript

– NPM (runs on Node.js)

• Java

– Maven

– Gradle

14

Page 15: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Transpilers/Pre-processors - JS

• Babel

– ES2015 (== ES6)

– TypeScript

– Cleaner code, full browser compatibility

15

Page 16: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Transpilers/Pre-processors - CSS

• LESS• variables, mixins, functions

– alternative - SASS

16

Page 17: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Linters/Checkers

• Javascript

– ESLint• unused variables, tabs vs. spaces, semicolons …

• rule sets for React.js

– alternatives JSLint, JSHint, JSCS

• Java

– SonarQube Java analyzer

– FindBugs• (not shown today)

17

Page 18: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Builder/bundler tools - JavaScript

• Webpack

– produces bundle.js

• includes CSS

• + resources (e.g. fonts, images)

– provides webpack-dev-server with hot-reload

• alternatives

– Browserify

• and Gulp, Grunt tasks/plugins

18

Page 19: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Never ending list

• Probably 10 new tools were published

during this session

• For beginners

– pick what you like after quick research

– use it and learn it

– change it once you understand differences

19

Page 20: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Demo setup

• One GIT repository

• folder for Front-End project

– React.js, Webpack, json-server

– Bootstrap, LESS

– publishes to WEB-INF folder of NSF ODP

• folder for NSF On-Disk-Project

• Visual Studio Code for Front-End dev

• Separate VM as local Domino Dev server

20

Page 21: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

DEMO

21

Page 22: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Summary Dev Machine

• Develop and test React.js app – without Domino Designer or server

• Produce front-end package– using webpack production build

– (installed with npm)

• Import it to Domino Designer– Team synchronization enablement

– WEB-INF/dist folder

• Put it on an XPage

• View from Domino VM

22

Page 23: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

CI goal

• Build front-end

• Build NSF, incl. front-end

• Deploy to test Domino server

• Run Selenium tests

– Firefox

– Chrome

23

Page 24: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Headless Domino Designer

• Command line invocation of Domino Designer

• Create NSF from On Disk Project

• Enable/Disable plugins

• New feature in 9.0.1– http://www-

10.lotus.com/ldd/ddwiki.nsf/dx/Headless_Designer_Wiki

– notes.ini parameter -DESIGNER_AUTO_ENABLED=true

– ID without password

24

Page 25: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Headless Designer invocation

• Manually

– Single command command line

• designer -RPARAMS -vmargs -

Dcom.ibm.designer.cmd=[clean],[exit],[file

name],[job name],[file path],[file name]

– Command file

• designer -RPARAMS -vmargs -

Dcom.ibm.designer.cmd.file=[path to command

file]

25

Page 26: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Headless Designer wrappers

• Maven – Christian Güdemann

– Included in public Maven repository

– Options to install Designer plugins

• Ant – Cameron Gregor

– Additional tasks for NSF manipulation

– Uses Java Native Interface

• Gradle - Martin Přádný

– not maintained

26

Page 27: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Headless designer - Maven

<packaging>domino-nsf</packaging>

<properties>

<ddehd.odpdirectory>

${basedir}/on-disk-project

</ddehd.odpdirectory>

</properties>

<build>

<plugins>

<plugin>

<groupId>org.openntf.maven</groupId>

<artifactId>headlessdesigner-maven-plugin</artifactId>

<version>1.3.0</version>

<extensions>true</extensions>

</plugin>

</plugins>

</build>

27

Page 28: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Why Maven

• Standard in XPages community

• OSGi friendly with Tycho plugin

– IBM released Update Site on OpenNTF.org

– IBM Domino Update Site for Build

Management

• Allows building Extension Libraries

28

Page 29: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Automated tests

• Unit testing

– tests minimal runnable units – e.g. methods

– rest of “world” replaced with mocks

• Integration testing

– test run with real subsystems, dbs etc.

• UI testing

– test driven using UI

29

Page 30: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Selenium

• Web browser automation (Firefox,

Chrome, IE,…)

• Selenium IDE (Firefox)

– Record tests

– Replay tests

– Export (Java, C#, ruby, Python, ..)

• Selenium server, grid

– Run tests on remote machines

30

Page 31: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Continuous integration server

• Maintains central place which allows

– anyone build the project

– anyone see current build status

– test application before build is publish

– automatically publish application to production

• Triggered

– manually

– automatically (after commit, periodically)

31

Page 32: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

CI software

• Jenkins– free, open-source

– many plugins

– master/slave architecture

• alternatives– TeamCity

– Bamboo

– Travis CI

– (Bitnucket Pipelines, GitLab CI)

32

Page 33: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Jenkins pipeline

• Define build using script

• Groovy based DSL

• Allows

– executor selection

– parallelism

– human interaction/approval

• Pipeline file from SCM

33

Page 34: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

DEMO change flow

34

Page 35: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

DEMO

+

Let’s break it

35

Page 36: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Jenkins Blue Ocean - Beta

36

Page 37: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

CI Summary

• Build front-end

– Webpack

• Build NSF, incl. front-end

– Maven running Domino Designer

• Deploy to test Domino server

– ANT task

• Run Selenium tests

– Firefox and Chrome

– TestNG run with Maven

37

Page 38: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Summary

• Our setup allows

– anyone with commit rights can modify the app

• no need for environment setup

• GIT and text editor are only needed tools

– even notepad or vi

– continually test with latest browsers

– easily build multiple versions

• e.g. stable and nightly

38

Page 39: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Summary

• Our setup guarantees

– nsf is correctly compiled

– code passes tests

– latest version is available for everyone

– in case of problem, people are notified quickly

39

Page 40: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Questions

40

Page 41: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Sample repository

• https://bitbucket.org/pradnik/todoapp_full/b

ranch/develop

41

Page 42: Sutol 2016 - Automation is developer's friend

8th Sutol Conference, November 2016

Resources

• Csaba Kiss – Beyond XPages

– http://xpagexplorer.org/reactjs-workflow/

• Stephan Wissel - Domino, Extlib, GRUNT, JSON and Yeoman

– http://www.wissel.net/blog/d6plinks/SHWL-A3QHEL

• NotesIn9 – Patrick Kwinten – Using Grunt With XPages

– http://www.notesin9.com/2016/10/10/notesin9-202-using-grunt-with-xpages/

42


Recommended