1 / 58

Get your Oracle app Fit for release

Get your Oracle app Fit for release. Malcolm Leckie Technical Designer Scottish Life – part of The Royal London Group. Agenda. Introduction. What is Fit. How Royal London use Fit. Questions ?. About Royal London. UK’s largest mutual (customer-owned) Life and Pensions provider

shada
Télécharger la présentation

Get your Oracle app Fit for release

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Get your Oracle app Fit for release Malcolm Leckie Technical Designer Scottish Life – part of The Royal London Group

  2. Agenda Introduction What is Fit How Royal London use Fit Questions?

  3. About Royal London • UK’s largest mutual (customer-owned) Life and Pensions provider • Multi-brand business run as separate business units • 3,040* employees, primarily UK-based with main offices in Edinburgh, Wilmslow and London • £52.2 billion* of funds under management • Around 3.6 million customers* * As at 31st March 2013

  4. About Scottish Life • Founded in 1881, acquired by Royal London in 2001 • Pension specialist • Internal business users on two UK sites • Core business applications primarily developed in-house including secure web application for external customers and business partners

  5. About Me • First started using Oracle on Unix in 1987 • Been with Scottish Life since 1990 and didn’t start using Oracle again until 2004 • Work within the Technical Architecture & Design team • Provide specialised technical support for Scottish Life Oracle development teams covering both database and code

  6. About the Database • Main policy administration application uses Oracle 11r1 database and PL/SQL for business logic • Complex application landscape with multiple integrations • One production database supporting OLTP during day time and batch during night time • c. 1k concurrent users per hour • c. 1m online transactions per day • c. 350 batch reports per night • Multiple concurrent batch streams with complex dependencies

  7. Unix Database Servers Oracle External Business Partners Windows Database Servers MS SQL Internal Users Windows Web Servers External Users(Financial Advisers, Employers, Employees/Policyholders) Windows Application Servers About the Applications Internal Network DMZ Internet Firewall Firewall

  8. Why am I here? Moment of madness in February Not to preach why to test To show you how to reduce time spent on regression testing High level overview of the solution we have in place

  9. What business issues were we facing Desire to Improve speed and ease of regression testing Increase collaborative design and testing Reduce impact on code quality and confidence due to late requirements

  10. In the beginning Development of new application in Java Trying to using an Agile approach Unit testing and test driven development Fit framework for testing – opportunities for PLSQL

  11. What is Fit? Framework for Integrated Test, or "Fit", is an open-source tool for automated customer tests. It integrates the work of customers, analysts, testers, and developers. Fit was invented by Ward Cunningham in 2002.

  12. Components Input and expected results HTMLInput Results Core Java Fixtures HTMLOutput User Java Fixtures Interface to the application

  13. Where is the code – Java Fixtures? Download from sourceforge Get a single zip file

  14. Fit for Java v1.1 : fit-java-1.1.zip Archive Contents In this archive, you will find the following files and directories: fit.jar: The Fit executable and library. license.txt: The Fit license. Fit is licensed under the GPL. readme.html: This file. examples/input/: Sample files that you can run through Fit. examples/output/: What a few sample files look like after they've been run through Fit. examples/eg/: The source code for some example fixtures. spec/input/: The Fit Specification. spec/output/: The Fit Specification after being run on this release. spec/source/: Source code for the fixtures used in the Fit Specification. doc/: Supporting documentation. There's not much here—see the Fit website for the real Fit documentation. source/: The source tree used to build this release.

  15. HTML Driver File <html> <body> <h1>Integer Arithmetic</h1> <p>Basic Arithmetic <table BORDER COLS=6> <tr> <td COLSPAN="6">eg.ArithmeticFixture</td> </tr> <tr> <td>x</td> <td>y</td> <td>+</td> <td>-</td> <td>*</td> <td>/</td> </tr> <tr> <td>4</td> <td>2</td> <td>6</td> <td>2</td> <td>8</td> <td>1</td> </tr> </table> </body> </html>

  16. HTML Driver File Test Body <html> <body> <h1>Integer Arithmetic</h1> <p>Basic Arithmetic <table BORDER COLS=6> <tr> <td COLSPAN="6">eg.ArithmeticFixture</td> </tr> <tr> <td>x</td> <td>y</td> <td>+</td> <td>-</td> <td>*</td> <td>/</td> </tr> <tr> <td>4</td> <td>2</td> <td>6</td> <td>2</td> <td>8</td> <td>1</td> </tr> </table> </body> </html> <html> <body>. . . </body> </html>

  17. HTML Driver File Group Header <html> <body> <h1>Integer Arithmetic</h1> <p>Basic Arithmetic <table BORDER COLS=6> <tr> <td COLSPAN="6">eg.ArithmeticFixture</td> </tr> <tr> <td>x</td> <td>y</td> <td>+</td> <td>-</td> <td>*</td> <td>/</td> </tr> <tr> <td>4</td> <td>2</td> <td>6</td> <td>2</td> <td>8</td> <td>1</td> </tr> </table> </body> </html> <h1>Integer Arithmetic</h1>

  18. HTML Driver File Test Header and fixture <html> <body> <h1>Integer Arithmetic</h1> <p>Basic Arithmetic <table BORDER COLS=6> <tr> <td COLSPAN="6">eg.ArithmeticFixture</td> </tr> <tr> <td>x</td> <td>y</td> <td>+</td> <td>-</td> <td>*</td> <td>/</td> </tr> <tr> <td>4</td> <td>2</td> <td>6</td> <td>2</td> <td>8</td> <td>1</td> </tr> </table> </body> </html> <p>Basic Arithmetic <table BORDER COLS=6> <tr> <td COLSPAN="6">eg.ArithmeticFixture</td> </tr> . . . </table>

  19. HTML Driver File Parameter Headers <html> <body> <h1>Integer Arithmetic</h1> <p>Basic Arithmetic <table BORDER COLS=6> <tr> <td COLSPAN="6">eg.ArithmeticFixture</td> </tr> <tr> <td>x</td> <td>y</td> <td>+</td> <td>-</td> <td>*</td> <td>/</td> </tr> <tr> <td>4</td> <td>2</td> <td>6</td> <td>2</td> <td>8</td> <td>1</td> </tr> </table> </body> </html> <tr> <td>x</td> <td>y</td> <td>+</td> <td>-</td> <td>*</td> <td>/</td> </tr>

  20. HTML Driver File Parameters <html> <body> <h1>Integer Arithmetic</h1> <p>Basic Arithmetic <table BORDER COLS=6> <tr> <td COLSPAN="6">eg.ArithmeticFixture</td> </tr> <tr> <td>x</td> <td>y</td> <td>+</td> <td>-</td> <td>*</td> <td>/</td> </tr> <tr> <td>4</td> <td>2</td> <td>6</td> <td>2</td> <td>8</td> <td>1</td> </tr> </table> </body> </html> <tr> <td>4</td> <td>2</td> <td>6</td> <td>2</td> <td>8</td> <td>1</td> </tr>

  21. HTML Driver File

  22. Java Fixture package eg; import fit.*; public class ArithmeticFixture extends PrimitiveFixture { int x=0; int y=0; public void doRows(Parse rows) { super.doRows(rows.more); // skip column heads } public void doCell(Parse cell, int column) { switch (column) { case 0: x = (int)parseLong(cell); break; case 1: y = (int)parseLong(cell); break; case 2: check(cell, x+y); break; case 3: check(cell, x-y); break; case 4: check(cell, x*y); break; case 5: check(cell, x/y); break; default: ignore(cell); break; } } }

  23. Easy to run To use Fit on your own project use the following command-line: java -classpath fit.jar fit.FileRunner input.html output.html e.g. java -classpath fit.jar fit.FileRunner JavaArith.html results.html You'll see this message: 3 right, 1 wrong, 0 ignored, 0 exceptions

  24. Test Output

  25. Output Exceptions Parameters Right Wrong

  26. User Friendly? Command line – is not Need a GUI or something similar FitNesse – Wiki based Jdeveloper Eclipse

  27. HTML Driver Java Fixture HTML Output Explorer view of tests/results HTML Editor Results

  28. HTML viewer

  29. Java Editor

  30. Other Enhancements • Interact with Oracle • Call procedures/functions (standalone or in packages) • Scalar parameters • Ref Cursors • Run a folder at a time (groups of tests) • Easy to use • Flexible environment • MI

  31. Interact with Oracle “Out of the box” framework doesn’t support non-java calls DBFit can connect to various databases Extended with own code to provide a flexible solution

  32. HTML Driver File <html> <body> <table align="right"> <tr> <td>fixtures.PackageTester</td> </tr> </table> <h1>Test pck_sample1</h1> <p>Test Case l</p> <table border="1"> <tr> <td>call procedure</td> <td>fit_sample1.p_call_1</td> </tr> <tr> <td>Iterations IN</td> <td>Output OUT</td> </tr> <tr> <td>1</td> <td>Hello World</td> </tr> </table> </body> </html> <td>fixtures.PackageTester</td> <td>call procedure</td> <td>fit_sample1.p_call_1</td>

  33. RL definition of a fixture: • Acts as a conduit from the test to the application • Handles parameter translation • Provides a “success” indicator PLSQL Fixture CREATE OR REPLACE PACKAGE BODY fit_sample1 IS PROCEDURE p_call_1(pn_number IN NUMBER ,pv_output OUT VARCHAR2 ,pv_success OUT VARCHAR2) IS BEGIN pv_success := 'FAILED'; pck_sample1.p_call_1(pn_number => pn_number ,pv_output => pv_output); pv_success := 'PASSED'; END p_call_1; END fit_sample1;

  34. Ref Cursors - definition <table border="1"> <tr> <td>call function</td> <td>fit_table.f_get_data</td> <td>with ref cursor return</td> </tr> <tr> <td>ref_cursor_col1</td> <td>ref_cursor_col2</td> <td>ref_cursor_col3</td> </tr> <tr> <td>Success OUT</td> </tr> <tr> <td>PASSED</td> </tr> </table> <html> <body> <table align="right"> <tr><td>fixtures.PackageTester</td></tr></table> <h1>Test Ref Cursor Fetch</h1> <p>Test Case l</p> <table border="1"> . . . </table> <table border="1"> . . . </table> </body> </html> Function to call Note extra instruction Columns in the ref cursor Normal parameters

  35. Ref Cursors - definition <table border="1"> <tr> <td>ref cursor output</td> </tr> <tr> <td>ref_cursor_col1</td> <td>ref_cursor_col2</td> <td>ref_cursor_col3</td> </tr> <tr> <td>ROW1</td> <td>1</td> <td>12 Mar 2008</td> </tr> <tr> <td>ROW2</td> <td>2</td> <td>13 Mar 2008</td> </tr> <tr> <td>ROW3</td> <td>4</td> <td>14 Mar 2008</td> </tr> </table> <html> <body> <table align="right"> <tr><td>fixtures.PackageTester</td></tr></table> <h1>Test Ref Cursor Fetch</h1> <p>Test Case l</p> <table border="1"> . . . </table> <table border="1"> . . . </table> </body> </html> Cursor definition 1 row in the table per row expected

  36. Ref Cursors – plsql FUNCTION f_get_data(pv_success OUT VARCHAR2) RETURN SYS_REFCURSOR IS lcu_cursor SYS_REFCURSOR; BEGIN OPEN lcu_cursor FOR 'SELECT ref_cursor_col1,ref_cursor_col2,ref_cursor_col3 FROM datatest ORDER BY ref_cursor_col1 DESC'; pv_success := 'PASSED'; RETURN lcu_cursor; EXCEPTION WHEN OTHERS THEN pv_success := SQLERRM; END f_get_data; Data INSERT INTO datatest (ref_cursor_col1 ,ref_cursor_col2 ,ref_cursor_col3) VALUES ('ROW1' ,'1' ,'12 MARCH 2008'); INSERT INTO datatest (ref_cursor_col1 ,ref_cursor_col2 ,ref_cursor_col3) VALUES ('ROW2' ,'2' ,'13 MARCH 2008'); INSERT INTO datatest (ref_cursor_col1 ,ref_cursor_col2 ,ref_cursor_col3) VALUES ('ROW3' ,'4' ,'14 MARCH 2008');

  37. Ref Cursor Data SELECT ref_cursor_col1 ,ref_cursor_col2 ,ref_cursor_col3 FROM datatest ORDER BY ref_cursor_col1 DESC;

  38. Ref Cursor Output Note the order of the data – it is in the order we specified in the test NOT the order that PLSQL returned

  39. Other Enhancements • Interact with Oracle • Call packages and functions • Scalar parameters • Ref Cursors • Run a folder at a time • Easy to use • Flexible environment • MI

  40. Run a folder at a time • Picks up tests for folder • Runs them one at a time • Reports results for each test and a summary for the folder

  41. Run a folder at a time Scripts in folder Tests

  42. Other Enhancements • Interact with Oracle • Call packages and functions • Scalar parameters • Ref Cursors • Run a folder at a time • Easy to use • Flexible environment • MI

  43. Easy to Use • Testers write the test scripts (in HTML) or generate test scripts using ExcelThis makes cloning the script for different scenarios as simple as keying the input data and expected results into the spreadsheet • Agreement on approach up front • Testing primarily done by test and business analysts • Programmers write the fixtures in PLSQL • Test data centrally stored, is easily cloned and altered. • Template driven test script

  44. Test Script Flow This ensures a script is testing what we want,we have to empty any data from previousscripts Delete data Load in test data Prepare the start-point of the test we are running Run code In the case of functions, we can do these in one. Some tests will require that we run something, then display the results afterwards Check results

  45. Other Enhancements • Interact with Oracle • Call packages and functions • Scalar parameters • Ref Cursors • Run a folder at a time • Easy to use • Flexible environment • MI

  46. Flexible environment • Two distinct types of clients • Developers & Projects • Automatic “continuous” • Environment needs to be easy built and maintained • Need to consider code and data • Easily built • Self contained

  47. Developer/Project Environment schema Datastore HTML Scripts HTML Output Schema Build Process

  48. Automatic “continuous” Environment schema schema schema schema HTML Scripts Datastore HTML Output Schema Update Process

  49. Automatic “continuous” Environment Maintained as part of the normal shipping process Schema set up matches production Locked down Runs different suites of tests Centrally reported Managed by Test Hub

  50. Datastore Contains two types of data Static business data Policy/Scheme test data Repository of data to allow repeatable tests Can be updated/cloned to meet testing needs

More Related