Presentation is loading. Please wait.

Presentation is loading. Please wait.

Occasion: Date: Present: Classification: Unit testing frameworks for OpenEdge Comparison between ProUnit and OEUnit. ABL Unit in OpenEdge 11.4 Mihai Pintea.

Similar presentations


Presentation on theme: "Occasion: Date: Present: Classification: Unit testing frameworks for OpenEdge Comparison between ProUnit and OEUnit. ABL Unit in OpenEdge 11.4 Mihai Pintea."— Presentation transcript:

1 Occasion: Date: Present: Classification: Unit testing frameworks for OpenEdge Comparison between ProUnit and OEUnit. ABL Unit in OpenEdge 11.4 Mihai Pintea Mihai.Pintea@tss-yonder.com

2 2 Agenda ProUnit vs OEUnit ABLUnit starting 11.4 What is Unit testing

3 3 Traditional Development Life Development Test Delivery Testers write the test Fail

4 4 Unit Testing ●Unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures are tested to determine if they are fit for use. ●Tests written by Developers. ●Test run as integral part of Development Benefits of Unit Testing ●Find problems early ●Easier to locate bugs ●Facilitate change ●Document units ●Writing tests clarifies design

5 5 Unit Testing Considerations ●Time consuming and expensive ●Not practical to test everything ●Extra code to maintain, however: Tests often are small Payback: need to do some changes quickly ●Needs team adoption Need to be able to trust the tests ●Needs a unit testing Framework

6 6 Initial Unit Test Frameworks for OpenEdge Unit test frameworks ProUnit OEUnit

7 7 Installing ProUnit and OEUnit ProUnit installation: ●http://prounit.sourceforge.nethttp://prounit.sourceforge.net ●uncompressing the file in a directory of your choice ●add full path to prounit_dlcXX.pl to the PROPATH ●in case of client/AppServer usage, you should add prounit_dlcXX.pl to PROPATH for both client and AppServer OEUnit installation: ●https://github.com/Camero nWills/OEUnithttps://github.com/Camero nWills/OEUnit ●Uncompressing the file in a directory of your choice ●Add an entry to PROPATH pointing to the \src ●Add the -errorstack startup parameter

8 8 Running ProUnit and OEUnit Running ProUnit: ●run startProUnitGUI.p. Running OEUnit ●Add a Menu Action to OpenEdge Architect ●right-click to open the context menu from the ABL Editor

9 9 Writing a Test Case ProUnit: ●A Test Case is just a Progress ABL (4GL) file that follows some simple rules about how to name the internal procedures ●Example simpletest.p OEUnit: ●A test case is a class containing one or more Test methods. Example: ROUTINE-LEVEL ON ERROR UNDO, THROW. USING OEUnit.Assertion.Assert. CLASS SimpleTest: @Test. METHOD PUBLIC VOID IntegerTest(): DEFINE VARIABLE myInt AS INTEGER NO-UNDO. Assert:AreEqual(myInt,0). END METHOD. END CLASS. PROCEDURE testSimpleTest: DEFINE VARIABLE myInt AS INTEGER NO-UNDO. RUN assertEqualsInt(myInt,0). END.

10 10 Writing a Test Suite ProUnit: ●ProUnit lets you arrange your tests using Test Sets. OEUnit: ●A test suite is a class that contains a list of test cases and/or other test suites. Test suites are useful for grouping and organizing test cases. Example: ROUTINE-LEVEL ON ERROR UNDO, THROW. CLASS SimpleSuite INHERITS OEUnit.Runner.TestSuite: CONSTRUCTOR SimpleSuite(): AddTest(NEW SimpleTest()). AddTest(NEW SimpleTest1()). END CONSTRUCTOR. END CLASS.

11 11 ProUnit saving results ●ProUnit provides a very extensible and customizable report engine based on XML and XSLT that make it possible to change completely the report format (adding logos, changing fonts, etc), create multiple styles or saving plain XML files to be imported into a database. ●ProUnit allow you to save results in many forms: XML with SLST JUnit XML CSV file Plain text file with indentation

12 12 ABLUnit

13 13 ABL Unit Framework ●ABLUnit is a simple yet powerful unit testing framework for testing ABL programs. ●ABLUnit is similar with OEUnit ●No installation needed because is integrated on OpenEdge 11.4 ●Run in OpenEdge ABLUnit perspective

14 14 ABLUnit test case ABLUnit: ●Similar with OEUnit, a test case is a class containing one or more Test methods. ABLUnit: OEUnit: ROUTINE-LEVEL ON ERROR UNDO, THROW. USING Progress.Lang.*. USING OpenEdge.Core.Assert. CLASS SimpleTest: @Test. METHOD PUBLIC VOID IntegerTest(): DEFINE VARIABLE myInt AS INTEGER NO-UNDO. Assert:equals(myInt,0). END METHOD. END CLASS. ROUTINE-LEVEL ON ERROR UNDO, THROW. USING OEUnit.Assertion.Assert. CLASS SimpleTest: @Test. METHOD PUBLIC VOID IntegerTest(): DEFINE VARIABLE myInt AS INTEGER NO-UNDO. Assert:AreEqual(myInt,0). END METHOD. END CLASS.

15 15 ABLUnit vs OEUnit vs ProUnit ABLUnitOEUnitProUnit File type support Supports class and procedure Supports only classSupports only procedure AnnotationsRequired: - Before - Setup - Test - TearDown - Ignore - After Required: - BeforeClass - Before - After - Test - Ignore - AfterClass Doesn’t require annotations. - Initialize - setup test - teardown - dispose Nightly Builds Yes (Provided ANT task) -Can be used with PCT ANT Task GUIPDS OECan be embedded into PDSOE Desktop App Command Line YesNoYes

16 16 ABLUnit vs OEUnit vs ProUnit ABLUnitOEUnitProUnit ResultsSeparate view is provided. - Navigate to failures - Rerun tests - View history of last 10 results - View only failures - Go to test code Pluggable view is provided to show unit test. Summary in tree structure provided Import results Imported by ABLUnit, JUnit, Jenkins No option available to import Export results No custom export options. No export option - XML with SLST - JUnit XML - CSV file - Plain text file with indentation

17 17 Conclusions ●Benefits of using unit test: find problems early, easier to locate bugs, writing tests clarifies design. ●Unit tests considerations: time consuming and expensive, extra code to maintain, needs team adoption, needs a unit testing Framework ●Unit testing for Open Edge: ProUnit is helpful when creating unit tests for procedural applications OEUnit is very helpful when creating unit tests for OOP applications ABLUnit built in unit testing framework starting progress 11.4

18 18 Q&A


Download ppt "Occasion: Date: Present: Classification: Unit testing frameworks for OpenEdge Comparison between ProUnit and OEUnit. ABL Unit in OpenEdge 11.4 Mihai Pintea."

Similar presentations


Ads by Google