Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

26
Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010

Transcript of Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 1: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Selenium automated testing in Openbravo ERP

Quality Assurance Webinar

April 8th, 2010

Page 2: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 2

Agenda

• Automated integration testing 10 minutes– Selenium

– Benefits

– Other used tools

– Selenium IDE

• Automated integration testing in Openbravo 10 minutes– What to automate?

– Design

– Stepping through code

• Making an automated test for Openbravo 10 minutes– How to automate a test case?

– Extend an existing test case

• Q & A 30 minutes

Page 3: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 3

• Automated integration testing– Selenium

– Benefits

– Other used tools

– Selenium IDE

• Automated integration testing in Openbravo– What to automate?

– Design

– Stepping through code

• Making an automated test for Openbravo– How to automate a test case?

– Extend an existing test case

• Q & A

Page 4: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 4

Selenium

• Selenium is a free software testing framework for web applications.

• Selenium Remote Control - http://seleniumhq.org/projects/remote-control/

– Allows to write tests in any programming language that can make HTTP requests; using any mainstream JavaScript-enabled browser.

– Consists of:• A server which automatically launches and kills browsers, and acts

as a HTTP proxy for web requests from them.• Client libraries for Python, Ruby, .NET, Perl, Java, and PHP.

– Includes Selenium Core (the test execution framework) as its engine and automatically loads it into the browser.

Page 5: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 5

Benefits

• The testing suites can be executed daily, to check the most recent changes.

• It takes less time than a manual execution.

• Spot errors that a human might not notice.

• Prevent regressions.

• Free staff to do other non-repetitive tasks and to look for errors that a machine can't spot.

Page 6: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 6

Other used tools

• Selenium IDE: a Firefox extension that allows to record, edit, debug and play back tests.

• Firebug: a Firefox extension that lets you inspect the HTML file of a web page on an easy way. With it you can also edit and debug the code of a page.

• Xpath Checker: a Firefox extension that shows the XPath of an element on a web page. In addition, you can write your own XPath expressions and see the elements that match.

• Ant: a software tool for automating software build processes.

• JUnit: a unit testing framework for the Java programming language.

• Eclipse: Java/JUnit development environment

Page 7: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 7

Selenium IDE

Page 8: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 8

• Automated integration testing 10 minutes– Selenium

– Benefits

– Other used tools

– Selenium IDE

• Automated integration testing in Openbravo 10 minutes– What to automate?

– Design

– Stepping through code

• Making an automated test for Openbravo 10 minutes– How to automate a test case?

– Extend an existing test case

• Q & A 30 minutes

Page 9: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 9

What to automate?

• Drivers and restrictions– Automation is a time consuming task.– Maintainability is an issue.– Only very stable flows should be automated.– Automated test cases have sense if executed at least ten times.– Only user-visible actions are performed– Javascript events could be missed by Selenium.

• Our pick– The Acceptance test

http://wiki.openbravo.com/wiki/Acceptance_Testing

Page 10: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 10

Design: General diagram

Test SuiteTest cases

Steps VerificationsExpected Results

Openbravo ERP(Running in a web browser)

Windows

Fields Buttons Links

SeleniumTests

Automated test cases

Test controllers

Screen definitions

Param

eters 2

1

Page 11: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 11

Stepping through 1/2: Test controllers

Test cases

Steps Verifications ExpectedResults

Automated test cases

Test controllers

Param

eters

• Test controllers are closer to Functional Test Cases

• They know about common steps

• Based in superclass OpenbravoERPTest.java

Page 12: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 12

Design: General diagram (Again)

Test SuiteTest cases

Steps VerificationsExpected Results

Openbravo ERP(Running in a web browser)

Windows

Fields Buttons Links

SeleniumTests

Automated test cases

Test controllers

Screen definitions

Param

eters

Page 13: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 13

Stepping through 2/2: Screen definitions

• Screen definitions are closer to HTML pages.

• They know about Fields, Buttons, Links.

Windows

Fields Buttons Links

Automated test cases

Screen definitions

Param

eters

Page 14: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 14

• Automated integration testing 10 minutes– Selenium

– Benefits

– Other used tools

– Selenium IDE

• Automated integration testing in Openbravo 10 minutes– What to automate?

– Design

– Stepping through code

• Making an automated test for Openbravo 10 minutes– How to automate a test case?

– Extend an existing test case

• Q & A 30 minutes

Page 15: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 15

How to automate a test case?

• Document the scenario and execute it manually.Visit Testlink at http://tools.openbravo.com:8891/testlink/

• Understand the design.

• Read the documentation and implementation of the main classes.

• Look for code that you can reuse.

• Code missing screen definitions.

• Write the test controller.

• Test your test.

Page 16: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 16

Extend an existing test case – The screen definition 1/2

2

2

1

1 3

Page 17: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 17

Extend an existing test case – The screen definition 2/2

2

21

1

Page 18: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 18

Extend an existing test case – The test controller

1

2

1

2

Page 19: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 19

Extend an existing test case – The test controller

Page 20: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 20

Extend an existing test case – Creating the file

1 2

Page 21: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 21

Extend an existing test case – Running the test case

Page 22: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 22

Extend an existing test case – Results

Page 23: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 23

Wrap-up

• Selenium is a powerful tool for tests automation.

• Openbravo uses Selenium and other tools as part of its Quality Assurance processes.

• You can use those tools and the automation framework provided by Openbravo to test your Openbravo ERP instances and modules.

Page 24: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 24

More info

• The source code is available at http://code.openbravo.com/tools/automation/main

• Ask your questions and give us your suggestions in http://forge.openbravo.com/projects/automation/forum

• The documentation is in the wiki http://wiki.openbravo.com/wiki/Category:Automated_Testing_ERP

Pablo Luján

[email protected]

Arun [email protected]

Leo [email protected]

elopio at #openbravoon irc.freenode.net

Page 25: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 25

Next webinar: “Life Cycle Management”April 22nd, 2010

IMPORTANT! Special time: 10:00 (CET)

Page 26: Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.

Page 26

Q & A