this is theme · selenium selenium ide (firefox plugin) selenium core remote control grid. good...

49

Upload: others

Post on 01-Aug-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support
Page 2: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support
Page 3: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

This is Theme ”Metro”

Page 4: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

What the heck is that bar over there?

Page 5: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Design -> Far right -> Check Hide Background Graphics

Page 6: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Voila!

Page 7: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Thomas Ferris Nicolaisen (Objectware) presents

Page 8: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

i. Some real-life besserwisseningii. Technology 1: Selenium for web-testingiii. Technology 2: Hudson for Continous Integrationiv. Testing Strategies (The Big Picture)

Page 9: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

thomafniMSc from ifi spring 2006inf5750 spring 2005Blog here: http://tfnico.blogspot.comMail here: tfnico <at> gmail.com

Page 10: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

hisp.infosvn co http://www.hisp.info/svn/trunk/dhis-2/mvn installbuilding... ...lotsa depstests are running..... and running...

oi, a test failure! : Failed tests: testExport(org.hisp.dhis.importexport.ixf.IXFExportServiceTest)jaja, -Dmaven.test.skip=truestill on webwork 2.2.6? tsk, tsk, well so are we anyway

mvn eclipse:eclipse and import into Eclipse..

Not too many warnings. Nice project structure. Good root pom.

Page 11: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

•Active mailing lists•Improved Wiki•Code looks nice•An active Trac•Demo up!•An installer that works!

Page 12: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

In short

Page 13: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

BEAUTIFUL!

Well done.

Page 14: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support
Page 15: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support
Page 16: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

*Disclaimer: This presentation was originally made for Storebrand developers (in Norwegian).

Page 17: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Warmup

Web developers? Tried..

JUnit FIT(nesse) Watir Selenium

Page 18: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

A trip down memory lane

January: Selenium is released

Quickly gains attention through conferences, articles, etc

2005

Page 19: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

A trip down memory lane

October: Storebrand starts using Selenium tests

• Verifying use-cases

• Regression testing

• Basis for performance tests

2006

Page 20: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

A trip down memory lane

Selenium development hibernation (only 1 release)

November/December: Storebrand’s tests are freshed up

2007

Page 21: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

A trip down memory lane

Storebrand still runs Selenium tests

Selenium popularity increases (1.0 beta released)

2008

”Google has 51k Selenium tests running accross 50 different teams”http://www.youtube.com/watch?v=EDb8yOM3Vpw

Page 22: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Why test?

People are slow!

Tests can be automated (and monitored)

Errors in existing code introduced (regression_tests)

Verify functionality (use-cases)

Handy for debugging

Page 23: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Why test web?

Some things you can’t test with JUnit (easily) JSP HTML/Web-design JavaScript Navigation/urls (struts.xml) Entire scenarios (log in and buy insurance)

Page 24: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Some architecture

Web

JSP JSP JSP JSP

Controller Controller Controller Controller

Service Service

Page 25: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Some test architecture

Web

JSP JSP JSP JSP

Controller Controller Controller Controller

Service Service

JUnit

JUnit

JUnit

?

Page 26: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Web-testing tools

Pros Cons

Selenium

(JS-engine)

Can test JS

Good Recorder

Browser dependant

Watir

(Ruby)

Powerful language

Runs native IE

New language

Browser dependant

HtmlUnit

(Java)

Mature

Virtual browser buffer

No recorder

Page 27: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Selenium

Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid

Page 28: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Good things about Selenium

Active community Scaringly easy Good AJAX/JavaScript support

Page 29: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

A normal day in the web-testers life Do a quick demo on local DHIS2 (Or on the demo site) Show the screencast

Page 30: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

maven-selenium-plugin

take it for a spin

Page 31: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

What can go wrong

Too much time Too much ”dill” Tests break without anything being wrong

(dialog boxes, browser upgrades) Too many tests Too long, slow tests Testing the wrong thing

Page 32: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Remedies Use it, and get help Good urls, good id’s Test suites:

20 favourites Integration Life

Page 33: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Don’t test these

Performance (unøyaktig måling) Data (too static) Business rules (imprecise) Integration (too slow)

Page 34: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

More tips

Push tests ”downward”

Be pragmatic

Don’t test everything with Web/GUI-tests

Have a strategy

Make bugreporters record traces when they report errors

WebJSP JSP JSP JSP

Controller Controller Controller Controller

Service ServiceJUnitJUnit

JUnit

?

Page 35: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Testing Strategies Selenium? ----------------

Fit? ------------------------

TestNG? ------------------

JUnit? ---------------------

Page 36: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Testing Strategies Selenium? ----------------

Fit? ------------------------

TestNG? ------------------

JUnit? ---------------------

No data Data No environment

Environment Location

Unit test Fast (1-5) n/a Fast (1-5) n/a

Service test Fast (1-5) Slow (2-5) Fast (1-5) Slow (2-5)

System test Slow (2-5)

Slow (2-5) Slow (2-5) Slow (2-5)

Page 37: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

And now..

Page 38: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Questions to you

Should we run clean install before every commit?

How long should the build take?

Page 39: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Continous Integration

Don’t run the tests yourself ”Security-net”

Page 40: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Take it for a spin

Show off hudson locally

Page 41: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Continous Integration

Let the machines do the testing Earliest possible feedback! The build is broke! What’s broken? Who broke it?

Page 42: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Continous Integration

Continuum (from the Maven lads) Hudson (Koshuke, the devil) CruiseControl (good old) Bamboo (Atlassian) TeamCity (ditto..)

Page 43: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Things to consider

One product, one build? (you could build site..) Lots of different things to test Many testing frequencies

Each commit Hourly Nightly

Page 44: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

My advice

For every combination (you want to do) Make a job: build goal plus frequency

2 minute build 10 minute build database-integration tests web-tests every-2-hour-integration tests nightly site/snapshot

Page 45: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Broken or unstable?

Is it broken if only 1 test doesn’t run? What does broken mean? Is that test releavant to all the other modules?

Should we keep building the next modules

Page 46: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Broken or unstable?

Make the CI see the difference Hudson and Bamboo shows new test-failures Yellow versus green builds

Page 47: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Conclusion

Today: Install Selenium IDE

Next weeks: Maintain a handful of tests

When/if you learn to love them Throw them into a CI

Page 48: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

Questions?

Page 49: This is Theme · Selenium Selenium IDE (Firefox plugin) Selenium Core Remote Control Grid. Good things about Selenium Active community Scaringly easy Good AJAX/JavaScript support

If you’ve got any questions, please mail me at tfnico <at> gmail.com.