Automated Unit Testing


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Introduction Introduce yourself Presentation about unit testing in an APEX dev project Presentation focusses on the development process during an APEX project
  • Various forms of testing, all with there own charicteristcs and methods. The basis and fundament of the application is tested/verified by unit tests, done by the developer (peer reviews etc.) Without this basis, the application will be build on a weak fundament. Since the above mentioned tests have another focus and purpose. Stress Test – Real Application Testing
  • Unit testing in a Oracle environment is tricky and therefor not done automatically . Most units are highly data dependent. Making it harder to isolate certain testcases and scenarios From the most used development tooling there is no open standard unit test method, like Java has Junit, which is available (with plugins) in most IDEs
  • When looking in projects I have worked with, I see many problems when unit / system testing is being done - the created tests are not repeated, once it works it is done and no pro active retesting is done in case the software is changed - Mostly the tests are performed manually, mostly because of the high data dependent, and the developer has to validate if the outcome is confirm the expected result. - The test cases that are being tested are limited, it is hard to estimate if the tests cover all behavior of the unit Unit testing must be part of the developmentprocess
  • Sogeti Nederland B.V.
  • Sogeti Nederland B.V. So why we want to atomate this part of the development process - repeatable test cases and unit tests saves time - Reporting is possible, telling about how many test cases are ran and what the code coverage is of the unittests
  • Sogeti Nederland B.V. SQLDevloper now has a full PL SQL unit test framework This framework was introduced in SQLDev 2.2 and expanded in 3.0 Framework consist of different components, tests are the unittests , and with suites you are able to combine testcases Libaries and lookups can be used to fulfill the pre and post conditions of the unit In the startup and teardown actions you can code the preconditions, eg. Create d=the data the test case is dependent on With validations the framework can validate the outcome of the unit test automatically
  • Why is this suitable to use in an APEX project - best practice is to implement complex login in PL?SQL packages on the database - We tried to avoid tight coupling with APED, see direct reference item values or collections - within SQLDev 3.0 the framework has some great new features, for example the supports custom data types and Test synchronization. which makes it more usable
  • Automated Unit Testing

    1. 1. In an APEX development project Automated unit testing Simon Boorsma Senior Technology Specialist Oracle at Sogeti Netherlands
    2. 2. Various forms of testing <ul><li>User or acceptance test </li></ul><ul><li>Test by (key)end users </li></ul><ul><li>Functional and regression test </li></ul><ul><li>Test of the functionality by test engineers </li></ul><ul><li>Stress and performance test </li></ul><ul><li>Validation technical aspects of the application by DBAs or SAs </li></ul><ul><li>Unit test </li></ul><ul><li>A unit is being validated by a developer </li></ul><ul><li>Without unit testing a weak fundament </li></ul>
    3. 3. Unit testing - Problems <ul><li>Data dependent behavior </li></ul><ul><ul><li>Content of tables, cursor variables and parameters </li></ul></ul><ul><li>No open standard test method </li></ul><ul><ul><li>From the community and the development tools </li></ul></ul><ul><li>Coding is more fun than testing </li></ul><ul><ul><li>Developers opinion </li></ul></ul><ul><li>Time consuming </li></ul>
    4. 4. Unit testing – In practice <ul><li>Unit tests not repeated </li></ul><ul><li>When it works, no pro active repeating reviews </li></ul><ul><li>Limited testcases </li></ul><ul><li>code and behavior coverage of the test cases is unclear </li></ul><ul><li>Manual review </li></ul><ul><li>Review errors can be made </li></ul><ul><li>Unit tests starts after coding </li></ul><ul><li>Pursuit for positive result </li></ul><ul><li>Many bugs during testing causes a loose of focus </li></ul>
    5. 5. Unit testing – Test Driven Development <ul><li>Know the expected behavior </li></ul><ul><li>Specify interface carefully </li></ul><ul><li>Define test cases </li></ul><ul><li>Sufficient code and behavior coverage? </li></ul><ul><li>Implement the unit </li></ul><ul><li>Code to fulfill the test cases </li></ul><ul><li>Specify behavior before start coding </li></ul>
    6. 6. Automated unit testing <ul><li>Repeatable unit test cases </li></ul><ul><li>Expandable </li></ul><ul><li>Automatic review </li></ul><ul><li>Report possibilies </li></ul><ul><li>Run unit tests with just hitting the play button </li></ul>
    7. 7. PL/SQL unit test framework <ul><li>Tests and suites </li></ul><ul><li>Libraries and Lookups </li></ul><ul><li>Startup and Teardown actions </li></ul><ul><li>Validations </li></ul><ul><li>Reports </li></ul>
    8. 8. Demonstration
    9. 9. Use in APEX project <ul><li>Logic implemented in PL/SQL packages </li></ul><ul><ul><li>Validations and Processes </li></ul></ul><ul><li>No tight coupling with APEX </li></ul><ul><ul><li>No use of v(‘ITEM’) </li></ul></ul><ul><li>Support for custom data types </li></ul>
    10. 10. staat voor resultaat
    11. 11. Features SQLDeveloper 3.0 <ul><li>Test synchronization </li></ul><ul><li>Advanced Data types support </li></ul>