Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-09

fpcUnit demo error

9 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ram�

People, just found an error in the consolerunner/testrunner.pp demo application. It's constructor and destrutor differs from the frameworktest sample in the tests directory.

The correct methods are:

constructor TTestRunner.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FXMLResultsWriter := TXMLResultsWriter.Create;
  FSuite := TTestSuite.Create;
  FSuite.TestName := 'Framework test';
  FSuite.AddTestSuiteFromClass(TAssertTest);
  FSuite.AddTest(TSuiteTest.Suite());
end;
destructor TTestRunner.Destroy;
begin
  FXMLResultsWriter.Free;
  FSuite.Free;
end;

Leonardo M. Ramé
http://leonardorame.blogspot.com

__________________________________________________ Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Reply by email

Dean Zobec
to Leonardo M. Ram�

Leonardo M. Ramé ha scritto:

Show quoted text 20 lines
People, just found an error in the consolerunner/testrunner.pp demo application. It's constructor and destrutor differs from the frameworktest sample in the tests directory. The correct methods are: constructor TTestRunner.Create(AOwner: TComponent); begin inherited Create(AOwner); FXMLResultsWriter := TXMLResultsWriter.Create; FSuite := TTestSuite.Create; FSuite.TestName := 'Framework test'; FSuite.AddTestSuiteFromClass(TAssertTest); FSuite.AddTest(TSuiteTest.Suite()); end; destructor TTestRunner.Destroy; begin FXMLResultsWriter.Free; FSuite.Free; end;

No, this is not an error, the test runner in the tests directory runs the tests of fpcunit itself, so it intentionally does not use the fpcunit automation to build the testcases through the methods in the testregistry unit. In fact in the constructor the TTestSuite is built manually. Sometimes you have to act this way (e.g. where you need some parameterized test cases).
Whereas the test runner in the demo directory uses the registration mechanism to build the test cases. But there IS an error in the testrunner in the demo directory, the unit testreport was substituted with the new xmlreporter that lacks some methods used by the runner. For Vincent: what if we simply use here your text test runner in the lazarus/test directory? I'll prepare a patch.
Ciao, Dean

Reply by email

Graeme Geldenhuys
to Dean Zobec
Dean Zobec wrote 6 lines
mechanism to build the test cases. But there IS an error in the testrunner in the demo directory, the unit testreport was substituted with the new xmlreporter that lacks some methods used by the runner. For Vincent: what if we simply use here your text test runner in the lazarus/test directory? I'll prepare a patch. Ciao, Dean

Yes, after looking at the timing feature for fpcUnit, I played around with the Text Test runner (I normally use the GUI Runner) and notice that the Text Test Runner still produced the old xml format. I then switched back to the GUI Runner.

Never got time to get back at fixing this issue. Sorry, it slipped my mind.

Regards,
- Graeme -

Reply by email

Dean Zobec
to Dean Zobec: Leonardo M. Ramé ha scritto: No, this is not an error, the test runner in the tests…
Show quoted text 5 lines
But there IS an error in the testrunner in the demo directory, the unit testreport was substituted with the new xmlreporter that lacks some methods used by the runner. For Vincent: what if we simply use here your text test runner in the lazarus/test directory? I'll prepare a patch.

The attached patch fixes the console test runner demo. To be applied from the fpc/fcl/fpcunit/demo/consolerunner directory. It simply copies over the Vincent's console runner from the lazarus/test directory.
Regards,
Dean

Reply by email

Leonardo M. Ram�
to Dean Zobec: Leonardo M. Ramé ha scritto: No, this is not an error, the test runner in the tests…

Sorry, i thought frameworktest was the correct one.

--- Dean Zobec wrote 41 lines
Leonardo M. Ramé ha scritto: > People, just found an error in the consolerunner/testrunner.pp demo application. It's constructor > and destrutor differs from the frameworktest sample in the tests directory. > > The correct methods are: > > constructor TTestRunner.Create(AOwner: TComponent); > begin > inherited Create(AOwner); > FXMLResultsWriter := TXMLResultsWriter.Create; > FSuite := TTestSuite.Create; > FSuite.TestName := 'Framework test'; > FSuite.AddTestSuiteFromClass(TAssertTest); > FSuite.AddTest(TSuiteTest.Suite()); > end; > > destructor TTestRunner.Destroy; > begin > FXMLResultsWriter.Free; > FSuite.Free; > end; No, this is not an error, the test runner in the tests directory runs the tests of fpcunit itself, so it intentionally does not use the fpcunit automation to build the testcases through the methods in the testregistry unit. In fact in the constructor the TTestSuite is built manually. Sometimes you have to act this way (e.g. where you need some parameterized test cases). Whereas the test runner in the demo directory uses the registration mechanism to build the test cases. But there IS an error in the testrunner in the demo directory, the unit testreport was substituted with the new xmlreporter that lacks some methods used by the runner. For Vincent: what if we simply use here your text test runner in the lazarus/test directory? I'll prepare a patch. Ciao, Dean _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Leonardo M. Ramé
http://leonardorame.blogspot.com

__________________________________________________ Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

Reply by email

Graeme Geldenhuys
to Dean Zobec

Hi Dean,

While on the subject of fpcUnit...

Have you submitted the patch for GUI Runner with checkbox support? I remeber you email a select few to test it, but can't remember if it was officially submitted and maybe got missed in all the mail traffic. Reason I noticed, is because my work PC has it running and got so used to it. In the last week I setup a development pc at home, got the latest from SubVersion and the checkbox support wasn't there...

If you haven't had time yet, no problems, I can always grab the patches from my work pc.

Regards,
- Graeme -

Dean Zobec wrote 10 lines
Leonardo M. Ramé ha scritto: > Sorry, i thought frameworktest was the correct one. No problem, my fault, lack of documentation :) Thank you for reporting, Regards, Dean _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel
There's no place like 127.0.0.1

Reply by email

Dean Zobec
to Graeme Geldenhuys

Hi Graeme

Show quoted text 7 lines
While on the subject of fpcUnit... Have you submitted the patch for GUI Runner with checkbox support? I remeber you email a select few to test it, but can't remember if it was officially submitted and maybe got missed in all the mail traffic. Reason I noticed, is because my work PC has it running and got so used to it.

good, so at least it's tested ;)

Show quoted text 5 lines
In the last week I setup a development pc at home, got the latest from SubVersion and the checkbox support wasn't there... If you haven't had time yet, no problems, I can always grab the patches from my work pc.

No, I just waited for the Lazarus release with 2.0.4 fpc as it needs the last changes in the fpc tree (the list of skipped tests) and I hate ifdefs :).
I've discussed with Vincent for another addition:
an Ignore(const aMessage: string); method that will enable a temporary ignore of a test (at compile time) and send a message to remind the future need of implementation, coloring the tests yellow as in NUnit. I'll probably implement it this weekend.
Regards,
Dean

Reply by email

Graeme Geldenhuys
to Dean Zobec
Dean Zobec wrote
No, I just waited for the Lazarus release with 2.0.4 fpc as it needs the last changes in the fpc tree (the list of skipped tests) and I hate ifdefs :).

Ah yes, I rememeber that now. We had to rush to get certain patches in before 2.0.4.

I'll probably implement it this weekend.

No problem, take your time... Just wanted to make sure a patch wasn't missed by any chance.

Regards,
- Graeme -

Reply by email