You've already forked lazarus-ccr
first import
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
2142
wst/trunk/tests/test_suite/testformatter_unit.pas
Normal file
2142
wst/trunk/tests/test_suite/testformatter_unit.pas
Normal file
File diff suppressed because it is too large
Load Diff
153
wst/trunk/tests/test_suite/testmetadata_unit.pas
Normal file
153
wst/trunk/tests/test_suite/testmetadata_unit.pas
Normal file
@ -0,0 +1,153 @@
|
||||
{
|
||||
This file is part of the Web Service Toolkit
|
||||
Copyright (c) 2006 by Inoussa OUEDRAOGO
|
||||
|
||||
This file is provide under modified LGPL licence
|
||||
( the files COPYING.modifiedLGPL and COPYING.LGPL).
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
}
|
||||
|
||||
unit testmetadata_unit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, DOM, XMLWrite,
|
||||
fpcunit, testutils, testregistry,
|
||||
metadata_generator, binary_streamer, metadata_repository, parserdefs,
|
||||
metadata_wsdl;
|
||||
|
||||
type
|
||||
|
||||
{ TTestMetadata }
|
||||
|
||||
TTestMetadata= class(TTestCase)
|
||||
protected
|
||||
function CreateSymbolTable():TSymbolTable;
|
||||
published
|
||||
procedure test_Metadata();
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{ TTestMetadata }
|
||||
|
||||
function TTestMetadata.CreateSymbolTable(): TSymbolTable;
|
||||
Var
|
||||
inft : TInterfaceDefinition;
|
||||
begin
|
||||
Result := TSymbolTable.Create('test_unit_name');
|
||||
Result.Add(TTypeDefinition.Create('integer'));
|
||||
Result.Add(TTypeDefinition.Create('string'));
|
||||
Result.Add(TTypeDefinition.Create('double'));
|
||||
|
||||
inft := TInterfaceDefinition.Create('service_1');
|
||||
Result.Add(inft);
|
||||
inft.AddMethod('void_operation_proc',mtProcedure);
|
||||
inft.AddMethod('void_operation_func',mtProcedure).AddParameter('result',pmOut,Result.ByName('integer') as TTypeDefinition);
|
||||
|
||||
inft := TInterfaceDefinition.Create('service_2');
|
||||
Result.Add(inft);
|
||||
with inft.AddMethod('dis_proc',mtProcedure) do begin
|
||||
AddParameter('d',pmNone,Result.ByName('double') as TTypeDefinition);
|
||||
AddParameter('i',pmConst,Result.ByName('integer') as TTypeDefinition);
|
||||
AddParameter('s',pmOut,Result.ByName('string') as TTypeDefinition);
|
||||
end;
|
||||
with inft.AddMethod('sid_func',mtFunction) do begin
|
||||
AddParameter('s',pmConst,Result.ByName('string') as TTypeDefinition);
|
||||
AddParameter('i',pmVar,Result.ByName('integer') as TTypeDefinition);
|
||||
AddParameter('d',pmOut,Result.ByName('double') as TTypeDefinition);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure PrintWSDL(ARep : PServiceRepository);
|
||||
var
|
||||
locDoc : TXMLDocument;
|
||||
strm : TMemoryStream;
|
||||
s : string;
|
||||
begin
|
||||
strm := nil;;
|
||||
locDoc := TXMLDocument.Create();
|
||||
try
|
||||
GenerateWSDL(ARep,locDoc);
|
||||
strm := TMemoryStream.Create();
|
||||
WriteXMLFile(locDoc,strm);
|
||||
SetLength(s,strm.Size);
|
||||
Move(strm.Memory^,s[1],strm.Size);
|
||||
WriteLn('*******************************************************');
|
||||
WriteLn(s);
|
||||
WriteLn('*******************************************************');
|
||||
finally
|
||||
locDoc.Free();
|
||||
strm.Free();
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestMetadata.test_Metadata();
|
||||
var
|
||||
st : TSymbolTable;
|
||||
mg : TMetadataGenerator;
|
||||
wtr : IDataStore;
|
||||
strm : TMemoryStream;
|
||||
|
||||
rp : PServiceRepository;
|
||||
ps : PService;
|
||||
po : PServiceOperation;
|
||||
pop : POperationParam;
|
||||
begin
|
||||
strm := nil;
|
||||
mg := nil;
|
||||
rp := nil;
|
||||
st := CreateSymbolTable();
|
||||
try
|
||||
strm := TMemoryStream.Create();
|
||||
wtr := CreateBinaryWriter(strm);
|
||||
mg := TMetadataGenerator.Create(st,wtr);
|
||||
mg.Execute();
|
||||
wtr := nil;
|
||||
strm.Position := 0;
|
||||
|
||||
AssertTrue(strm.Size>10);
|
||||
AssertEquals('symbol count',2,LoadRepositoryData(strm,rp));
|
||||
AssertEquals('unit name','test_unit_name',rp^.Name);
|
||||
AssertEquals('services count',2,rp^.ServicesCount);
|
||||
AssertNotNull('services pointer',rp^.Services);
|
||||
|
||||
ps := rp^.Services;
|
||||
AssertEquals('service name','service_1',ps^.Name);
|
||||
AssertEquals('operations count',2,ps^.OperationsCount);
|
||||
AssertNotNull('operations pointer',ps^.Operations);
|
||||
po := ps^.Operations;
|
||||
AssertEquals('operation name','void_operation_proc',po^.Name);
|
||||
AssertEquals('params count',0,po^.ParamsCount);
|
||||
AssertNull('params pointer',po^.Params);
|
||||
Inc(po);
|
||||
AssertEquals('operation name','void_operation_func',po^.Name);
|
||||
AssertEquals('params count',1,po^.ParamsCount);
|
||||
AssertNotNull('params pointer',po^.Params);
|
||||
pop := po^.Params;
|
||||
AssertEquals('param name','result',pop^.Name);
|
||||
AssertEquals('param type name','integer',pop^.TypeName);
|
||||
AssertEquals('param modifier',ord(pmOut),ord(pop^.Modifier));
|
||||
|
||||
rp^.NameSpace := 'http://test_name_space/';
|
||||
//PrintWSDL(rp);
|
||||
finally
|
||||
mg.Free();
|
||||
st.Free();
|
||||
strm.Free();
|
||||
ClearRepositoryData(rp);
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterTest(TTestMetadata);
|
||||
|
||||
end.
|
501
wst/trunk/tests/test_suite/wst_test_suite.lpi
Normal file
501
wst/trunk/tests/test_suite/wst_test_suite.lpi
Normal file
@ -0,0 +1,501 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ActiveEditorIndexAtStart Value="6"/>
|
||||
</General>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<CommandLineParams Value="-a >E:\Inoussa\Sources\lazarus\wst\v0.3\tests\test_suite\obj\res.xml"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="FPCUnitTestRunner"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="46">
|
||||
<Unit0>
|
||||
<Filename Value="wst_test_suite.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="wst_test_suite"/>
|
||||
<CursorPos X="69" Y="11"/>
|
||||
<TopLine Value="9"/>
|
||||
<UsageCount Value="148"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="testformatter_unit.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="testformatter_unit"/>
|
||||
<CursorPos X="55" Y="66"/>
|
||||
<TopLine Value="150"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="148"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\server_service_soap.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="server_service_soap"/>
|
||||
<CursorPos X="20" Y="205"/>
|
||||
<TopLine Value="171"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="148"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\soap_formatter.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="soap_formatter"/>
|
||||
<CursorPos X="8" Y="97"/>
|
||||
<TopLine Value="86"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="148"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\base_binary_formatter.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="base_binary_formatter"/>
|
||||
<CursorPos X="39" Y="180"/>
|
||||
<TopLine Value="171"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="148"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\..\base_service_intf.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="base_service_intf"/>
|
||||
<CursorPos X="3" Y="106"/>
|
||||
<TopLine Value="121"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="148"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\base_soap_formatter.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="base_soap_formatter"/>
|
||||
<CursorPos X="1" Y="1082"/>
|
||||
<TopLine Value="1061"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="148"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="..\..\binary_formatter.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="binary_formatter"/>
|
||||
<CursorPos X="15" Y="44"/>
|
||||
<TopLine Value="33"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="148"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="..\..\binary_streamer.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="binary_streamer"/>
|
||||
<CursorPos X="32" Y="38"/>
|
||||
<TopLine Value="22"/>
|
||||
<UsageCount Value="148"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="..\..\server_binary_formatter.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="server_binary_formatter"/>
|
||||
<CursorPos X="5" Y="136"/>
|
||||
<TopLine Value="92"/>
|
||||
<UsageCount Value="148"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\fcl\fpcunit\fpcunit.pp"/>
|
||||
<UnitName Value="fpcunit"/>
|
||||
<CursorPos X="39" Y="66"/>
|
||||
<TopLine Value="66"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\fcl\fpcunit\testregistry.pp"/>
|
||||
<UnitName Value="testregistry"/>
|
||||
<CursorPos X="11" Y="29"/>
|
||||
<TopLine Value="35"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\objpas\typinfo.pp"/>
|
||||
<UnitName Value="typinfo"/>
|
||||
<CursorPos X="11" Y="216"/>
|
||||
<TopLine Value="230"/>
|
||||
<UsageCount Value="3"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\objpas\sysutils\sysstrh.inc"/>
|
||||
<CursorPos X="10" Y="137"/>
|
||||
<TopLine Value="127"/>
|
||||
<UsageCount Value="1"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\objpas\sysutils\sysstr.inc"/>
|
||||
<CursorPos X="23" Y="1007"/>
|
||||
<TopLine Value="1005"/>
|
||||
<UsageCount Value="1"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\inc\systemh.inc"/>
|
||||
<CursorPos X="65" Y="452"/>
|
||||
<TopLine Value="441"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\win32\system.pp"/>
|
||||
<UnitName Value="System"/>
|
||||
<CursorPos X="20" Y="1012"/>
|
||||
<TopLine Value="1011"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\fcl\inc\contnrs.pp"/>
|
||||
<UnitName Value="contnrs"/>
|
||||
<CursorPos X="3" Y="625"/>
|
||||
<TopLine Value="623"/>
|
||||
<UsageCount Value="1"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="..\..\metadata_repository.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="metadata_repository"/>
|
||||
<CursorPos X="3" Y="79"/>
|
||||
<TopLine Value="70"/>
|
||||
<UsageCount Value="123"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="D:\Lazarus\fpcsrc\rtl\objpas\typinfo.pp"/>
|
||||
<UnitName Value="typinfo"/>
|
||||
<CursorPos X="15" Y="579"/>
|
||||
<TopLine Value="565"/>
|
||||
<UsageCount Value="5"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="testmetadata_unit.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="testmetadata_unit"/>
|
||||
<CursorPos X="83" Y="119"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="116"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="..\..\ws_helper\metadata_generator.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="metadata_generator"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="31"/>
|
||||
<UsageCount Value="116"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="..\..\ws_helper\parserdefs.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="parserdefs"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="116"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="D:\Lazarus\fpcsrc\fcl\fpcunit\fpcunit.pp"/>
|
||||
<UnitName Value="fpcunit"/>
|
||||
<CursorPos X="21" Y="81"/>
|
||||
<TopLine Value="71"/>
|
||||
<UsageCount Value="2"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="D:\Lazarus\fpcsrc\fcl\fpcunit\testregistry.pp"/>
|
||||
<UnitName Value="testregistry"/>
|
||||
<CursorPos X="11" Y="29"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="3"/>
|
||||
</Unit24>
|
||||
<Unit25>
|
||||
<Filename Value="D:\Lazarus\fpcsrc\rtl\inc\heaph.inc"/>
|
||||
<CursorPos X="10" Y="87"/>
|
||||
<TopLine Value="61"/>
|
||||
<UsageCount Value="2"/>
|
||||
</Unit25>
|
||||
<Unit26>
|
||||
<Filename Value="D:\Lazarus\fpcsrc\rtl\inc\heap.inc"/>
|
||||
<CursorPos X="3" Y="235"/>
|
||||
<TopLine Value="223"/>
|
||||
<UsageCount Value="2"/>
|
||||
</Unit26>
|
||||
<Unit27>
|
||||
<Filename Value="D:\Lazarus\fpcsrc\rtl\objpas\classes\classesh.inc"/>
|
||||
<CursorPos X="3" Y="1248"/>
|
||||
<TopLine Value="1238"/>
|
||||
<UsageCount Value="2"/>
|
||||
</Unit27>
|
||||
<Unit28>
|
||||
<Filename Value="..\..\metadata_wsdl.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="metadata_wsdl"/>
|
||||
<CursorPos X="38" Y="148"/>
|
||||
<TopLine Value="142"/>
|
||||
<UsageCount Value="108"/>
|
||||
</Unit28>
|
||||
<Unit29>
|
||||
<Filename Value="D:\Lazarus\fpcsrc\fcl\xml\dom.pp"/>
|
||||
<UnitName Value="DOM"/>
|
||||
<CursorPos X="15" Y="429"/>
|
||||
<TopLine Value="413"/>
|
||||
<UsageCount Value="4"/>
|
||||
</Unit29>
|
||||
<Unit30>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\win32\classes.pp"/>
|
||||
<UnitName Value="Classes"/>
|
||||
<CursorPos X="14" Y="32"/>
|
||||
<TopLine Value="13"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit30>
|
||||
<Unit31>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\objpas\classes\classesh.inc"/>
|
||||
<CursorPos X="14" Y="149"/>
|
||||
<TopLine Value="138"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit31>
|
||||
<Unit32>
|
||||
<Filename Value="D:\lazarusClean\fpcsrc\rtl\objpas\classes\lists.inc"/>
|
||||
<CursorPos X="3" Y="29"/>
|
||||
<TopLine Value="27"/>
|
||||
<UsageCount Value="6"/>
|
||||
</Unit32>
|
||||
<Unit33>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\sysutils\sysutilh.inc"/>
|
||||
<CursorPos X="13" Y="235"/>
|
||||
<TopLine Value="215"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit33>
|
||||
<Unit34>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\sysutils\sysutils.inc"/>
|
||||
<CursorPos X="9" Y="110"/>
|
||||
<TopLine Value="106"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit34>
|
||||
<Unit35>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\inc\heaptrc.pp"/>
|
||||
<UnitName Value="heaptrc"/>
|
||||
<CursorPos X="40" Y="1168"/>
|
||||
<TopLine Value="1190"/>
|
||||
<UsageCount Value="7"/>
|
||||
</Unit35>
|
||||
<Unit36>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\fcl\xml\dom.pp"/>
|
||||
<UnitName Value="DOM"/>
|
||||
<CursorPos X="3" Y="187"/>
|
||||
<TopLine Value="175"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit36>
|
||||
<Unit37>
|
||||
<Filename Value="..\..\server_service_intf.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="server_service_intf"/>
|
||||
<CursorPos X="35" Y="379"/>
|
||||
<TopLine Value="376"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="42"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit37>
|
||||
<Unit38>
|
||||
<Filename Value="..\..\service_intf.pas"/>
|
||||
<UnitName Value="service_intf"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="23"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="19"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit38>
|
||||
<Unit39>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\classes\classesh.inc"/>
|
||||
<CursorPos X="3" Y="316"/>
|
||||
<TopLine Value="304"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit39>
|
||||
<Unit40>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\classes\lists.inc"/>
|
||||
<CursorPos X="3" Y="407"/>
|
||||
<TopLine Value="404"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit40>
|
||||
<Unit41>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\fcl\inc\contnrs.pp"/>
|
||||
<UnitName Value="contnrs"/>
|
||||
<CursorPos X="3" Y="474"/>
|
||||
<TopLine Value="471"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit41>
|
||||
<Unit42>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\inc\objpash.inc"/>
|
||||
<CursorPos X="27" Y="121"/>
|
||||
<TopLine Value="104"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit42>
|
||||
<Unit43>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\inc\objpas.inc"/>
|
||||
<CursorPos X="9" Y="166"/>
|
||||
<TopLine Value="142"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit43>
|
||||
<Unit44>
|
||||
<Filename Value="D:\Lazarus\components\fpcunit\guitestrunner.pas"/>
|
||||
<ComponentName Value="GUITestRunner"/>
|
||||
<HasResources Value="True"/>
|
||||
<UnitName Value="GuiTestRunner"/>
|
||||
<CursorPos X="34" Y="32"/>
|
||||
<TopLine Value="25"/>
|
||||
<UsageCount Value="8"/>
|
||||
</Unit44>
|
||||
<Unit45>
|
||||
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\fcl\fpcunit\fpcunit.pp"/>
|
||||
<UnitName Value="fpcunit"/>
|
||||
<CursorPos X="26" Y="231"/>
|
||||
<TopLine Value="193"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit45>
|
||||
</Units>
|
||||
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="..\..\;..\..\ws_helper\"/>
|
||||
<UnitOutputDirectory Value="obj"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="True"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-Xi"/>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<BreakPoints Count="21">
|
||||
<Item1>
|
||||
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\test_soap.pas"/>
|
||||
<Line Value="15"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\test_soap.pas"/>
|
||||
<Line Value="16"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\test_soap.pas"/>
|
||||
<Line Value="18"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\googleintfimpunit.pas"/>
|
||||
<Line Value="63"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Source Value="..\google_api\home\inoussa\Projets\Laz\v0.2\indy_http_protocol.pas"/>
|
||||
<Line Value="69"/>
|
||||
</Item5>
|
||||
<Item6>
|
||||
<Source Value="..\google_api\home\inoussa\Projets\Laz\v0.2\service_intf.pas"/>
|
||||
<Line Value="567"/>
|
||||
</Item6>
|
||||
<Item7>
|
||||
<Source Value="..\google_api\home\inoussa\Projets\Laz\v0.2\imp_utils.pas"/>
|
||||
<Line Value="83"/>
|
||||
</Item7>
|
||||
<Item8>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="572"/>
|
||||
</Item8>
|
||||
<Item9>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="587"/>
|
||||
</Item9>
|
||||
<Item10>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="588"/>
|
||||
</Item10>
|
||||
<Item11>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="571"/>
|
||||
</Item11>
|
||||
<Item12>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="570"/>
|
||||
</Item12>
|
||||
<Item13>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="568"/>
|
||||
</Item13>
|
||||
<Item14>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="366"/>
|
||||
</Item14>
|
||||
<Item15>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="337"/>
|
||||
</Item15>
|
||||
<Item16>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="194"/>
|
||||
</Item16>
|
||||
<Item17>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="349"/>
|
||||
</Item17>
|
||||
<Item18>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="363"/>
|
||||
</Item18>
|
||||
<Item19>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="821"/>
|
||||
</Item19>
|
||||
<Item20>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="809"/>
|
||||
</Item20>
|
||||
<Item21>
|
||||
<Source Value="testformatter_unit.pas"/>
|
||||
<Line Value="909"/>
|
||||
</Item21>
|
||||
</BreakPoints>
|
||||
<Watches Count="2">
|
||||
<Item1>
|
||||
<Expression Value="FScopeObject^.Name"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Expression Value="AOwner^.DataType"/>
|
||||
</Item2>
|
||||
</Watches>
|
||||
</Debugging>
|
||||
</CONFIG>
|
121
wst/trunk/tests/test_suite/wst_test_suite.lpr
Normal file
121
wst/trunk/tests/test_suite/wst_test_suite.lpr
Normal file
@ -0,0 +1,121 @@
|
||||
program wst_test_suite;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
custapp, classes, sysutils, fpcunit, testreport, testregistry,
|
||||
TestFormatter_unit, testmetadata_unit,
|
||||
server_service_soap, soap_formatter, base_binary_formatter,
|
||||
base_service_intf, base_soap_formatter, binary_formatter, binary_streamer,
|
||||
server_binary_formatter, metadata_repository,
|
||||
metadata_generator, parserdefs, server_service_intf, metadata_wsdl;
|
||||
|
||||
Const
|
||||
ShortOpts = 'alh';
|
||||
Longopts : Array[1..5] of String = (
|
||||
'all','list','format:','suite:','help');
|
||||
Version = 'Version 0.1';
|
||||
|
||||
Type
|
||||
TTestRunner = Class(TCustomApplication)
|
||||
private
|
||||
FXMLResultsWriter: TXMLResultsWriter;
|
||||
protected
|
||||
procedure DoRun ; Override;
|
||||
procedure doTestRun(aTest: TTest); virtual;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
constructor TTestRunner.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FXMLResultsWriter := TXMLResultsWriter.Create;
|
||||
end;
|
||||
|
||||
destructor TTestRunner.Destroy;
|
||||
begin
|
||||
FXMLResultsWriter.Free;
|
||||
end;
|
||||
|
||||
procedure TTestRunner.doTestRun(aTest: TTest);
|
||||
var
|
||||
testResult: TTestResult;
|
||||
begin
|
||||
testResult := TTestResult.Create;
|
||||
try
|
||||
testResult.AddListener(FXMLResultsWriter);
|
||||
FXMLResultsWriter.WriteHeader;
|
||||
aTest.Run(testResult);
|
||||
FXMLResultsWriter.WriteResult(testResult);
|
||||
finally
|
||||
testResult.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestRunner.DoRun;
|
||||
var
|
||||
I : Integer;
|
||||
S : String;
|
||||
begin
|
||||
S:=CheckOptions(ShortOpts,LongOpts);
|
||||
If (S<>'') then
|
||||
Writeln(S);
|
||||
if HasOption('h', 'help') or (ParamCount = 0) then
|
||||
begin
|
||||
writeln(Title);
|
||||
writeln(Version);
|
||||
writeln('Usage: ');
|
||||
writeln('-l or --list to show a list of registered tests');
|
||||
writeln('default format is xml, add --format=latex to output the list as latex source');
|
||||
writeln('-a or --all to run all the tests and show the results in xml format');
|
||||
writeln('The results can be redirected to an xml file,');
|
||||
writeln('for example: ./testrunner --all > results.xml');
|
||||
writeln('use --suite=MyTestSuiteName to run only the tests in a single test suite class');
|
||||
end;
|
||||
if HasOption('l', 'list') then
|
||||
begin
|
||||
if HasOption('format') then
|
||||
begin
|
||||
if GetOptionValue('format') = 'latex' then
|
||||
writeln(GetSuiteAsLatex(GetTestRegistry))
|
||||
else
|
||||
writeln(GetSuiteAsXML(GetTestRegistry));
|
||||
end
|
||||
else
|
||||
writeln(GetSuiteAsXML(GetTestRegistry));
|
||||
end;
|
||||
if HasOption('a', 'all') then
|
||||
begin
|
||||
doTestRun(GetTestRegistry)
|
||||
end
|
||||
else
|
||||
if HasOption('suite') then
|
||||
begin
|
||||
S := '';
|
||||
S:=GetOptionValue('suite');
|
||||
if S = '' then
|
||||
for I := 0 to GetTestRegistry.Tests.count - 1 do
|
||||
writeln(GetTestRegistry[i].TestName)
|
||||
else
|
||||
for I := 0 to GetTestRegistry.Tests.count - 1 do
|
||||
if GetTestRegistry[i].TestName = S then
|
||||
begin
|
||||
doTestRun(GetTestRegistry[i]);
|
||||
end;
|
||||
end;
|
||||
Terminate;
|
||||
end;
|
||||
|
||||
Var
|
||||
App : TTestRunner;
|
||||
|
||||
begin
|
||||
App:=TTestRunner.Create(Nil);
|
||||
App.Initialize;
|
||||
App.Title := 'FPCUnit Console Test Case runner.';
|
||||
App.Run;
|
||||
App.Free;
|
||||
end.
|
||||
|
Reference in New Issue
Block a user