Daniel Quathamer
2 years ago
9 changed files with 209 additions and 6 deletions
@ -0,0 +1,127 @@
@@ -0,0 +1,127 @@
|
||||
--Freemarker Template |
||||
--Achtung: Diese Script ist auch das select_stmt der Maske 37140 |
||||
<#include "SQL_lingua_franca"/> |
||||
<#include "SuperX_general"/> |
||||
<sqlvars> |
||||
|
||||
<sqlvar name="qa_dbtests" type='hashsequence'> |
||||
select |
||||
R.fieldclause, |
||||
R.fromclause, |
||||
R.groupbyclause, |
||||
R.orderbyclause, |
||||
T.tid, |
||||
T.uniquename, |
||||
T.name, |
||||
T.whereclause |
||||
FROM qa_dbtest T, qa_resultset R |
||||
where |
||||
T.resultset_id=R.tid |
||||
and T.active=1 |
||||
; |
||||
|
||||
</sqlvar> |
||||
<sqlvar name="qa_dbtest_assertions" type='hashsequence'> |
||||
select |
||||
A.dbtest_id, |
||||
A.tid, |
||||
A.rownr , |
||||
A.def_col_caption, |
||||
A.def_col_name, |
||||
A.def_col_value |
||||
FROM qa_dbtest_assertion A |
||||
where A.dbtest_id in (select T.tid |
||||
from qa_dbtest T where T.active=1) |
||||
; |
||||
|
||||
</sqlvar> |
||||
</sqlvars> |
||||
|
||||
<#assign inEtl=true /> |
||||
<#if Maskennummer?exists && Maskennummer=37140> |
||||
<#assign inEtl=false /> |
||||
</#if> |
||||
|
||||
<#assign dbtest_id="" /> |
||||
<#if inEtl> |
||||
|
||||
<#else> |
||||
|
||||
/* <#assign dbtest_id="<<DB-Test>>" />*/ |
||||
</#if> |
||||
create temp table tmp_qa_dbtest_result_id |
||||
(qa_dbtest_result_id integer); |
||||
|
||||
|
||||
<#foreach dbtest in qa_dbtests> |
||||
<#if dbtest_id == "" || dbtest_id==dbtest.tid?string> |
||||
|
||||
select now() as beginn |
||||
into temp tmp_anfang; |
||||
|
||||
select ${dbtest.fieldclause} |
||||
into temp tmp_rs |
||||
from ${dbtest.fromclause} |
||||
<#if dbtest.whereclause !=''> |
||||
where ${dbtest.whereclause} |
||||
</#if> |
||||
<#if dbtest.groupbyclause !=''> |
||||
group by ${dbtest.groupbyclause} |
||||
</#if> |
||||
<#if dbtest.orderbyclause !=''> |
||||
order by ${dbtest.orderbyclause} |
||||
</#if> |
||||
; |
||||
|
||||
|
||||
|
||||
<#foreach dbtest_assertion in qa_dbtest_assertions> |
||||
<#if dbtest_assertion.dbtest_id==dbtest.tid> |
||||
|
||||
insert into qa_dbtest_result( |
||||
dbtest_assertion_id, |
||||
execution_start , |
||||
execution_end , |
||||
result_code , |
||||
result_value ) |
||||
select |
||||
${dbtest_assertion.tid}, |
||||
A.beginn, |
||||
now(), |
||||
case when T.${dbtest_assertion.def_col_name}='${dbtest_assertion.def_col_value}' then 0 |
||||
else 1 end as result_code, |
||||
T.${dbtest_assertion.def_col_name} as result_value |
||||
from tmp_anfang A left outer join tmp_rs T |
||||
on (1=${dbtest_assertion.rownr}) |
||||
; |
||||
insert into tmp_qa_dbtest_result_id(qa_dbtest_result_id) |
||||
<#if SQLdialect='Postgres'> |
||||
select currval('qa_dbtest_result_tid_seq') from xdummy |
||||
<#else> |
||||
select max(tid) from qa_dbtest_result |
||||
</#if> |
||||
; |
||||
|
||||
</#if> |
||||
</#foreach> |
||||
drop table tmp_rs; |
||||
drop table tmp_anfang; |
||||
</#if> |
||||
</#foreach> |
||||
|
||||
|
||||
<#if !inEtl> |
||||
select T.tid as dbtest_id, |
||||
T.name, |
||||
R.execution_start, |
||||
R.execution_end, |
||||
case when R.result_code=0 then 'Erfolg' else 'Warnung' end as result_str, |
||||
R.result_value, |
||||
'37100&DB-Test=' || T.tid as nexttable |
||||
FROM qa_dbtest T, qa_dbtest_result R,qa_dbtest_assertion A |
||||
where A.tid=R.dbtest_assertion_id |
||||
and T.tid=A.dbtest_id |
||||
and T.tid=<<DB-Test>> |
||||
and R.tid in (select qa_dbtest_result_id from tmp_qa_dbtest_result_id) |
||||
order by 4 desc; |
||||
</#if> |
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
||||
37000^Benutzer/in^50^0^0^150^200^1^integer^200^0^1^<<SQL>> select tid,nvl(name,benutzer) from userinfo order by 2;^^^ |
||||
37001^Testfall-Schlüssel^10^0^0^150^150^1^sql^50^0^0^^^^ |
||||
37002^Projekt^10^0^0^150^80^1^integer^200^0^1^<<SQL>> select tid,name from qa_project where active=1 /* and systeminfo_id=<<Komponente>> */ order by 2;^^^ |
||||
37003^Name^20^0^0^150^150^1^sql^50^0^0^^^^ |
||||
37004^Komponente^1^0^0^150^200^1^integer^200^0^1^<<SQL>> select tid,name from systeminfo order by 2;^^^ |
||||
|
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
||||
37000^37000^ |
||||
37000^37001^ |
||||
37000^37002^ |
||||
37000^37003^ |
||||
37000^37004^ |
||||
|
Loading…
Reference in new issue