NBi
NBi copied to clipboard
Multiple checks for a query execution
Hi,
I have a requirement where i need to check multiple things to mark the test case as pass. The scenario is as follows:
- A query will be executed on DWH say "Query_1"
- From the result set of Query_1 execution, i need to assert the row count should be equal to 1
- One of the value of column say "Column_1A" should be equal to 500
- Another query need to be executed say "Query_2" 5 Two columns of Query_1 say "Column_1B" & "Column_1C" need to be compared with two columns of Query_2 say "Column_2B" & "Column_2C" 6 If the value of Column_1B is equal to value of Column_2B and value of Column_1C is greater than or equal to the value of Column_2C then test case is pass.
Checked the documentation but couldn't find how to achieve this requirement. Really appreciate if i can get any support to achieve this requirement.
Code would be something like this:
Hi, I don't know if I fully understood your requirement. In case you want to compare two fields, you can do so and if it needs to be one row, it's either implicit by just having one resulting row (at least on the assert side) or you could write an extra test which asserts the rowcount to 1? From what I can tell, you might add many requirements into one complex test case where you could split it up and keep it simple? I might misunderstand, however.
Thank you for your response.
My requirement is to test all the above mentioned 6 criterion in one test case. However if that is not possible then i have to split it into multiple test cases.
Really appreciate if the code to compare two result sets for "more than or equal to" comparison can be shared as the below code is not working for me:
Condition - If the value of Column_1C (from 1st result set) is greater than or equal to the value of Column_2C (from 2nd result set) then test case is pass.
NBi doesn't support more than one assertion by test. It's in fact a poor practice to do than in unit testing.