Comments (7)
I also think that this functionality will be useful and improve tests readability.
Now we use the following workaround with cases
:
dbQuery: >
{{ .query }}
cases:
- dbQueryArgs:
query: SELECT 1
dbResponse: 1
- dbQueryArgs:
query: SELECT 2
dbResponse: 2
But that is verbose, non-intuitive and executes test again for each query.
from gonkey.
Why don't you use subqueries?
from gonkey.
SELECT
(
SELECT id, name
FROM items
),
(
SELECT value
FROM properties
)
would result in pq: subquery must return only one column
as the first subquery selects two columns.
from gonkey.
Depends on data you trying to check. Usually i use COUNT funсtion in subqueries, to check that there are given number of records in some table. For ex:
(SELECT COUNT(*) AS value_count FROM properties WHERE value = 'my_value' AND item_id = id )
If you want to transpose rows to columns, check this out https://stackoverflow.com/questions/23060256/postgres-transpose-rows-to-columns
from gonkey.
Checking only count is quite a limiting functionality.
Thanks for pointing out crosstab function, it is indeed useful in some cases. But it adds a little bit of complication to both writing and reading tests. Besides it doesn't solve an issue of querying 2 and more independent tables. Using joins and crosstab() function may mislead readers about intentions of the author.
from gonkey.
I think we need change rule:
Test must contains request + response
to
Test must contains request + response OR dbQuery + dbResponse
from gonkey.
🚀 Issue was released in v1.18.0
🚀
from gonkey.
Related Issues (20)
- Использование фикстур вне теста HOT 1
- Начиная с релиза 1.18.2 не может быть создан Allure-отчет HOT 1
- Рефакторинг модуля с фикстурами и добавление возможности использовать переменные HOT 1
- Одновременная поддержка redis и postgres HOT 3
- Сделать путь до фейлящегося теста кликабельным HOT 9
- Оборачивать каждый тест в сабтесты HOT 3
- Add comparison params into request constraits/Добавить comparison params в request constraits HOT 1
- Добавить поддержку переменных теста в фикстуры HOT 2
- Добавить возможность объявнять кастомные функции HOT 1
- Fatal when test has status "broken" HOT 1
- Возможность использования динамических переменных
- Focus test status stopped to work
- Реализовать механизм транзакций commit/rollback для фикстур HOT 1
- Реализовать автоматическую генерацию структуры папок и файлов при инициализации gonkey
- Параметризировать assert Response headers
- Изменение подхода работы с ContentType и поддержка application/x-www-form-urlencoded
- Fatal when set status skipped or broken HOT 3
- Добавление поддержки MongoDB в фикстурах
- Как протестировать получение файла? HOT 4
- По первой части, также количество элементов может меняться и достаточно было бы проверить код ответа и тип возвращаемых данных. Еще может быть ситуация, когда достаточно не 200, а 403 или другого кода ответа без проверки body.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gonkey.