From 3ea22f0862df03f36e780e5ae36e619935d310d0 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Mon, 25 Oct 2010 14:14:56 +0000 Subject: [PATCH] Starts adding semi-automatic tests git-svn-id: trunk@27856 - --- .gitattributes | 2 ++ test/runtestsgui.lpi | 14 ++++++++-- test/runtestsgui.lpr | 2 +- test/semiauto/idesemiautotests.pas | 42 ++++++++++++++++++++++++++++++ test/semiauto/semiautotest.pas | 32 +++++++++++++++++++++++ test/testglobals.pas | 9 +++++++ test/testunits.pas | 4 ++- 7 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 test/semiauto/idesemiautotests.pas create mode 100644 test/semiauto/semiautotest.pas diff --git a/.gitattributes b/.gitattributes index 13dd66805b..6c7b4fc52b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5460,6 +5460,8 @@ test/runtests.lpi svneol=native#text/plain test/runtests.lpr svneol=native#text/plain test/runtestsgui.lpi svneol=native#text/plain test/runtestsgui.lpr svneol=native#text/plain +test/semiauto/idesemiautotests.pas svneol=native#text/pascal +test/semiauto/semiautotest.pas svneol=native#text/pascal test/testglobals.pas svneol=native#text/plain test/testlpi.pas svneol=native#text/plain test/testresult-db/createdb.sql svneol=native#text/plain diff --git a/test/runtestsgui.lpi b/test/runtestsgui.lpi index a258948ee1..404be702d6 100644 --- a/test/runtestsgui.lpi +++ b/test/runtestsgui.lpi @@ -40,7 +40,7 @@ - + @@ -86,13 +86,23 @@ + + + + + + + + + + - + diff --git a/test/runtestsgui.lpr b/test/runtestsgui.lpr index 5e1606d0fb..c8fe46c3ea 100644 --- a/test/runtestsgui.lpr +++ b/test/runtestsgui.lpr @@ -23,7 +23,7 @@ program runtestsgui; uses Interfaces, Forms, GuiTestRunner, - testunits; + testunits, idesemiautotests, semiautotest; begin Application.Title:='Run Lazarus tests'; diff --git a/test/semiauto/idesemiautotests.pas b/test/semiauto/idesemiautotests.pas new file mode 100644 index 0000000000..377ce5354e --- /dev/null +++ b/test/semiauto/idesemiautotests.pas @@ -0,0 +1,42 @@ +unit idesemiautotests; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, fpcunit, + Interfaces, LCLType, LCLIntf, + testglobals, semiautotest; + +type + + { TTestIdeNew } + + TTestIdeNew = class(TSemiAutomaticTest) + published + procedure TestOne; + end; + +implementation + +{ TTestIdeNew } + +procedure TTestIdeNew.TestOne; +var + Str: string; +begin + Str := 'Please follow the following steps and mark if the test was successful:' + LineEnding + + '1> Open Lazarus' + LineEnding + + '2> Start a new Application project, but don''t save it' + LineEnding + + '3> Run this new project' + LineEnding + + 'Expected result> It should be saved to a temporary location and run or a message dialog should appear saying that the operation is impossible' + LineEnding + ; + AssertTrue(ShowResultDialog('TTestIdeNew.TestOne', Str)); +end; + +initialization + AddToSemiAutoTestSuite(TTestIdeNew); + +end. + diff --git a/test/semiauto/semiautotest.pas b/test/semiauto/semiautotest.pas new file mode 100644 index 0000000000..05d9c31fd5 --- /dev/null +++ b/test/semiauto/semiautotest.pas @@ -0,0 +1,32 @@ +unit semiautotest; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, fpcunit, + Interfaces, Forms, LCLType, + testglobals; + +type + + { TSemiAutomaticTest } + + TSemiAutomaticTest = class(TTestCase) + public + function ShowResultDialog(const ATitle, AInstructions: string): Boolean; + end; + +implementation + +{ TSemiAutomaticTest } + +function TSemiAutomaticTest.ShowResultDialog(const ATitle, AInstructions: string + ): Boolean; +begin + Result := Application.MessageBox(PChar(AInstructions), PChar(ATitle), MB_YESNO) = IDYES; +end; + +end. + diff --git a/test/testglobals.pas b/test/testglobals.pas index d68f89c651..7965fa618b 100644 --- a/test/testglobals.pas +++ b/test/testglobals.pas @@ -31,11 +31,13 @@ var PrimaryConfigPath: string; BugsTestSuite: TTestSuite; LCLTestSuite: TTestSuite; + SemiAutoTestSuite: TTestSuite; // reads the output from a process and puts it in a memory stream function ReadOutput(AProcess:TProcess): TStringList; procedure AddToBugsTestSuite(ATest: TTest); procedure AddToLCLTestSuite(ATestClass: TClass); +procedure AddToSemiAutoTestSuite(ATestClass: TClass); implementation @@ -98,12 +100,19 @@ begin LCLTestSuite.AddTestSuiteFromClass(ATestClass); end; +procedure AddToSemiAutoTestSuite(ATestClass: TClass); +begin + SemiAutoTestSuite.AddTestSuiteFromClass(ATestClass); +end; + initialization GetTestRegistry.TestName := 'All tests'; BugsTestSuite := TTestSuite.Create('Bugs'); GetTestRegistry.AddTest(BugsTestSuite); LCLTestSuite := TTestSuite.Create('LCL tests'); GetTestRegistry.AddTest(LCLTestSuite); + SemiAutoTestSuite := TTestSuite.Create('Semi Automatic tests'); + GetTestRegistry.AddTest(SemiAutoTestSuite); end. diff --git a/test/testunits.pas b/test/testunits.pas index 1531ef85d0..e65d6a333d 100644 --- a/test/testunits.pas +++ b/test/testunits.pas @@ -30,7 +30,9 @@ uses TestLpi, BugTestCase, bug8432, testfileutil, testfileproc, // lcltests - testunicode, testpen; + testunicode, testpen, + // semi-automatic tests + semiautotests, idesemiautotests; implementation