Module 19 Facing Challenges in my First Program | Rest Assured Forum

Module 19 Facing Challenges in my First Program

A
Amit Haldar Post on 12/12/2019

Challenge 1: 

When I enter invalid pwd its still gettnig passed not sure what I am doing wrong

 

Challenge 2:
I am not getting proper session id, not sure why?


Please review my code  below 

package testcases;

import org.testng.annotations.Test;
import data.Session;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import static io.restassured.RestAssured.*;


public class LoginRequest {

@Test
public void test001(){
RestAssured.baseURI="http://localhost:8181/";
RestAssured.basePath="Retail_App_Rest/retail/admin/login";

Session s= new Session ();
s.setUsername("admin");
s.setPassword("whizdom");

Response resp= given().contentType(ContentType.JSON).log().body().when().body(s).post();
System.out.println("-Test Started--");

resp.prettyPrint();

String sessionId= resp.headers().getValue("sessionid");
System.out.println("session id is" + sessionId);

}

}