Remove count logic in custom sql test as 1) create complex logic and 2) multiple users got confused with expected tests results (#8819)

This commit is contained in:
Teddy 2022-11-16 18:10:55 +01:00 committed by GitHub
parent 1bae473ce8
commit 88c0ecb579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -75,9 +75,6 @@ def table_custom_sql_query(
if not rows: if not rows:
status = TestCaseStatus.Success status = TestCaseStatus.Success
result_value = 0 result_value = 0
elif len(rows) == 1:
status = TestCaseStatus.Success if rows[0].count == 0 else TestCaseStatus.Failed
result_value = rows[0].count
else: else:
status = TestCaseStatus.Failed status = TestCaseStatus.Failed
result_value = len(rows) result_value = len(rows)

View File

@ -225,9 +225,8 @@ parameterValues:
``` ```
### Table Custom SQL Test ### Table Custom SQL Test
Write you own SQL test. The test will pass if either of the following condition is met: Write you own SQL test. The test will pass if the following condition is met:
- The query result return 0 row - The query result return 0 row
- The query expression `COUNT(<col>)` returns 0
**Properties** **Properties**
@ -236,15 +235,16 @@ Write you own SQL test. The test will pass if either of the following condition
**Example** **Example**
```sql ```sql
SELECT SELECT
COUNT(customer_tier) customer_id
FROM DUAL FROM DUAL
WHERE customer_tier = 'GOLD' and lifetime_value < 10000; WHERE lifetime_value < 0;
``` ```
```sql ```sql
SELECT SELECT
customer_id customer_id
FROM DUAL FROM DUAL d
INNER JOIN OTHER o ON d.id = o.id
WHERE lifetime_value < 0; WHERE lifetime_value < 0;
``` ```
@ -256,7 +256,7 @@ parameterValues:
- name: sqlExpression - name: sqlExpression
value: > value: >
SELECT SELECT
COUNT(customer_tier) customer_tier
FROM DUAL FROM DUAL
WHERE customer_tier = 'GOLD' and lifetime_value < 10000; WHERE customer_tier = 'GOLD' and lifetime_value < 10000;
``` ```
@ -269,7 +269,7 @@ parameterValues:
"parameterValues": [ "parameterValues": [
{ {
"name": "sqlExpression", "name": "sqlExpression",
"value": "SELECT COUNT(customer_tier) FROM DUAL WHERE customer_tier = 'GOLD' and lifetime_value < 10000;\n" "value": "SELECT customer_tier FROM DUAL WHERE customer_tier = 'GOLD' and lifetime_value < 10000;"
} }
] ]
} }