cooking eclipse plugins with bdd, cucumber, swtbot and tycho

21
Cooking Eclipse Plugins © 2014 Migeran Ltd. All rights reserved. Gergely Kis CEO Migeran Ltd Tycho

Upload: gergely-kis

Post on 16-Apr-2017

109 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

Cooking Eclipse Plugins

© 2014 Migeran Ltd. All rights reserved.

Gergely Kis

CEO

Migeran Ltd

Tycho

Page 2: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

Agenda

● Introduction

– Why are we building an Eclipse plugin?

– A Success Story

● The Ingredients

– Cucumber

– SWTBot

– Tycho

– Served by Jenkins

● Tasting it (Demo Time!)

Page 3: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 3

Introduction● Worked in Mobile for 10 years

– Platform development (Siemens, Android)

– App development● Android, iOS, BB 10, BB Classic, J2ME, Symbian

● Started MattaKis Consulting in 2007

– Cross-platform Mobile Apps since 2008

– Migeran spin-off created in 2013

● Other Technologies

– Embedded Linux (C / C++ / ARM / MIPS)

– Java EE (Spring, Play)Eclipse user since 2002

Page 4: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 4

Why are we building an Eclipse Plugin?

● Developers can create iOS Apps in Java or Scala

● IDE based on Eclipse, integrated with Xcode

+ =MacBook Pro

AndroidDeveloper

iOSApps

Page 5: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 5

Success Story – Not a Fairy Tale

Continuous Improvement

Page 6: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 6

Our Journey – The Beginning

Releases withManual testing

Prototype

Quality is notthe main focus

Long QA Cycles,Stress

● We have:

– Unit tests

– Automated by the CIServer

● We need:

– Automated acceptancetests

– Created by thedevelopment team

Page 7: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 7

Automate UI Tests with SWTBot

● SWTBot: @Eclipse

– Write UI Tests with a beautiful Java API

– Integrates with JUnit, Tycho (Maven)

– Eclipse integrated Test Recorder for bootstrapping

UI TestsAutomated

Page 8: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 8

Our Journey – Strong Coupling

Releases withManual testing

Automated testsWith SWTBot

and JUnit

Prototype

Quality is not the main focus

Long QA Cycles,Stress

Tests are onlyreadable forDevelopers

● We have:

– Strong coupling ofspecification andimplementation oftests

● We need:

– Loose coupling

– Human readable testspecifications

– Still maintained bydevelopers

Page 9: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 9

Define Features with Cucumber

● Cucumber: cukes.info

– BDD framework

– Feature specifications written in textual form

– Specification steps implemented in a programminglanguage

– Ports available for many languages: Ruby, Java,Javascript … etc.

Page 10: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 10

Define Features with Cucumber (2)● Gherkin language:

– Easy to understand fornon-developers

– Separatesimplementation details

Step defnitions in plain Java

Page 11: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 11

Editing Cucumber Feature Files

● Xgherkin: @Github

● Gherkin file editorbased on Xtext

● Created by:

Sebastian Benz

of Jnario fame

Page 12: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 12

Sidebar: Jnario

● Jnario is an alternative to Cucumber

● Create executable specifications for

– Unit and integration tests

– Acceptance tests

● Built on Xtend

● Great tooling Check it out at: jnario.org

Page 13: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 13

Mixing SWTBot with Cucumber

● Created an SWTBot runner for Cucumber

● Can be executed from Eclipse with the standardJUnit launcher

● Also works with Maven and Tycho

Acceptance Tests

Decoupled

Page 14: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 14

Caveat: Hands Off while Running Tests

● Running SWTBot tests is sensitiveto external input events by theuser

– e.g. tests can fail if the testedwindow loses focus

Workaround: Run tests in a VM without

automatic input capture

Page 15: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 15

Caveat: Test Execution Time

● We are simulating a real usageenvironment

– Executing test suites can takea long time

Workaround: Developers only run affected features

Full test suite executed by the CI server

Page 16: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 16

Spicing the build with Tycho

● Project currently in Eclipse Incubation

● Build and test Eclipse Plugins on the commandline with Maven

● The glue between the PDE and CI servers

Our Pluginis ready

Page 17: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 17

Mr. Jenkins will serve the results

● Use Jenkins CI

– Launch builds with Maven (and Tycho)

– Inspect the results of tests

Actual results from the Migeran 0.12

Release cycle

Page 18: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 18

Tasting Time!

Tycho

Page 19: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 19

Our Journey – So Far

Releases withManual testing

Automated testsWith SWTBot

and JUnit

Prototype

Automated testswith SWTBot

and Cucumber

BDD: New Features defined with Cucumber

Quality is notthe main focus

Long QA Cycles,Stress

Tests are onlyreadable forDevelopers

Tests createdafter the fact

We are here

Page 20: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

© 2014 Migeran Ltd. All rights reserved. 20

Questions & Answers

● Migeran: migeran.com

– Create iOS Apps in Java

– Eclipse based IDE with Xcode integration

– Acceptance Tests created with SWTBot, Cucumber

– Jenkins & Tycho used for build automation

● Gergely Kis

– Email: [email protected]

Page 21: Cooking Eclipse Plugins with BDD, Cucumber, SWTBot and Tycho

21

Thank you!

http://www.migeran.com© 2014 Migeran Ltd. All rights reserved.