Bill, and any others,

This is a continuation from where I left off in the ooRexxUnit 3.2.0
Snapshot 02 thread.

We looked at this, which I said was the heart of a test case:

::method "test_MULTIPLE_INHERITANCE_WITH_MULTIPLE_METACLASSES"

  self~assertEquals("'123.'", .class123~info)

So, let's write our own test case.  Say we want to test that the
interpreter is adding 2 + 3 correctly.  We expect our test case either
to show that the interpreter is adding 2 + 3 correctly or that it is
not.

To write a test case, it has to be in a method, which always starts as follows:

::method

That is boilerplate, just type it.  Then the next key thing is that
the framework executes each method whose name begins with 'test', case
not significant as a test case.  We need to name the test case method
so we do this:

::method test_simpleAddition

That's boilerplate, make up a name start it with test.  I usually add
the underscore, but it is not needed.

What's the test?  We know that 2 + 3 is 5, so if the interpreter adds
2 + 3 we would expect the result to be 5.  We write some code that
adds 2 + 3 and then assert that the result is 5:

::method test_simpleAdditon

  val = 2 + 3
  self~assertEquals(5, val)

That is all there is to it.  The framework takes care of all the details.

Well there is a little more to it, we need to add the test case
methods to a file, I'll have to show that tomorrow.

To get started, think of ::method as a function  think of
self~assertEquals as a function with a prefix of 'self~'  and we'll
worry about learning about classes some other time.  This is enough to
write test cases.

--
Mark Miesfeld

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to