Question: I am integrating Qtest with my karate framework for API testing with below code, but it looks like tokens is not Expected class in qtest

I am integrating Qtest with my karate framework for API testing with below code, but it looks like tokens is not Expected class in qtest sdks, what can be the other code to initialize qtest services, can you write the complete code with step by step approach.
public static void main(String[] args){
// Set your qTest credentials
String apiKey = "YOUR_API_KEY";
String baseUrl = "YOUR_QTEST_BASE_URL";
String projectId = "YOUR_PROJECT_ID";
int testCaseId =123; // Replace with your test case ID
int testSuiteId =456; // Replace with your test suite ID
// Initialize qTest services
Tokens tokens = new Tokens(apiKey, baseUrl);
TestExecutionService testExecutionService = new TestExecutionServiceClient(tokens);
TestDesignService testDesignService = new TestDesignServiceClient(tokens);
// Create a test cycle under a specific test suite
TestCycle testCycle = testExecutionService.createTestCycle(new CreateTestCycleRequest()
.withProjectId(projectId)
.withTestSuiteId(testSuiteId)
.withTestCycle(new TestCycle().withName("Cycle1")));
// Get the test case details
TestCase testCase = testDesignService.getTestCase(new GetTestCaseRequest()
.withProjectId(projectId)
.withTestCaseId(testCaseId));
// Create a test run for the test case within the test cycle
TestRun testRun = testExecutionService.createTestRun(new CreateTestRunRequest()
.withProjectId(projectId)
.withTestCycleId(testCycle.getId())
.withTestRun(new TestRun().withTestCase(testCase).withName("Thank u")));
// Execute your Selenium tests and collect results and logs
// For demonstration purposes, we'll assume test results and logs are collected
String testStatus = "PASS"; // Replace with actual test status
String logHistory = "Test executed successfully.
"+
"Step 1: Navigate to the website.
"+
"Step 2: Perform action X.
"; // Replace with actual log history
// Update the test run with test execution results and log history
UpdateTestRunRequest updateRequest = new UpdateTestRunRequest()
.withStatus(testStatus)
.withLog(logHistory);
testExecutionService.updateTestRun(testRun.getId(), updateRequest);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!