Forum OpenACS Development: Doubt in testing methodology

Collapse
Posted by Gerardo Morales on
Hello evrybody, I have a doubt about how is the correct way to solve a problem about testing with tclwebtest.

We are writing diferent test cases and want to give independency to each test for example that the case "post a new message" is totaly independent of the case "edit the forum name".

My doubt is the next one, we have a testcase (1) "create a new forum" and the testcase (2) "posting a message to the forum" but, for the testcase (2) I need to create a forum first. And I do not want to have redundance of code and write the same code in each aa_register_case .

What I did to avoid this is to have another file in wich are procedures of tclwebtest (for example to create a new forum) and in the aa_register_case just call this procedure.

Is this the right way to do it?

Thanks!

Collapse
Posted by Gerardo Morales on
Hi, we are developping test in tclwebtest as a part of the e-lane project. We have finished some tests, we have been testing on 5.1 but I don't know if is better to commit this new code in the branch 5-1, 5-2 or in Head.

I think that the better is to commit it in Head.

Any sugestion?

Collapse
Posted by Rocael Hernández Rizzardini on
Commit to oacs-5-1 since that will help for the next .LRN and e-lane releases. Move to the other branches will be relatively easy afterwards. Anyway, depends on which package you are talking about, since some of them their stable releases are at oacs-5-2.
Collapse
Posted by Gerardo Morales on
Thaks Rocael, wi will commit in this branch
Collapse
Posted by Rocael Hernández Rizzardini on
> I do not want to have redundance of code and write the same code in each aa_register_case .

I guess you haven't found it yet, if not I assume you would have the decency to post your discovery here.

First, look at this: aa_register_init_class, "Registers a initialisation class to be used by one or more testcases. An initialisation class can be assigned to a testcase via the aa_register_case proc."

Also, useful stuff is to:
Use aa_register_component: "Registers a re-usable code component"

And then call it at your test case using: aa_call_component

Next time, at least spend some time searching the aa_* API, and grep /packages/, like /news that has some good examples, there are more than 4000 test cases in openacs to use as guidance...

More info here: https://openacs.org/doc/openacs-5-1/tutorial-debug.html