Browse Source

bugfixes on unit-tests

master
Ulrich Carmesin 2 years ago
parent
commit
d0584616a5
  1. 23
      TC0001/testspec.csv
  2. 37
      UNIT_TEST/rest-message.xml
  3. 19
      UNIT_TEST/shiporder-res.yml
  4. 23
      UNIT_TEST/shiporder.xml
  5. 32
      UNIT_TEST/shiporder.xsd
  6. 4
      catalog/sender.csv

23
TC0001/testspec.csv

@ -8,17 +8,22 @@ step:2;testrest;3;1,2;fct:json-rest;action:new
# ;;;;; # ;;;;;
# testdate only here specified;expect:row 2 is inserted as precond;;;; # testdate only here specified;expect:row 2 is inserted as precond;;;;
_date;01.07.2022;;;; _date;01.07.2022;;;;
table:person;_nr;famname;name;birth;sex table:person;_nr;_sender;famname;name;birth;sex
testrest:person;1;Brecht;Bert;10.02.1898;m testrest:person;1;firma;Brecht;Bert;10.02.1898;m
testrest:person,testcrmdb:person;2;Leon;Donna;28.09.1942;f testrest:person,testcrmdb:person;2;firma;Leon;Donna;28.09.1942;f
table:adress;_nr;city;street;zip;
testrest:adress;1;Kiel;Foerdestr. 4;23123;
testrest:adress,testcrmdb:adress;2;Bonn;Bundesallee 16;52321;
# testdate only here specified;expect: no row is inserted as precond;;;; # testdate only here specified;expect: no row is inserted as precond;;;;
_date;02.07.2022;;;; _date;02.07.2022;;;;
table:object;_nr;objid;descript;objtype;value table:object;_nr;_pos;objid;descript;objtype;value
testrest:object;1;;cat;animal;100 testrest:object;1;4;;cat;animal;100
testrest:object;2;;dog;animal;200 testrest:object;1;5;;dog;animal;110
testrest:object;2;1;;dog;animal;200
# testdate here and in separate csv specified;;;;; # testdate here and in separate csv specified;;;;;
# expect: both row is inserted as precond;;;;; # expect: both row is inserted as precond;;;;;
_date;03.07.2022;;;; _date;03.07.2022;;;;
table:product;_nr;prdid;descript;objtype;factor table:product;_nr;_pos;prdid;descript;objtype;factor
testrest:product;1;;first;time; testrest:product;1;4;;first;time;
testrest:product;2;;second;money; testrest:product;1;5;;first;clime;
testrest:product;2;1;;second;money;

Can't render this file because it has a wrong number of fields in line 11.

37
UNIT_TEST/rest-message.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<rest>
<sender>
<_id>sender={_data.person._sender(_steps._nr)}</_id>
<client-name>{_catalog.sender.name(sender)}</client-name>
<client-id>{_catalog.sender.client-id(sender)}</client-id>
<client-depart>{_catalog.sender.department(sender)}</client-depart>
</sender>
<messages>
<_foreach>msgid={_steps._nr}</_foreach>
<message nr="{msgid}" action="{_steps.args.action}">
<timestamp>{_par.tctime}</timestamp>
<customer>
<_id>{msgid}</_id>
<_row>{_data.person(msgid)}</_row>
<name>{_row.person.name}</name>
<famname>{_row.person.famname}</famname>
<adress>
<_id>{msgid}</_id>
<_row>{_data.adress(msgid)}</_row>
<street>{_row.adress.street}</street>
<city>{_row.adress.city}</city>
<zip>{_row.adress.zip}</zip>
</adress>
<position>
<_foreach>posid={_data.product._nr,_pos(msgid)}</_foreach>
<product>
<_id>{posid}</_id>
<_row>{_data.product(posid)}</_row>
<description>{_row.product.descript}</description>
<prdtype>{_row.product.objtype}</prdtype>
</product>
</position>
</customer>
</message>
</messages>
</rest>

19
UNIT_TEST/shiporder-res.yml

@ -0,0 +1,19 @@
shiporder:
'@orderid': '889923'
'@xmlns:xsi': http://www.w3.org/2001/XMLSchema-instance
'@xsi:noNamespaceSchemaLocation': shiporder.xsd
item:
- note: Special Edition
price: '10.90'
quantity: '1'
title: Empire Burlesque
- price: '9.90'
quantity: '1'
title: Hide your heart
orderperson: John Smith
shipto:
address: Langgt 23
city: 4000 Stavanger
country: Norway
name: Ola Nordmann

23
UNIT_TEST/shiporder.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>

32
UNIT_TEST/shiporder.xsd

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>

4
catalog/sender.csv

@ -0,0 +1,4 @@
table:sender;name;client-id;depart
;firma;223344;main
;filiale;123456;outside
1 table:sender name client-id depart
2 firma 223344 main
3 filiale 123456 outside
Loading…
Cancel
Save