26
FAST UNITS TESTS FOR ECLIPSE PLUGINS Possible architectures and available tooling Aurélien Pupier Senior Software Engineer 9 th June 2016 @apupier

Fast unit tests for Eclipse Plugins

Embed Size (px)

Citation preview

Page 1: Fast unit tests for Eclipse Plugins

FAST UNITS TESTS FOR ECLIPSE PLUGINS Possible architectures and available tooling

Aurélien PupierSenior Software Engineer9th June 2016@apupier

Page 2: Fast unit tests for Eclipse Plugins

2 / 26

What happened?

●h

ttp

://w

ww

.co

mm

itstr

ip.c

om

/en

/20

16

/03

/15

/ho

w-t

o-o

ptim

ise

-yo

ur-

time

-as-

a-c

od

er/

Page 3: Fast unit tests for Eclipse Plugins

3 / 26

Response Time Limits

0 5 10 15 20 25 30 35

s

JUnit Plugin with Workbench

JUnit Plugin Headless

JUnit

user's flow of thought broken

1 Sec

lost the user's attention

10 Sec

Page 4: Fast unit tests for Eclipse Plugins

4 / 26

Objective

Stay Focused

Page 5: Fast unit tests for Eclipse Plugins

5 / 26

In our case...

Fast feedbackfrom (unit) tests in IDE

Page 6: Fast unit tests for Eclipse Plugins

6 / 26

Time to launch Tests

0 5 10 15 20 25 30 35

s

JUnit Plugin with Workbench

JUnit Plugin Headless

JUnit

Page 7: Fast unit tests for Eclipse Plugins

7 / 26

Plain JUnit Tests for plugins

Several possibilitiesNo consensus

Page 8: Fast unit tests for Eclipse Plugins

8 / 26

Architecture possibilities

src

src/test/java

src

src/test/java

src/test/javasrc

src src/test/java

Page 9: Fast unit tests for Eclipse Plugins

9 / 26

User Library inside plugin

src

Page 10: Fast unit tests for Eclipse Plugins

11 / 26

User Library inside plugin

src

src/test/java

Page 11: Fast unit tests for Eclipse Plugins

12 / 26

User Library inside plugin

● Clean Runtime

● Small tests

● Build time

● Fragment test

● No third-party:

– Your test toolkit

Page 12: Fast unit tests for Eclipse Plugins

13 / 26

Optional dependency inside plugin

src

Page 13: Fast unit tests for Eclipse Plugins

14 / 26

Optional dependency inside plugin

src

src/test/java

Page 14: Fast unit tests for Eclipse Plugins

15 / 26

Optional dependency inside plugin

● Third-parties:

– Your test toolkit● RCP application not

planned to be extended by third-parties

● Pollute runtime!

Page 15: Fast unit tests for Eclipse Plugins

16 / 26

Fragment

src

Page 16: Fast unit tests for Eclipse Plugins

17 / 26

Fragment

src/test/javasrc

Page 17: Fast unit tests for Eclipse Plugins

18 / 26

Fragment

● Clean runtime

● Third-parties:

– Your test toolkit● Most powerful with

clean runtime

● > Built-time

● Repository Complexity

● Test fragments

Page 18: Fast unit tests for Eclipse Plugins

19 / 26

Test plugin

src

Page 19: Fast unit tests for Eclipse Plugins

20 / 26

Test plugin

src src/test/java

Page 20: Fast unit tests for Eclipse Plugins

21 / 26

Test plugin

● Third-parties:

– Your test toolkit● Single plugin for

integration tests

● Pollute runtime!

● > Built-time

● Repository Complexity

● Package scoped

Page 21: Fast unit tests for Eclipse Plugins

22 / 26

Architecture possibilities

src

src/test/java

src

src/test/java

src/test/javasrc

src src/test/java

Page 22: Fast unit tests for Eclipse Plugins

23 / 26

All tests are important!

We talked here

Page 23: Fast unit tests for Eclipse Plugins

25 / 26

Tooling demo

https://github.com/apupier/EclipsePlugins-Testing

Page 24: Fast unit tests for Eclipse Plugins

26 / 26

Going further

● Test classpath supported by PDE and Tycho?

● Pre-mocked E4 Context?

● MoreUnit automatic configuration support?

● Fast Integration/UI tests continuous feedback?

Page 25: Fast unit tests for Eclipse Plugins

Go Continuous Test

@apupier

Page 26: Fast unit tests for Eclipse Plugins

28 / 26

References

● https://rcpquickstart.wordpress.com/2007/06/20/unit-testing-plug-ins-with-fragments/

● https://resheim.net/2014/12/unit-testing-eclipse-rcp-applications.html

● https://www.nngroup.com/articles/response-times-3-important-limits/

● http://www.commitstrip.com/en/2016/03/15/how-to-optimise-your-time-as-a-coder/