Rize S. answered 03/23/23
Senior IT Certified Trainer, IT Developer & DBA Administrator
The first argument of the generateTestCasesFromTestData function in the TPT Java API is the scenario group for which you want to generate test cases. The scenario group is a container for scenarios that share common test data.
To get the scenario group object, you can use the getScenarioGroup function of the Project object. Here is an example code snippet that demonstrates how to use getScenarioGroup function to get the scenario group object:
import com.piketec.tpt.api.*;
// Initialize TPT API
TptApi api = TptApi.getInstance();
api.initialize();
// Get the project object
Project project = api.getProjectManager().getCurrentProject();
// Get the scenario group object
ScenarioGroup scenarioGroup = project.getScenarioGroup("MyScenarioGroup");
// Generate test cases from test data for the scenario group
scenarioGroup.generateTestCasesFromTestData(null, null, null, null);
In this example, MyScenarioGroup is the name of the scenario group for which you want to generate test cases. You can replace it with the name of your scenario group. The null arguments are optional parameters for the generateTestCasesFromTestData function that you can use to filter the test data and specify the test case generation options.
I hope this helps! Let me know if you have any further questions.