1 / 18

Exercises Sample Application

Exercises Sample Application. Foreign Cash Exchange. Overview. Exercises Overview. Exercise 13. Homework: For the example scenario "Foreign Cash Exchange" develop an UML class diagram See description on next slides or in chapter 2 Work in groups of two (or three)

dara-dodson
Download Presentation

Exercises Sample Application

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. Exercises Sample Application Foreign Cash Exchange

  2. Overview

  3. Exercises Overview

  4. Exercise 13 • Homework: For the example scenario "Foreign Cash Exchange" develop an UML class diagram • See description on next slides or in chapter 2 • Work in groups of two (or three) • Explain your solution to the class • Discuss the presented solution

  5. Description Foreign Cash Exchange

  6. Description Foreign Cash Exchange (cont.)

  7. Description Foreign Cash Exchange (cont.)

  8. Branch and ATM Class Model FCE.ATM FCE.Branch Brand Type SerialNr Address CurrencyBalances Name Address Phone Opens Closes ATMs 0..* Branch 1

  9. How To: Create a Unit Test Class • Create new class that extends %UnitTest.TestCase. • Each class represents a test case. • Add methods named Test*. • Write test code. • Use macros to make assertions. • Add additional methods not named Test* for control or other purposes.

  10. How To: Create a Unit Test Class (cont.) • Write set up and tear down methods when necessary.

  11. How To: Create a Unit Test Class (cont.) • Compile class. • Optionally, export class (or classes) as XML file to subfolder of root testing folder. • Each subfolder of root testing folder represents a test suite. • Allows test classes to be loaded, compiled, run, and deleted in another namespace.

  12. How To: Run Unit Tests • Run tests using %UnitTest.Manager class. do ##class(%UnitTest.Manager).RunTest(TestSpec,Qualifiers) • To run one test case (without XML file): • Arguments: • TestSpec = "TestSuiteFolder:TestCaseClass" • Qualifiers = "/noload/norecursive" • Without XML file, TestSuiteFolder is “organizational” only; used to navigate test results in browser. • Convention: same as TestCaseClass.

  13. How To: Run Unit Tests (cont.) • Run tests using %UnitTest.Manager class. do ##class(%UnitTest.Manager).RunTest(TestSpec,Qualifiers) • To load an XML file, compile all its classes, run all tests, and delete all classes: • Argument: • TestSpec = "TestSuiteFolder" • Before running test, must also specify root folder for unit testing. set ^UnitTestRoot = "PathToContainingFolder"

  14. ObjectScript Macros • Macro: named piece of ObjectScript code, usually defined at top of method. #define sum x+y • Macro may take arguments (%* variables). #define sumplusextra(%extra) x+y+%extra • When writing method, use macro by preceding name with $$$. set x=4, y=5, s=$$$sum, b=$$$sumplusextra(6) • Compiler replaces macro with code. set x=4, y=5, s=x+y, b=x+y+6

  15. Include (INC) files • File containing several #define statements. For example, helper.inc: #define sum x+y #define sumplusextra(%extra) x+y+%extra • Including file in class definitions provides all macros. • Use IncludeCode attribute of class, or enter aboveClass statement. include helper • Include file may contain #include statements to include other files.

  16. Unit Testing Macros

  17. Unit Testing Macros (cont.)

  18. Exercise 14 Description: As class … • define specification for class Branch • create unit test class for initial FCE application • define OOP unit tests for Branch (demonstration) In your team … • define specification for class ATM • define OOP unit tests for ATM

More Related