1. Home
  2. Docs
  3. Tips & Tricks
  4. Asserting data
  5. Asserting a full list

Asserting a full list

When asserting a list, you can assert within the AppTester on individual items.

For example, you have an output variable in BAW, a string, that is a list, named qualityAttributes. The way to assert the individual items in the list is by dragging and dropping the variable in the assert table and using order of the list to check the contents of every list item.

In lots of cases an array (list) like this won’t change and shouldn’t change in your service within you process app. So this is a good unit test to create when you are creating lists within BAW. Though these kind of lists could have lot’s of items in it, which could take you a long time to create such automated checks. 

Instead of checking all individual items, you could check the complete list at once. If you run the script you get to see the output in the result of a script.

And this output has the list in it between the brackets:

[
“Capability”,
“Reliability”,
“Usability”,
“Stability”,
“Performance”,
“Installability”,
“Compatability”
]

  • Copy this part, including the brackets
  • Add an assert “qualityAttributes()” and remove the ()
  • Paste the list into the editbox of the assert and save

And run… 

The mistake made in the past is that we try to paste the complete jSon in the assert edit box, though this is an assert of a list within the jSon. I guess by reading this you can save some time in the future now. Good luck!

Was this article helpful to you? Yes No

How can we help?