Skip to content

Step documentation for Query

Execute query

Executes a query against a database

Sentences

Type Language Sentence
Given en I execute the ([a-zA-Z]+) query '(.*)'
When en I execute the following ([a-zA-Z]+) query:
Given nl ik de ([a-zA-Z]+) query '(.*)' uitvoer
When nl ik de volgende ([a-zA-Z]+) query uitvoer:

Arguments

Parameter Datatype Description
query language name string The query language used (SQL|MDX)
query text string The query to be executed

Examples

 Given I execute the SQL query 'Select 1 as ExampleColumn'
 When I execute the following SQL query:
  """
  Select 1 as ExampleColumn
  """
 Gegeven ik de SQL query 'Select 1 as ExampleColumn' uitvoer
 Als ik de volgende SQL query uitvoer:
  """
  Select 1 as ExampleColumn
  """

Execute query from file

Executes queries from a file against a database

Sentences

Type Language Sentence
Given en I execute the ([a-zA-Z]+) query file '(.*)'
Given nl ik het ([a-zA-Z]+) query bestand '(.*)' uitvoer

Arguments

Parameter Datatype Description
query language name string The query language used (SQL|MDX)
file path string The file containing the query to be executed

Examples

 Given I execute the SQL query file '.\DatabaseSteps\SupportFiles\testQueryFile.sql'
 Gegeven ik het SQL query bestand '.\DatabaseSteps\SupportFiles\testQueryFile.sql' uitvoer

Execute the following query on connection

Execute a SQL query on a database and fetch the result (if any) for comparison. Use this for queries that should return a result

Sentences

Type Language Sentence
When en ^I execute the following query on ([a-zA-Z0-9_@$#-]+):$

Arguments

Parameter Datatype Description
database config string The database config used to execute the query
query text string The query to execute

Examples

 When I execute the following query on demo:
           """
           SELECT CUST_ID, CUST_NAME
           FROM CUST_HUB
           """

Execute the following statement on connection

Execute a SQL statement on a database without fetching the result. Use this for updates, deletes, stored procedures without result set

Sentences

Type Language Sentence
When en ^I execute the following statement on ([a-zA-Z0-9_@$#-]+):$

Arguments

Parameter Datatype Description
database config string The database config used to execute the query
query text string The statement to execute

Examples

 When I execute the following statement on demo:
           """
           UPDATE CUST_HUB
           SET CUST_ID = 4444
           WHERE CUST_ID = 432
           """