day 8: Chaining and TestNG

This commit is contained in:
2024-10-15 04:33:12 -04:00
parent fc3dfdfd48
commit f34444eac4
4 changed files with 123 additions and 0 deletions
@@ -0,0 +1,27 @@
package zacksolutions.DayEight;
import org.testng.ITestContext;
import org.testng.annotations.Test;
import static io.restassured.RestAssured.*;
/**
* DeleteUserTest
*/
public class DeleteUserTest {
@Test
void delete_User(ITestContext context) {
int id = (Integer) context.getSuite().getAttribute("user_id");
String bearerToken = "2fjksdc32opcmlpqweldien324fwefwnklploqpiwuioennxmhjgasdfe";
given()
.header("Authorization", "Bearer " + bearerToken)
.pathParam("id", id)
.when()
.delete("https://foobar.com/public/v2/users/{id}")
.then().statusCode(204)
.log().all();
}
}