
com.katalon.platform.api.controller.FeatureFileController Maven / Gradle / Ivy
package com.katalon.platform.api.controller;
import com.katalon.platform.api.exception.ResourceException;
import com.katalon.platform.api.model.FolderEntity;
import com.katalon.platform.api.model.ProjectEntity;
import com.katalon.platform.api.model.SystemFileEntity;
import com.katalon.platform.api.service.ProjectManager;
/**
* FeatureFileController is a unique KS Controller to help KS plugins can manipulate Feature Files (.feature) under Include/features folder in the file
* system.
*
* @see #getAvailableFeatureFileName(ProjectEntity, FolderEntity, String)
* @see #newFeatureFile(ProjectEntity, FolderEntity, String)
* @see #getFeatureFile(ProjectEntity, String)
*
* @since 1.0.6
*/
public interface FeatureFileController extends Controller {
/**
* Returns an instance of Feature File as an SystemFileEntity by the give featureFileName
.
* The create Feature File is under the Include/features folder.
*
* @param project an instance of working project. The current working project can retrieve by using
* {@link ProjectManager#getCurrentProject()}.
*
* @param featureFileId id of feature file
* @return an instance of SystemFileEntity
* @throws ResourceException if KS could not read or access feature file.
*
* @since 1.0.6
*/
SystemFileEntity getFeatureFile(ProjectEntity project, String featureFileId) throws ResourceException;
/**
* Create a new feature file under Include/features
with the given name
*
* @param project an instance of working project. The current working project can retrieve by using
* {@link ProjectManager#getCurrentProject()}.
* @param name name of the created feature file
* @param parentFolder parent folder the feature file
* @return new created Entity
* @throws ResourceException if KS could not create test case.
*
* @since 1.0.6
*/
SystemFileEntity newFeatureFile(ProjectEntity project, FolderEntity parentFolder, String name) throws ResourceException;
/**
* Returns an available feature file name for the given name
under the given folder
*
* Sample of using: We want to create a folder with name New Feature File.feature
*
* Case 1: There is no New Feature File.feature feature file that's under parentFolder
then the result is
* New Feature File.feature
*
* Case 2: New Feature File.feature feature file exists, but New Feature File 1.feature doesn't then the result is New Feature File 1.feature
*
* Case 3: New Feature File.feature and New Feature File 1.feature folder exist, but New Feature File 2.feature doesn't then
* the result is New Feature File 2.feature
*
* @param project project an instance of working project. The current working project can retrieve by using
* {@link ProjectManager#getCurrentProject()}.
* @param name name of new feature file. Name should not be blank or content non-English characters.
* @param parentFolder parent folder that needs to check name
* @return a new available name
* @throws ResourceException thrown if name is invalid format, or KS could not read or access parent folder.
*
* @since 1.0.6
*/
String getAvailableFeatureFileName(ProjectEntity project, FolderEntity parentFolder, String name) throws ResourceException;
}