Ich benutze POSTMAN Client und versuche, Daten aus der CSV-Datei zu lesen. Als PoC habe ich unter Endpunkt-URL verwendet wird, istDatengetrieben Testen mit Postman
https://www.googleapis.com/books/v1/volumes?q=Light Im August
Unter meinen Code
tests["Status code is 200"] = responseCode.code === 200;
postman.setEnvironmentVariable("requestBook", data.requestBook);
var response = JSON.parse(responseBody);
tests["Validate the title is correctly populated"] = /{{title}}/.test(response.items[0].volumeInfo.title);
tests["Validate the author is correctly populated"] = /{{authors}}/.test(response.items[0].volumeInfo.authors);
tests["Validate the publisher is correctly populated"] = /{{publisher}}/.test(response.items[0].volumeInfo.publisher);
tests["Validate the published date is correctly populated"] = /{{publishedDate}}/.test(response.items[0].volumeInfo.publishedDate);
tests["Validate the page count is correctly populated"] = /{{pageCount}}/.test(response.items[0].volumeInfo.pageCount);
tests["Validate the category is correctly populated"] = /{{categories}}/.test(response.items[0].volumeInfo.categories);
tests["Validate the amount is correctly populated"] = /{{amount}}/.test(response.items[0].saleInfo.listPrice.amount);
tests["Validate the currency code is correctly populated"] = /{{currencyCode}}/.test(response.items[0].saleInfo.listPrice.currencyCode);
Es versagt. Wenn ich meine CSV-Datei zu überprüfen, das sieht alles in Ordnung
Hinweis: Wenn ich die Vorschau klicken, um all meine Daten mit Doppel
zitiert zeigen
Ich habe die Lösung gefunden, daher ist es gelöst. Der neue Code ist tests ["Überprüfen Sie, ob der Titel korrekt ausgefüllt ist"] = response.items [0] .volumeInfo.title === data.title; –
Schreiben Sie diesen Kommentar als Antwort und akzeptieren Sie ihn. Es wird dir ein wenig Ansehen verschaffen und es anderen Entwicklern erleichtern, die Antwort zu sehen. – Ray
Ich habe versucht, aber nicht finden Knopf sagt "Antwort" –