
br.eti.kinoshita.testlinkjavaapi.TestLinkAPI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testlink-java-api Show documentation
Show all versions of testlink-java-api Show documentation
TestLink Java API to interface with TestLink PHP XML-RPC API.
/*
* The MIT License
*
* Copyright (c) <2010>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package br.eti.kinoshita.testlinkjavaapi;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.ConversionException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.SystemConfiguration;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import br.eti.kinoshita.testlinkjavaapi.constants.ActionOnDuplicate;
import br.eti.kinoshita.testlinkjavaapi.constants.ExecutionStatus;
import br.eti.kinoshita.testlinkjavaapi.constants.ExecutionType;
import br.eti.kinoshita.testlinkjavaapi.constants.ResponseDetails;
import br.eti.kinoshita.testlinkjavaapi.constants.TestCaseDetails;
import br.eti.kinoshita.testlinkjavaapi.constants.TestCaseStatus;
import br.eti.kinoshita.testlinkjavaapi.constants.TestCaseStepAction;
import br.eti.kinoshita.testlinkjavaapi.constants.TestImportance;
import br.eti.kinoshita.testlinkjavaapi.model.Attachment;
import br.eti.kinoshita.testlinkjavaapi.model.Build;
import br.eti.kinoshita.testlinkjavaapi.model.CustomField;
import br.eti.kinoshita.testlinkjavaapi.model.Execution;
import br.eti.kinoshita.testlinkjavaapi.model.Platform;
import br.eti.kinoshita.testlinkjavaapi.model.ReportTCResultResponse;
import br.eti.kinoshita.testlinkjavaapi.model.Requirement;
import br.eti.kinoshita.testlinkjavaapi.model.TestCase;
import br.eti.kinoshita.testlinkjavaapi.model.TestCaseStep;
import br.eti.kinoshita.testlinkjavaapi.model.TestPlan;
import br.eti.kinoshita.testlinkjavaapi.model.TestProject;
import br.eti.kinoshita.testlinkjavaapi.model.TestSuite;
import br.eti.kinoshita.testlinkjavaapi.model.User;
import br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException;
/**
* TestLink API class.
*
* @author Bruno P. Kinoshita - http://www.kinoshita.eti.br
* @since 1.9.0-1
*/
public class TestLinkAPI {
/**
* TestLink URL.
*/
private URL url;
/**
* TestLink Developer Key.
*/
private String devKey;
private final TestProjectService testProjectService;
private final TestPlanService testPlanService;
private final MiscService miscService;
private final TestCaseService testCaseService;
private final TestSuiteService testSuiteService;
private final BuildService buildService;
private final RequirementService requirementService;
private final ReqSpecService reqSpecService;
private static final Logger LOG = LoggerFactory.getLogger(TestLinkAPI.class);
/**
* XML-RPC client.
*/
private XmlRpcClient xmlRpcClient;
// Constants for properties
private static final String XMLRPC_BASIC_ENCODING = "xmlrpc.basicEncoding";
private static final String XMLRPC_BASIC_PASSWORD = "xmlrpc.basicPassword";
private static final String XMLRPC_BASIC_USERNAME = "xmlrpc.basicUsername";
private static final String XMLRPC_CONNECTION_TIMEOUT = "xmlrpc.connectionTimeout";
private static final String XMLRPC_CONTENT_LENGTH_OPTIONAL = "xmlrpc.contentLengthOptional";
private static final String XMLRPC_ENABLED_FOR_EXCEPTIONS = "xmlrpc.enabledForExceptions";
private static final String XMLRPC_ENCODING = "xmlrpc.encoding";
private static final String XMLRPC_GZIP_COMPRESSION = "xmlrpc.gzipCompression";
private static final String XMLRPC_GZIP_REQUESTING = "xmlrpc.gzipRequesting";
private static final String XMLRPC_REPLY_TIMEOUT = "xmlrpc.replyTimeout";
private static final String XMLRPC_USER_AGENT = "xmlrpc.userAgent";
/**
* Constructor with parameters.
*
*
* Instantiates TestLink services. It also checks the devKey and throws a TestLinkAPIException if it is invalid.
*
*
* @param url The URL to set.
* @param devKey The Developer Key to set.
* @throws TestLinkAPIException
* @since 1.0
*/
public TestLinkAPI(URL url, String devKey) throws TestLinkAPIException {
this.url = url;
this.devKey = devKey;
this.xmlRpcClient = new XmlRpcClient();
// application configuration
final CompositeConfiguration appConfig = this.createApplicationConfiguration();
// XML-RPC client specific configuration, using the application
// configuration
final XmlRpcClientConfigImpl config = this.createXmlRpcClientConfiguration(url, appConfig);
this.xmlRpcClient.setConfig(config);
this.testProjectService = new TestProjectService(xmlRpcClient, devKey);
this.testPlanService = new TestPlanService(xmlRpcClient, devKey);
this.miscService = new MiscService(xmlRpcClient, devKey);
this.testCaseService = new TestCaseService(xmlRpcClient, devKey);
this.testSuiteService = new TestSuiteService(xmlRpcClient, devKey);
this.buildService = new BuildService(xmlRpcClient, devKey);
this.requirementService = new RequirementService(xmlRpcClient, devKey);
this.reqSpecService = new ReqSpecService(xmlRpcClient, devKey);
this.miscService.checkDevKey(devKey);
}
/**
* Creates application composite configuration.
*
* @return Application composite configuration.
*/
private CompositeConfiguration createApplicationConfiguration() {
CompositeConfiguration appConfig = new CompositeConfiguration();
appConfig.addConfiguration(new SystemConfiguration());
try {
appConfig.addConfiguration(new PropertiesConfiguration("testlinkjavaapi.properties"));
} catch (ConfigurationException ce) {
this.debug(ce);
}
return appConfig;
}
/**
* Creates XML-RPC client configuration.
*
* By default enabled for extensions is always true.
*
* @param url Application URL.
* @param appConfig Application composite configuration.
* @return XML-RPC client configuration.
*/
private XmlRpcClientConfigImpl createXmlRpcClientConfiguration(URL url, CompositeConfiguration appConfig) {
final XmlRpcClientConfigImpl xmlRpcClientConfig = new XmlRpcClientConfigImpl();
xmlRpcClientConfig.setServerURL(url);
xmlRpcClientConfig.setEnabledForExtensions(true);
xmlRpcClientConfig.setBasicEncoding(appConfig.getString(XMLRPC_BASIC_ENCODING));
xmlRpcClientConfig.setBasicPassword(appConfig.getString(XMLRPC_BASIC_PASSWORD));
xmlRpcClientConfig.setBasicUserName(appConfig.getString(XMLRPC_BASIC_USERNAME));
try {
xmlRpcClientConfig.setConnectionTimeout(appConfig.getInt(XMLRPC_CONNECTION_TIMEOUT));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setContentLengthOptional(appConfig.getBoolean(XMLRPC_CONTENT_LENGTH_OPTIONAL));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setEnabledForExceptions(appConfig.getBoolean(XMLRPC_ENABLED_FOR_EXCEPTIONS));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
xmlRpcClientConfig.setEncoding(appConfig.getString(XMLRPC_ENCODING));
try {
xmlRpcClientConfig.setGzipCompressing(appConfig.getBoolean(XMLRPC_GZIP_COMPRESSION));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setGzipRequesting(appConfig.getBoolean(XMLRPC_GZIP_REQUESTING));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setReplyTimeout(appConfig.getInt(XMLRPC_REPLY_TIMEOUT));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
xmlRpcClientConfig.setUserAgent(appConfig.getString(XMLRPC_USER_AGENT));
return xmlRpcClientConfig;
}
/**
* Logs a throwable object in debug level. Before outputting the message it checks if debug is enabled or not. If it
* is not enabled the message is not displayed and the String object is not created/concatenated, etc.
*
* @param throwable Throwable object.
*/
private void debug(Throwable throwable) {
if (LOG.isDebugEnabled()) {
LOG.debug(throwable.getMessage(), throwable);
}
}
/**
* @return XML-RPC Client.
*/
public XmlRpcClient getXmlRpcClient() {
return this.xmlRpcClient;
}
/* ------- Utility methods ------- */
/**
* @return the url
*/
public URL getUrl() {
return url;
}
/**
* @return the devKey
*/
public String getDevKey() {
return devKey;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "TestLinkAPI [url=" + url + ", devKey=********]";
}
/* ------- TL API methods ------- */
/* XX Misc operations XX */
/**
* Checks developer key.
*
* @param devKey Developer Key.
* @return true
if devKey is valid, false
otherwise.
* @throws TestLinkAPIException
* @since 1.0
*/
public Boolean checkDevKey(String devKey) throws TestLinkAPIException {
return this.miscService.checkDevKey(devKey);
}
/**
* Checks if the given user exists.
*
* @param user
* @return true
if the user exists, false
otherwise.
* @throws TestLinkAPIException
*/
public Boolean doesUserExist(String user) throws TestLinkAPIException {
return this.miscService.doesUserExist(user);
}
/**
* Get user by login.
*
* @param login
* @return user
* @throws TestLinkAPIException
*/
public User getUserByLogin(String login) throws TestLinkAPIException {
return this.miscService.getUserByLogin(login);
}
/**
* ping method is an alias for sayHello.
*
* @return Hello message.
* @throws TestLinkAPIException
*/
public String ping() throws TestLinkAPIException {
return this.sayHello();
}
/**
* Says hello to the user.
*
* @return Hello message.
* @throws TestLinkAPIException
*/
public String sayHello() throws TestLinkAPIException {
return this.miscService.sayHello();
}
/**
* Displays information about TL.
*
* @return About text.
* @throws TestLinkAPIException
*/
public String about() throws TestLinkAPIException {
return this.miscService.about();
}
/**
*
* @param testMode
* @return Test mode.
* @throws TestLinkAPIException
*/
public Boolean setTestMode(Boolean testMode) throws TestLinkAPIException {
return this.miscService.setTestMode(testMode);
}
/**
*
* @param str
* @return String repeated.
* @throws TestLinkAPIException
*/
public String repeat(String str) throws TestLinkAPIException {
return this.miscService.repeat(str);
}
/**
* Uploads an attachment linking it to a DB table.
*
* @param fkId
* @param fkTable
* @param title
* @param description
* @param fileName
* @param fileType
* @param content
* @return Attachment.
* @throws TestLinkAPIException
*/
public Attachment uploadAttachment(Integer fkId, String fkTable, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.miscService.uploadAttachment(fkId, fkTable, title, description, fileName, fileType, content);
}
/**
* Retrieves the full path of a node. Given a nodeId of, let's say, 10, that is a test case. The return array will
* consist of Name Of Project, Name of Suite, Name of Test Case.
*
* @param nodeId
* @return Array of name of nodes
* @throws TestLinkAPIException
*/
public String[] getFullPath(Integer nodeId) throws TestLinkAPIException {
return this.miscService.getFullPath(nodeId);
}
/**
* Retrieves last execution result of a Test Case.
*
* @param testPlanId
* @param testCaseId
* @param testCaseExternalId
* @return Last Execution.
* @throws TestLinkAPIException
*/
public Execution getLastExecutionResult(Integer testPlanId, Integer testCaseId, Integer testCaseExternalId
) throws TestLinkAPIException {
return this.miscService.getLastExecutionResult(testPlanId, testCaseId, testCaseExternalId);
}
/* XX Test Project operations XX */
/**
* Creates a Test Project.
*
* @param testProjectName
* @param testProjectPrefix
* @param notes
* @param enableRequirements
* @param enableTestPriority
* @param enableAutomation
* @param enableInventory
* @param isActive
* @param isPublic
* @return Test Project object.
* @throws TestLinkAPIException
* @since 1.0
*/
public TestProject createTestProject(String testProjectName, String testProjectPrefix, String notes,
Boolean enableRequirements, Boolean enableTestPriority, Boolean enableAutomation, Boolean enableInventory,
Boolean isActive, Boolean isPublic) throws TestLinkAPIException {
return this.testProjectService.createTestProject(testProjectName, testProjectPrefix, notes, enableRequirements,
enableTestPriority, enableAutomation, enableInventory, isActive, isPublic);
}
/**
* Retrieves a Test Project by its name.
*
* @param projectName Test Project name.
* @return Test Project with given name or null if not found.
* @throws TestLinkAPIException
* @since 1.0
*/
public TestProject getTestProjectByName(String projectName) throws TestLinkAPIException {
return this.testProjectService.getTestProjectByName(projectName);
}
/**
* Retrieves the platforms of a test project.
*
* @param projectId test project ID
* @return platforms array
* @throws TestLinkAPIException if an error occurs when retrieving the platforms
* @since 1.9.6-0
*/
public Platform[] getProjectPlatforms(Integer projectId) throws TestLinkAPIException {
return this.testProjectService.getProjectPlatforms(projectId);
}
/**
* Retrieves all Test Projects from TestLink.
*
* @return an array of Test Projects.
* @throws TestLinkAPIException
* @since 1.0
*/
public TestProject[] getProjects() throws TestLinkAPIException {
return this.testProjectService.getProjects();
}
/**
* Retrieves an array of Test Plans associated to a Test Project.
*
* @param projectId Test Project Id.
* @return Array of Test Plans.
* @throws TestLinkAPIException
*/
public TestPlan[] getProjectTestPlans(Integer projectId) throws TestLinkAPIException {
return this.testProjectService.getProjectTestPlans(projectId);
}
/**
* Uploads an attachment to a Test Project.
*
* @param testProjectId
* @param title
* @param description
* @param fileName
* @param fileType
* @param content
* @return Attachment.
* @throws TestLinkAPIException
*/
public Attachment uploadTestProjectAttachment(Integer testProjectId, String title, String description,
String fileName, String fileType, String content) throws TestLinkAPIException {
return this.testProjectService.uploadTestProjectAttachment(testProjectId, title, description, fileName,
fileType, content);
}
/* XX Test Plan operations XX */
/**
* Creates a Test Plan.
*
* @param planName Test Plan name.
* @param projectName Test Project name.
* @param notes Test Plan notes.
* @param isActive
* @param isPublic
* @throws TestLinkAPIException
* @since 1.0
*/
public TestPlan createTestPlan(String planName, String projectName, String notes, Boolean isActive, Boolean isPublic)
throws TestLinkAPIException {
return this.testPlanService.createTestPlan(planName, projectName, notes, isActive, isPublic);
}
/**
* Retrieves a Test Plan by its name.
*
* @param planName Test Plan name.
* @param projectName Test Project name.
* @return Test Plan.
* @throws TestLinkAPIException
* @since 1.0
*/
public TestPlan getTestPlanByName(String planName, String projectName) throws TestLinkAPIException {
return this.testPlanService.getTestPlanByName(planName, projectName);
}
/**
* Retrieves Platforms of a Test Plan.
*
* @param planId Test Plan Id.
* @return Platforms.
* @throws TestLinkAPIException
*/
public Platform[] getTestPlanPlatforms(Integer planId) throws TestLinkAPIException {
return this.testPlanService.getTestPlanPlatforms(planId);
}
/**
* Gets stats for test plan.
*
* @param testPlanId test plan ID
* @return stats
* @throws TestLinkAPIException
*/
public Map getTotalsForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.testPlanService.getTotalsForTestPlan(testPlanId);
}
/**
* Removes a platform from a test plan.
*
* @param testProjectId test project ID
* @param testPlanId test plan ID
* @param platformName platform name
* @return status message
* @throws TestLinkAPIException
*/
public Map removePlatformFromTestPlan(Integer testProjectId, Integer testPlanId, String platformName) throws TestLinkAPIException {
return this.testPlanService.removePlatformFromTestPlan(testProjectId, testPlanId, platformName);
}
/**
* Adds a platform to a test plan.
*
* @param testProjectId test project ID
* @param testPlanId test plan ID
* @param platformName platform name
* @return status message
* @throws TestLinkAPIException
*/
public Map addPlatformToTestPlan(Integer testProjectId, Integer testPlanId, String platformName) throws TestLinkAPIException {
return this.testPlanService.addPlatformToTestPlan(testProjectId, testPlanId, platformName);
}
/* XX Build operations XX */
/**
* Creates a Build.
*
* @param testPlanId
* @param buildName
* @param buildNotes
* @return Created Build.
* @throws TestLinkAPIException
*/
public Build createBuild(Integer testPlanId, String buildName, String buildNotes) throws TestLinkAPIException {
return this.buildService.createBuild(testPlanId, buildName, buildNotes);
}
/**
* Retrieves an Array of Builds for a given Test Plan.
*
* @param testPlanId Test Plan ID.
* @return Array of Builds.
* @throws TestLinkAPIException
*/
public Build[] getBuildsForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.buildService.getBuildsForTestPlan(testPlanId);
}
/**
* Retrieves the latest Build for a given Test Plan.
*
* @param testPlanId Test Plan ID.
* @return Build.
* @throws TestLinkAPIException
*/
public Build getLatestBuildForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.buildService.getLatestBuildForTestPlan(testPlanId);
}
/**
* Gets the exec counters by build.
*
* @param testPlanId
* @return Map
*/
public Map getExecCountersByBuild(Integer testPlanId) {
return this.buildService.getExecCountersByBuild(testPlanId);
}
/* XX Test Suite operations XX */
public TestSuite createTestSuite(Integer testProjectId, String name, String details, Integer parentId,
Integer order, Boolean checkDuplicatedName, ActionOnDuplicate actionOnDuplicatedName)
throws TestLinkAPIException {
return this.testSuiteService.createTestSuite(testProjectId, name, details, parentId, order,
checkDuplicatedName, actionOnDuplicatedName);
}
/**
* Retrieves Test Suites for given Ids.
*
* @param testSuiteIds List of Test Suite Ids.
* @return Array of Test Suites.
* @throws TestLinkAPIException
*/
public TestSuite[] getTestSuiteByID(List testSuiteIds) throws TestLinkAPIException {
return this.testSuiteService.getTestSuiteByID(testSuiteIds);
}
/**
* Uploads an attachment to a Test Suite.
*
* @param testSuiteId
* @param title
* @param description
* @param fileName
* @param fileType
* @param content
* @return Attachment.
* @throws TestLinkAPIException
*/
public Attachment uploadTestSuiteAttachment(Integer testSuiteId, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.testSuiteService.uploadTestSuiteAttachment(testSuiteId, title, description, fileName, fileType,
content);
}
/**
*
* @param testPlanId
* @return Array of Test Suites of Test Plan.
* @throws TestLinkAPIException
*/
public TestSuite[] getTestSuitesForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.testSuiteService.getTestSuitesForTestPlan(testPlanId);
}
/**
* Get list of TestSuites which are DIRECT children of a given TestSuite
*
* @param testSuiteId
* @throws TestLinkAPIException
*/
public TestSuite[] getTestSuitesForTestSuite(Integer testSuiteId) throws TestLinkAPIException {
return this.testSuiteService.getTestSuitesForTestSuite(testSuiteId);
}
/**
* Get set of test suites AT TOP LEVEL of tree on a Test Project
*
* @param testProjectId
* @throws TestLinkAPIException
*/
public TestSuite[] getFirstLevelTestSuitesForTestProject(Integer testProjectId) throws TestLinkAPIException {
return this.testSuiteService.getFirstLevelTestSuitesForTestProject(testProjectId);
}
/* XX Test Case operations XX */
/**
* Creates a Test Case.
*
* @param testCaseName
* @param testSuiteId
* @param testProjectId
* @param authorLogin
* @param summary
* @param steps
* @param preconditions
* @param status
* @param importance
* @param execution
* @param order
* @param internalId
* @param checkDuplicatedName
* @param actionOnDuplicatedName
* @return TestCase.
* @throws TestLinkAPIException
*/
public TestCase createTestCase(String testCaseName, Integer testSuiteId, Integer testProjectId, String authorLogin,
String summary, List steps, String preconditions, TestCaseStatus status, TestImportance importance,
ExecutionType execution, Integer order, Integer internalId, Boolean checkDuplicatedName,
ActionOnDuplicate actionOnDuplicatedName) throws TestLinkAPIException {
return this.testCaseService.createTestCase(testCaseName, testSuiteId, testProjectId, authorLogin, summary,
steps, preconditions, status, importance, execution, order, internalId, checkDuplicatedName,
actionOnDuplicatedName);
}
/**
* Update an already existing test case with the data of the given test case as a new version.
* @param tc new version of the test case
* @return response map
* @throws TestLinkAPIException if updating the test case fails
*/
public Map updateTestCase(TestCase tc) throws TestLinkAPIException {
return this.testCaseService.updateTestCase(tc);
}
/**
* Create, Update or Push a list of TestCaseSteps in a Test Case.
*
* @param testCaseExternalId
* @param version
* @param testCaseSteps
* @return a Map with results.
* @throws TestLinkAPIException
*/
public Map createTestCaseSteps(Integer testCaseId, String testCaseExternalId, Integer version,
TestCaseStepAction action, List testCaseSteps) throws TestLinkAPIException {
return this.testCaseService.createTestCaseSteps(testCaseId, testCaseExternalId, version, action, testCaseSteps);
}
/**
* Delete a list if TestCaseSteps from a Test Case.
*
* @param testCaseExternalId
* @param version
* @param testCaseSteps
* @return a Map with results.
* @throws TestLinkAPIException
*/
public Map deleteTestCaseSteps(String testCaseExternalId, Integer version,
List testCaseSteps) throws TestLinkAPIException {
return this.testCaseService.deleteTestCaseSteps(testCaseExternalId, version, testCaseSteps);
}
/**
* Adds a Test Case to a Test Plan.
*
* @param testProjectId
* @param testPlanId
* @param testCaseId
* @param version
* @param platformId
* @param order
* @param urgency
* @return Feature ID.
* @throws TestLinkAPIException
*/
public Integer addTestCaseToTestPlan(Integer testProjectId, Integer testPlanId, Integer testCaseId,
Integer version, Integer platformId, Integer order, Integer urgency) throws TestLinkAPIException {
return this.testCaseService.addTestCaseToTestPlan(testProjectId, testPlanId, testCaseId, version, platformId,
order, urgency);
}
/**
* Retrieves Test Cases for a Test Suite.
*
* @param testSuiteId
* @param deep
* @param detail
* @return Array of Test Cases of the Test Suite.
* @throws TestLinkAPIException
*/
public TestCase[] getTestCasesForTestSuite(Integer testSuiteId, Boolean deep, TestCaseDetails detail)
throws TestLinkAPIException {
return this.testCaseService.getTestCasesForTestSuite(testSuiteId, deep, detail);
}
/**
* Get a test case
*
* @param testCaseId
* @param testCaseExternalId
* @param version
* @return Test Case.
* @throws TestLinkAPIException
*/
public TestCase getTestCase(Integer testCaseId, Integer testCaseExternalId, Integer version)
throws TestLinkAPIException {
return this.testCaseService.getTestCase(testCaseId, testCaseExternalId, version);
}
/**
* Get a Test Case using the full external id, composed by the prefix and the external id: prefix-externalId
*
* @param fullTestCaseExternalId Full external id: prefix-externalId
* @param version
* @return Test Case.
* @throws TestLinkAPIException
*/
public TestCase getTestCaseByExternalId(String fullTestCaseExternalId, Integer version) throws TestLinkAPIException {
return this.testCaseService.getTestCaseByExternalId(fullTestCaseExternalId, version);
}
/**
* Retrieves Test Cases for Test Plans.
*
* @param testPlanId
* @param testCasesIds
* @param buildId
* @param keywordsIds
* @param keywords
* @param executed
* @param assignedTo
* @param executeStatus
* @param executionType
* @param getStepInfo
* @return Array of Test Cases of the Test Plan.
* @throws TestLinkAPIException
*/
public TestCase[] getTestCasesForTestPlan(Integer testPlanId, List testCasesIds, Integer buildId,
List keywordsIds, String keywords, // , separated e.g.: database,performance
Boolean executed, List assignedTo, String[] executeStatus, // , separated e.g.: p,n,f
ExecutionType executionType, Boolean getStepInfo, TestCaseDetails detail) throws TestLinkAPIException {
return this.testCaseService.getTestCasesForTestPlan(testPlanId, testCasesIds, buildId, keywordsIds, keywords,
executed, assignedTo, executeStatus, executionType, getStepInfo, detail);
}
/**
* Get a test case ID by a test case Name
*
* @param testCaseName
* @param testSuiteName
* @param testProjectName
* @param testCasePathName
* @return Test Case ID.
* @throws TestLinkAPIException
*/
public Integer getTestCaseIDByName(String testCaseName, String testSuiteName, String testProjectName,
String testCasePathName) throws TestLinkAPIException {
return this.testCaseService.getTestCaseIDByName(testCaseName, testSuiteName, testProjectName, testCasePathName);
}
/**
* Uploads an attachment to a Test Case.
*
* @param testCaseId
* @param title
* @param description
* @param fileName
* @param fileType
* @param content
* @return Attachment.
* @throws TestLinkAPIException
*/
public Attachment uploadTestCaseAttachment(Integer testCaseId, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.testCaseService.uploadTestCaseAttachment(testCaseId, title, description, fileName, fileType,
content);
}
/**
* Return an array of attachments of a Test Case.
*
* @param testCaseId
* @param testCaseExternalId
* @return Array of Attachments.
* @throws TestLinkAPIException
*/
public Attachment[] getTestCaseAttachments(Integer testCaseId, Integer testCaseExternalId)
throws TestLinkAPIException {
return this.testCaseService.getTestCaseAttachments(testCaseId, testCaseExternalId);
}
public Attachment uploadExecutionAttachment(Integer executionId, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.testCaseService.uploadExecutionAttachment(executionId, title, description, fileName, fileType,
content);
}
/**
* Deletes an execution.
*
* @param executionId Execution Id.
* @throws TestLinkAPIException
*/
public void deleteExecution(Integer executionId) throws TestLinkAPIException {
this.testCaseService.deleteExecution(executionId);
}
/**
* Reports a Test Case result.
*
* @param testCaseId
* @param testCaseExternalId
* @param testPlanId
* @param status
* @param buildId
* @param buildName
* @param notes
* @param guess
* @param bugId
* @param platformId
* @param platformName
* @param customFields
* @param overwrite
* @throws TestLinkAPIException
*/
public ReportTCResultResponse reportTCResult(Integer testCaseId, Integer testCaseExternalId, Integer testPlanId,
ExecutionStatus status, Integer buildId, String buildName, String notes, Boolean guess, String bugId,
Integer platformId, String platformName, Map customFields, Boolean overwrite)
throws TestLinkAPIException {
return this.testCaseService.reportTCResult(testCaseId, testCaseExternalId, testPlanId, status, buildId,
buildName, notes, guess, bugId, platformId, platformName, customFields, overwrite);
}
/**
* Reports a Test Case result.
*
* @param testCaseId
* @param testCaseExternalId
* @param testPlanId
* @param status
* @param buildId
* @param buildName
* @param notes
* @param guess
* @param bugId
* @param platformId
* @param platformName
* @param customFields
* @param overwrite
* @throws TestLinkAPIException
*/
public ReportTCResultResponse setTestCaseExecutionResult(Integer testCaseId, Integer testCaseExternalId,
Integer testPlanId, ExecutionStatus status, Integer buildId, String buildName, String notes, Boolean guess,
String bugId, Integer platformId, String platformName, Map customFields, Boolean overwrite)
throws TestLinkAPIException {
return this.testCaseService.reportTCResult(testCaseId, testCaseExternalId, testPlanId, status, buildId,
buildName, notes, guess, bugId, platformId, platformName, customFields, overwrite);
}
/**
* Retrieves list of Custom Fields for a Test Case.
*
* @param testCaseId
* @param testCaseExternalId
* @param versionNumber
* @param testProjectId
* @param customFieldName
* @return Custom Field.
* @throws TestLinkAPIException
*/
public CustomField getTestCaseCustomFieldDesignValue(Integer testCaseId, Integer testCaseExternalId,
Integer versionNumber, Integer testProjectId, String customFieldName, ResponseDetails details)
throws TestLinkAPIException {
return this.testCaseService.getTestCaseCustomFieldDesignValue(testCaseId, testCaseExternalId, versionNumber,
testProjectId, customFieldName, details);
}
/**
* Gets the test plan custom field value
*
* @param testPlanId
* @param testProjectId
* @param customFieldName
* @param details
* @return
* @throws TestLinkAPIException
*/
public CustomField getTestPlanCustomFieldDesignValue(Integer testPlanId, Integer testProjectId,
String customFieldName, ResponseDetails details) throws TestLinkAPIException{
return this.testPlanService.getTestPlanCustomFieldDesignValue(testPlanId, testProjectId, customFieldName, details);
}
/**
* Gets the test case custom field value on test plan design scope.
*
* @param testCaseId
* @param testCaseExternalId
* @param versionNumber
* @param testProjectId
* @param customFieldName
* @param details
* @return
* @throws TestLinkAPIException
*/
public CustomField getTestCaseCustomFieldTestPlanDesignValue(Integer testCaseId, Integer testCaseExternalId,
Integer versionNumber, Integer testProjectId, String customFieldName, ResponseDetails details)
throws TestLinkAPIException {
return this.testCaseService.getTestCaseCustomFieldTestPlanDesignValue(testCaseId, testCaseExternalId,
versionNumber, testProjectId, customFieldName, details);
}
/**
* Gets the test case custom field value on test execution scope.
*
* @param testCaseId
* @param testCaseExternalId
* @param versionNumber
* @param executionId
* @param testProjectId
* @param customFieldName
* @param details
* @return
* @throws TestLinkAPIException
*/
public CustomField getTestCaseCustomFieldExecutionValue(Integer testCaseId, Integer testCaseExternalId,
Integer versionNumber, Integer executionId, Integer testProjectId, String customFieldName,
ResponseDetails details) throws TestLinkAPIException {
return this.testCaseService.getTestCaseCustomFieldExecutionValue(testCaseId, testCaseExternalId, versionNumber,
executionId, testProjectId, customFieldName, details);
}
/**
* Gets list of keywords for a given Test case
*
* @param testProjectId
* @param testCaseId
* @return
* @throws TestLinkAPIException
*/
public List getTestCaseKeywords(Integer testProjectId, Integer testCaseId) throws TestLinkAPIException {
return this.testCaseService.getTestCaseKeywords(testProjectId, testCaseId);
}
/**
* Sets the test case execution type.
*
* @param testProjectId
* @param testCaseExternalId
* @param versionNumber
* @param executionType
* @return Map
*/
public Map setTestCaseExecutionType(Integer testProjectId, Integer testCaseId,
Integer testCaseExternalId, Integer versionNumber, ExecutionType executionType) {
return this.testCaseService.setTestCaseExecutionType(testProjectId, testCaseId, testCaseExternalId,
versionNumber, executionType);
}
/**
* Update the value of an existing custom field for a Test Case
* @param testCaseId
* @param versionNumber
* @param testProjectId
* @param customFieldName
* @param customFieldValue
* @return Map
*/
public Map updateTestCaseCustomFieldDesignValue(Integer testCaseId, Integer versionNumber, Integer testProjectId, String customFieldName, String customFieldValue) {
return this.testCaseService.updateTestCaseCustomFieldDesignValue(testCaseId, versionNumber, testProjectId, customFieldName, customFieldValue);
}
/**
* Assign user to execute Test Case in Test Plan
*
* @param testPlanId
* @param testCaseExternalId
* @param user
* @param buildName
* @throws TestLinkAPIException
*/
public void assignTestCaseExecutionTask(Integer testPlanId, String testCaseExternalId, String user,
String buildName) throws TestLinkAPIException {
this.testCaseService.assignTestCaseExecutionTask(testPlanId, testCaseExternalId, user, buildName);
}
/* XX Requirements Specification operations XX */
/**
* Uploads an attachment to a Requirement Specification.
*
* @param reqSpecId
* @param title
* @param description
* @param fileName
* @param fileType
* @param content
* @return Attachment.
* @throws TestLinkAPIException
*/
public Attachment uploadRequirementSpecificationAttachment(Integer reqSpecId, String title, String description,
String fileName, String fileType, String content) throws TestLinkAPIException {
return this.reqSpecService.uploadRequirementSpecificationAttachment(reqSpecId, title, description, fileName,
fileType, content);
}
/* XX Requirements operations XX */
/**
* Uploads an attachment to a Requirement.
*
* @param requirementId
* @param title
* @param description
* @param fileName
* @param fileType
* @param content
* @return Attachment.
* @throws TestLinkAPIException
*/
public Attachment uploadRequirementAttachment(Integer requirementId, String title, String description,
String fileName, String fileType, String content) throws TestLinkAPIException {
return this.requirementService.uploadRequirementAttachment(requirementId, title, description, fileName,
fileType, content);
}
/**
* Assign a requirements to a Test Case.
*
* @param testCaseId
* @param testProjectId
* @param requirements
* @throws TestLinkAPIException
*/
public void assignRequirements(Integer testCaseId, Integer testProjectId, List requirements)
throws TestLinkAPIException {
this.requirementService.assignRequirements(testCaseId, testProjectId, requirements);
}
/**
* Executes a XML-RPC call. Use this method to talk with TestLink in a lower level.
*
* @param methodName Name of the method.
* @param executionData Execution data map.
* @return Object returned from the server.
* @throws XmlRpcException
* @throws TestLinkAPIException
*/
public Object executeXmlRpcCall(String methodName, Map executionData) throws XmlRpcException,
TestLinkAPIException {
return miscService.executeXmlRpcCall(methodName, executionData);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy