24.5 C
New York
Sunday, September 1, 2024

Java maven – IllegalArgumentException: Enter have to be set


I received virtually equivalent console output as what you shared above. A sure check of mine wouldn’t even run step one, which advised me it had one thing to do with my ‘DriverUtils’ or my ‘Hooks’.

The start of my characteristic file:


@ProdSmoke @TC1.38 @ARCCP-T138 @TestCaseKey=ARCCP-T138
Situation: Person logs in, clicks important buttons, logs out, logs in, logs out

    # navigate to PROD CLIENT PORTAL
Given person navigates to "https://our-website-url.com/login"
And person has entered legitimate prod username and legitimate password 

My Hooks file regarded like this:


import api.companies.AuthenticationControllerService;
import context.SharedContext;
import io.cucumber.java.After;
import io.cucumber.java.Earlier than;
import io.cucumber.java.Situation;
import io.restassured.RestAssured;
import io.restassured.response.Response;
import utils.CommonMethods;
import utils.ConfigReader;
import utils.DriverUtils;

public class Hooks {
    non-public static String authorizationToken = "";
    AuthenticationControllerService authenticationControllerService = new AuthenticationControllerService();
    @Earlier than("@UI")
    public void setUp() {
        ConfigReader.initializeProperties();
        DriverUtils.createDriver();
    }
    @Earlier than("@API")
    public void setupBaseURIGetToken(){
        ConfigReader.initializeProperties();
        RestAssured.baseURI = ConfigReader.getProperty("authorization.url");

        Response authResponse = authenticationControllerService.authorizeAdmin(RestAssured.baseURI);
        String responseBody = authResponse.getBody().asString();

        authorizationToken = authResponse.jsonPath().getString("token");
        System.out.println("Authorization token: " + authorizationToken);

        SharedContext sharedContext = SharedContext.getInstance();
        sharedContext.setAPIAuthToken(authorizationToken);
        sharedContext.setResponseBody(responseBody);
    }
    public String getAuthToken(){
        return authorizationToken;
    }

    @After("@UI")
    public void cleanUp(Situation situation) throws InterruptedException {
        if (situation.isFailed()) {
            situation.connect(CommonMethods.takeScreenshot(), "picture/png", situation.getName());
        }
        CommonMethods.takeScreenshot(situation);
        Thread.sleep(3000);
        DriverUtils.getDriver().stop();
    }
} 

Be aware that my ‘public void setUp()’ technique in Hooks exhibits the tag @UI within the @Earlier than as ‘@Earlier than(“@UI”)’ above it. I in some way had eliminated the ‘@UI’ tag from above the ‘Situation’ line in my Characteristic File. So, I wasn’t calling the ‘setUp’ technique within the very first place. Including that mounted the whole lot, so the start of my Characteristic File seems to be like this:

Characteristic: ARCCP-T001 - Sanity Check of PROD COMPANY Shopper Portal Important Performance

@ProdSmoke @TC1.38 @ARCCP-T138 @TestCaseKey=ARCCP-T138 @UI
Situation: Person logs in, clicks important buttons, logs out, logs in, logs out

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles