I'm doing a unit test on a network service that returns hundreds of products. During my test today, one of this products is missing a field.
Because one product is missing a field my assertion fails (succeeds at finding the error, so it depends on how you see it), but what I want to know is which product is the one having the issue.
Here's my assertion code:
for (Catalog catalog : mCatalogs.catalogs) {
if (catalog.products != null && !catalog.products.isEmpty())
{
for (Product product : catalog.products) {
assertNotNull(product.sku);
assertNotNull(product.title);
assertNotNull(product.localeName);
assertNotNull(product.description);
assertNotNull(product.fullImage);
assertNotNull(product.statusCode);
}
}
}
one of the products does not have the field localName
Is there a way to output to the command line a string with something like
"product " + product.title + " failed"
?
If so, how?
Thank you!
Aucun commentaire:
Enregistrer un commentaire