I'd like to validate if a sql result contains certain values without specifying the entire list, e.g:
A user has a certain role, therefore he should not have certain permissions.
What I have done is adding validate block with the entire list, even the ones I am not interested in. This approach works, but it is susceptible to DB changes. For example, if a new permission ID is added that had nothing to do with the ones I am interested in, the test fails because the order won't be correct anymore/the row count is wrong.
<sql datasource="db">
<statement>select PERM_ID as n, KONSTANTE as k FROM PERMISSIONS WHERE ID=${id} ORDER BY PERM_ID;</statement>
<validate column="n" >
<values>
<!-- 2-->
<value>@ignore()@</value>
<!-- 4-->
<value>@ignore()@</value>
<!-- 5-->
<value>@ignore()@</value>
<!-- 6-->
<value>@ignore()@</value>
<value>15</value>
I was hoping to do something like the below:
<validate column="n">
<values>
<contains>15</contains>
I haven't found a matching solution in [0] or the database actions [1]
[0] https://labs.consol.de/de/development/citrus/2018/03/01/database-testing-with-citrus.html
[1] https://citrusframework.org/citrus/reference/2.7/html/actions-database.html
question from:
https://stackoverflow.com/questions/65917202/citrus-sql-result-contains-element 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…