Cosmetic: better test reporting database

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2917 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
bigchimp
2014-03-25 14:44:04 +00:00
parent f05f0eae12
commit 8faeace234
2 changed files with 24 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{ testdbwriter { testdbwriter
Copyright (C) 2012-2013 Reinier Olislagers Copyright (C) 2012-2014 Reinier Olislagers
This library is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by under the terms of the GNU Library General Public License as published by
@ -134,9 +134,9 @@ type
TDBResultsWriter = class(TNoRefCountObject, ITestListener) TDBResultsWriter = class(TNoRefCountObject, ITestListener)
protected protected
FApplicationName: string; FApplicationName: string;
FComment: string; FComment: string; //User-specified comment for test run
FConn: TSQLConnector; FConn: TSQLConnector;
FCPU: string; //Processor used in FPC terminology FCPU: string; //Processor used (name uses FPC terminology)
FDBProfile: string; //Name of the profile in the ini file the user chose. Only useful in error messages to user FDBProfile: string; //Name of the profile in the ini file the user chose. Only useful in error messages to user
FDBSetup: boolean; //Track if database is set up including adding test run data FDBSetup: boolean; //Track if database is set up including adding test run data
FDBType: string; //Output database type chosen by user FDBType: string; //Output database type chosen by user
@ -145,7 +145,7 @@ type
FDBUser: string; //Username FDBUser: string; //Username
FDBPassword: string; //Password needed for username FDBPassword: string; //Password needed for username
FDBCharset: string; //Character encoding for db connection FDBCharset: string; //Character encoding for db connection
FOS: string; //Operating system used in FPC terminology FOS: string; //Operating system used (name uses FPC terminology)
FRevisionID: string; //Unique identifier for source code being tested FRevisionID: string; //Unique identifier for source code being tested
FRootSuite: TStringList; //This list of testsuite names will be prepended to the test suite hierarchy when tests are run FRootSuite: TStringList; //This list of testsuite names will be prepended to the test suite hierarchy when tests are run
FTestSuitePath: TStringList; //Stack of suite names (and IDs) up to the current test suite. Will include FRootSuite FTestSuitePath: TStringList; //Stack of suite names (and IDs) up to the current test suite. Will include FRootSuite
@ -411,6 +411,7 @@ begin
halt(17); halt(17);
end; end;
end; end;
IBTran.Commit; IBTran.Commit;
finally finally
FBScript.Free; FBScript.Free;

View File

@ -219,21 +219,29 @@ FROM testresults r inner join resultvalues rv
on r.RESULTVALUE=rv.id on r.RESULTVALUE=rv.id
inner join testruns tr inner join testruns tr
on r.testrun=tr.ID on r.testrun=tr.ID
where rv.name='OK' where rv.name='OK' or rv.name='Ignored'
group by tr.applicationid, tr.os, tr.cpu, r.test; group by tr.applicationid, tr.os, tr.cpu, r.test;
CREATE VIEW TESTRESOK (TESTRESULTID)
AS
SELECT tr.id
from
testresults tr inner join
resultvalues rv on
tr.resultvalue=rv.id
where (rv.name='OK' or rv.name='Ignored');
CREATE VIEW OKRESULTS (RUNID, APPLICATION, OS, CPU, OKCOUNT, OKPERCENTAGE) CREATE VIEW OKRESULTS (RUNID, APPLICATION, OS, CPU, OKCOUNT, OKPERCENTAGE)
AS AS
SELECT run.id, a.name, o.osname, c.cpuname, count(rv.name), SELECT run.id, a.name, o.osname, c.cpuname, count(rv.name),
((count(tr.resultvalue))*100)/(SELECT COUNT(resultvalue) FROM testresults where testresults.testrun=run.id) ((count(ok.testresultid))*100)/(SELECT COUNT(resultvalue) FROM testresults where testresults.testrun=run.id)
from from
testresults tr inner join testresults tr inner join
testruns run on tr.TESTRUN=run.id inner JOIN testruns run on tr.TESTRUN=run.id inner join
testresok ok on tr.id=ok.testresultid inner join
resultvalues rv on tr.resultvalue=rv.id resultvalues rv on tr.resultvalue=rv.id
inner join applications a on run.applicationid=a.ID inner join applications a on run.applicationid=a.ID
inner join cpu c on run.cpu=c.ID inner join cpu c on run.cpu=c.ID
inner join os o on run.os=o.id inner join os o on run.os=o.id
group by run.id, a.name, o.osname, c.cpuname, rv.name group by run.id, a.name, o.osname, c.cpuname;
having rv.name='OK';
CREATE VIEW REGRESSIONS (APPLICATIONID, CPUID, OSID, TESTID, LASTSUCCESFULREVISION) CREATE VIEW REGRESSIONS (APPLICATIONID, CPUID, OSID, TESTID, LASTSUCCESFULREVISION)
AS AS
select select
@ -606,6 +614,9 @@ GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
ON LASTSUCCESS TO SYSDBA WITH GRANT OPTION; ON LASTSUCCESS TO SYSDBA WITH GRANT OPTION;
GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
ON TESTRESOK TO SYSDBA WITH GRANT OPTION;
GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE GRANT DELETE, INSERT, REFERENCES, SELECT, UPDATE
ON OKRESULTS TO SYSDBA WITH GRANT OPTION; ON OKRESULTS TO SYSDBA WITH GRANT OPTION;