• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5911: Unit tests must work with trunk and TWikiRelease04x02

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension UnitTestContrib Urgent Closed   n/a  

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


Currently, unit tests work only with trunk code. It should work with both TWikiRelease04x02 and trunk (and also with older versions).

-- TWiki:Main/GilmarSantosJr - 10 Aug 2008

I added an abstraction layer composed of two classes: Unit::Request and Unit::Response. Tests should use theses instead of CGI and TWiki::Request, so the test works with both 4.x and trunk code.

I also added two fields in TWikiFnTestCase: request and response, so derived classes can always use $this->{request} and $this->{response}.

Calls to Unit::Response::new must be made after calling TWiki::new.

I tested with trunk and TWikiRelease04x02. There were some errors with the last: tests that verify new features added to trunk. This is not critical, since test compatibility must exist to test plugins and not core code.

I'll update documentation before close this item.

-- TWiki:Main.GilmarSantosJr - 18 Aug 2008

trunk is almost done and default plugins almost all updated. I need to update TWiki:Codev.TestCasesTutorial, but first I don't know if I should commit changes to TWikiRelease04x02 branch.

I'm concerned with plugin developers: they should be able to test their plugins with trunk and other releases. To test a plugin with trunk and 4.2, for example, it's needed to take UnitTestContrib from trunk to test with 4.2, what makes me think that changes should be committed to TWikiRelease04x02, but then it should be ported to all earlier versions that support tests...

What do you think?

-- TWiki:Main.GilmarSantosJr - 29 Sep 2008

We had a talk at twiki-dev mailing list:


   Since a while I'm working on "Item5911: Unit tests must work with trunk and 

   I think it's done: there is Unit::Request and Unit::Response classes, that 
   just work with trunk and older releases. Calls to "new CGI"  must be replaced 
   by "new Unit::Request". charset method must be called after "new TWiki" 
   and "new Unit::Response" (before, it was called like $cgi->charset, and now 
   it must be called $response->charset).

   The main pourpose of this work is to ease plugin tests with different TWiki 
   releases. So, my question is: should I commit changes made to UnitTestContrib 
   to TWikiRelease04x02 AND all older releases? There is a little problem with 
   this approach: there are new core unit tests that will fail (they test new 
   features). But for the sole pourpose of testing plugins it will work.


   Ah, this old problem.

   The requirement for single-branch extension development means we do extension
   development in the trunk only, and that in turn means we usually only run
   extension unit tests against the core in trunk. The obvious exception to this
   is the set of core extensions, which includes UnitTestContrib. These
   extensions must be testable against the core they are tagged with. That means
   the UnitTestContrib checked into TWikiRelease04x02 must run clean against
   04x02. It would be unacceptable to introduce test failures to this code. So,
   either the tests of the new features has to be made conditional on the TWiki
   version, or the UnitTestContrib should be checked into the trunk only.

   I think you should check your UnitTestContrib changes in to trunk only.

   Of course for plugins outside the core set, unit tests may already have been
   recoded to use TWiki::Response. Those unit tests have to be fixed so that pass
   against 04x02. The obvious thing to do is to make sure they know about
   TWiki::Response and behave appropriately if it isn't there. e.g.

   if (require TWiki::Response) |{
       $query = new Unit::Request({...});
   } else {
       $query = new CGI({...});

So, I think it's done. I also updated TWiki:Codev.TestCasesTutorial.

Summary Unit tests must work with trunk and TWikiRelease04x02
ReportedBy TWiki:Main.GilmarSantosJr
Codebase ~twiki4
SVN Range TWiki-5.0.0, Sun, 03 Aug 2008, build 17280
AppliesTo Extension
Component UnitTestContrib
Priority Urgent
CurrentState Closed

Checkins TWikirev:17427 TWikirev:17528 TWikirev:17529 TWikirev:17549 TWikirev:17550 TWikirev:17567 TWikirev:17568 TWikirev:17569 TWikirev:17570
TargetRelease n/a

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r15 - 2010-10-12 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback