Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

implementation of new methods testlink 2.0 #4

Closed
wants to merge 2 commits into from

4 participants

@franco-gonzalez

getTestCaseCustomFieldExecutionValue
getTestPlanCustomFieldDesignValue
updateTestCaseCustomFieldDesignValue
setTestCaseExecutionTypeAutomatic
setTestCaseExecutionTypeManual

@jorge-mardones
Collaborator
@mario-fuentes
Collaborator

Your commit removes two files:

src/site/resources/images/testlinkjavaapi-logo-white.xcf
src/site/resources/images/testlinkjavaapi-logo-white.png

Why?

@kinow
Owner

Hello @franco-gonzalez, the logo files removed are used in the project web site (http://testlinkjavaapi.sourceforge.net/). They shouldn't be removed, as @mario-fuentes pointed out.

I believe these new methods might be available in TestLink 1.9.4 (https://gitorious.org/testlink-ga/testlink-code/blobs/testlink_1_9/lib/api/xmlrpc.class.php#line280). If so, we could merge it (minus the exclusions?) and get ready for the next release.

Sorry for taking so long to have a look here. Thanks for reviewing it too @mario-fuentes , and thanks for the contribution @franco-gonzalez.

@franco-gonzalez

implementation of the reading of field significance test case

@kinow
Owner

Hi @franco-gonzalez , could you resync your repository, and create a branch with your changes and submit a new pull request, please? We couldn't merge your PR before, and now it cannot be merge automatically anymore. Sorry :-)

If you need any help just let me know, maybe we can branch your current repository, resync and then merge your changes back, and then send a new PR.

Cheers

@kinow kinow closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2012
  1. @franco-gonzalez

    Signed-off-by: franco-gonzalez <franco.gonzalez@rhiscom.com>

    franco-gonzalez authored
    implementation of new methods testlink 2.0
Commits on Apr 4, 2012
  1. @franco-gonzalez

    Signed-off-by: franco-gonzalez <franco.gonzalez@rhiscom.com>

    franco-gonzalez authored
    Implementation of getTestImportance(Integer)
This page is out of date. Refresh to see the latest.
View
85 src/main/java/br/eti/kinoshita/testlinkjavaapi/TestCaseService.java
@@ -788,14 +788,15 @@ protected ReportTCResultResponse reportTCResult(
executionData.put(TestLinkParams.platformName.toString(), platformName);
executionData.put(TestLinkParams.customFields.toString(), customFields);
executionData.put(TestLinkParams.overwrite.toString(), overwrite);
+
Object response = this.executeXmlRpcCall(
TestLinkMethods.reportTCResult.toString(), executionData);
// the error verification routine is called inside super.executeXml...
+
if ( response instanceof Object[] )
{
Object[] responseArray = Util.castToArray(response);
Map<String, Object> responseMap = (Map<String, Object>)responseArray[0];
-
reportTCResultResponse = Util.getReportTCResultResponse( responseMap );
}
}
@@ -864,4 +865,86 @@ else if ( response instanceof Map<?, ?> )
return customField;
}
+
+ protected CustomField getTestCaseCustomFieldExecutionValue(
+ String customfieldname,
+ Integer tprojectid,
+ Integer version,
+ Integer executionid,
+ Integer testplanid)
+ throws TestLinkAPIException {
+ CustomField customField = null;
+ try {
+ Map<String, Object> executionData = new HashMap<String, Object>();
+
+ executionData.put(TestLinkParams.customFieldName.toString(),customfieldname);
+ executionData.put(TestLinkParams.testProjectId.toString(),tprojectid);
+ executionData.put(TestLinkParams.version.toString(), version);
+ executionData.put(TestLinkParams.executionId.toString(),executionid);
+ executionData.put(TestLinkParams.testPlanId.toString(), testplanid);
+
+ Object response = executeXmlRpcCall(
+ TestLinkMethods.getTestCaseCustomFieldExecutionValue
+ .toString(), executionData);
+
+ if (response instanceof String) {
+
+ customField = new CustomField();
+ customField.setValue(response.toString());
+
+ } else if (response instanceof Map<?,?>) {
+
+ Map<String, Object> responseMap = Util.castToMap(response);
+ customField = Util.getCustomField(responseMap);
+
+ }
+ } catch (XmlRpcException xmlrpcex) {
+ throw new TestLinkAPIException((
+ new StringBuilder()).append(
+ "Error retrieving test case custom field value: ").append(
+ xmlrpcex.getMessage()).toString(), xmlrpcex);
+ }
+ return customField;
+ }
+
+ public void updateTestCaseCustomFieldDesignValue(Integer id,
+ Integer version, String testprojectid, Map<String, Object> customfields)
+ throws TestLinkAPIException {
+ try {
+ Map<String, Object> executionData = new HashMap<String, Object>();
+
+ executionData.put(TestLinkParams.testCaseId.toString(),id);
+ executionData.put(TestLinkParams.version.toString(), version);
+ executionData.put(TestLinkParams.testProjectId.toString(),testprojectid);
+ executionData.put(TestLinkParams.customFields.toString(),customfields);
+
+ this.executeXmlRpcCall(
+ TestLinkMethods.updateTestCaseCustomFieldDesignValue
+ .toString(), executionData);
+ } catch (XmlRpcException xmlrpcex) {
+ throw new TestLinkAPIException((new StringBuilder()).append(
+ "Error retrieving test case custom field value: ").append(
+ xmlrpcex.getMessage()).toString(), xmlrpcex);
+ }
+ }
+
+ public void setTestCaseExecutionType(Integer id,
+ Integer version, String testprojectid, Integer executiontype)
+ throws TestLinkAPIException {
+ try {
+ Map<String, Object> executionData = new HashMap<String, Object>();
+ executionData.put(TestLinkParams.testCaseId.toString(),id);
+ executionData.put(TestLinkParams.version.toString(), version);
+ executionData.put(TestLinkParams.testProjectId.toString(),testprojectid);
+ executionData.put(TestLinkParams.executionType.toString(),executiontype);
+
+ this.executeXmlRpcCall(TestLinkMethods.setTestCaseExecutionType
+ .toString(), executionData);
+
+ } catch (XmlRpcException xmlrpcex) {
+ throw new TestLinkAPIException((new StringBuilder()).append(
+ "Error retrieving test case custom field value: ").append(
+ xmlrpcex.getMessage()).toString(), xmlrpcex);
+ }
+ }
}
View
68 src/main/java/br/eti/kinoshita/testlinkjavaapi/TestLinkAPI.java
@@ -52,6 +52,7 @@
import br.eti.kinoshita.testlinkjavaapi.model.ResponseDetails;
import br.eti.kinoshita.testlinkjavaapi.model.TestCase;
import br.eti.kinoshita.testlinkjavaapi.model.TestCaseDetails;
+import br.eti.kinoshita.testlinkjavaapi.model.TestCaseExecutionType;
import br.eti.kinoshita.testlinkjavaapi.model.TestCaseStatus;
import br.eti.kinoshita.testlinkjavaapi.model.TestCaseStep;
import br.eti.kinoshita.testlinkjavaapi.model.TestCaseStepAction;
@@ -1506,6 +1507,73 @@ public void assignRequirements(
testCaseId, testProjectId, requirements);
}
+ public void updateTestCaseCustomFieldDesignValue(
+ Integer id,
+ Integer version,
+ String testprojectid,
+ Map<String,Object> customfields
+ )
+ throws TestLinkAPIException
+ {
+ this.testCaseService.updateTestCaseCustomFieldDesignValue(
+ id,
+ version,
+ testprojectid,
+ customfields);
+ }
+
+ public void setTestCaseExecutionType(
+ Integer id,
+ Integer version,
+ String testprojectid,
+ TestCaseExecutionType testCaseExecutionType
+ )
+ throws TestLinkAPIException
+ {
+ this.testCaseService.setTestCaseExecutionType(
+ id,
+ version,
+ testprojectid,
+ testCaseExecutionType.getValue());
+ }
+
+
+ public CustomField getTestCaseCustomFieldExecutionValue(
+ String customfieldname,
+ Integer tprojectid,
+ Integer version,
+ Integer executionid,
+ Integer testplanid
+ )
+ throws TestLinkAPIException
+ {
+ return this.testCaseService.getTestCaseCustomFieldExecutionValue(
+ customfieldname,
+ tprojectid,
+ version,
+ executionid,
+ testplanid);
+ }
+
+ public CustomField getTestPlanCustomFieldDesignValue(
+ String customfieldname,
+ Integer tprojectid,
+ Integer testplanid
+ )
+ throws TestLinkAPIException
+ {
+ return this.testPlanService.getTestPlanCustomFieldDesignValue(
+ customfieldname,
+ tprojectid,
+ testplanid);
+ }
+
+
+
+
+
+
+
/**
* Executes a XML-RPC call. Use this method to talk with TestLink in a
* lower level.
View
36 src/main/java/br/eti/kinoshita/testlinkjavaapi/TestPlanService.java
@@ -29,6 +29,7 @@
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
+import br.eti.kinoshita.testlinkjavaapi.model.CustomField;
import br.eti.kinoshita.testlinkjavaapi.model.Platform;
import br.eti.kinoshita.testlinkjavaapi.model.TestLinkMethods;
import br.eti.kinoshita.testlinkjavaapi.model.TestLinkParams;
@@ -201,5 +202,40 @@ else if ( response instanceof Map<?, ?> )
return responseMap;
}
+
+ public CustomField getTestPlanCustomFieldDesignValue(
+ String customfieldname,
+ Integer tprojectid,
+ Integer testplanid
+ )
+ throws TestLinkAPIException
+ {
+ CustomField customField = null;
+ try
+ {
+ Map<String, Object> executionData = new HashMap<String, Object>();
+ executionData.put(TestLinkParams.customFieldName.toString(), customfieldname);
+ executionData.put(TestLinkParams.testProjectId.toString(), tprojectid);
+ executionData.put(TestLinkParams.testPlanId.toString(), testplanid);
+ Object response = executeXmlRpcCall(
+ TestLinkMethods.getTestPlanCustomFieldDesignValue.toString(), executionData);
+ if(response instanceof String)
+ {
+ customField = new CustomField();
+ customField.setValue(response.toString());
+ } else
+ if(response instanceof Map<?, ?>)
+ {
+ Map<String, Object> responseMap = Util.castToMap(response);
+ customField = Util.getCustomField(responseMap);
+ }
+ }
+ catch(XmlRpcException xmlrpcex)
+ {
+ throw new TestLinkAPIException(
+ "Error retrieving test plan custom field:", xmlrpcex);
+ }
+ return customField;
+ }
}
View
2  src/main/java/br/eti/kinoshita/testlinkjavaapi/model/ExecutionType.java
@@ -26,7 +26,7 @@ public static ExecutionType getExecutionType( Integer integer )
{
if( integer != null )
{
- if ( integer == 1 )
+ if ( integer == 1)
{
return MANUAL;
}
View
45 src/main/java/br/eti/kinoshita/testlinkjavaapi/model/TestCaseExecutionType.java
@@ -0,0 +1,45 @@
+package br.eti.kinoshita.testlinkjavaapi.model;
+
+public enum TestCaseExecutionType implements IntegerValueEnum {
+
+
+ MANUAL(19),
+ AUTOMATED(2);
+
+ private Integer value;
+
+ TestCaseExecutionType(Integer value)
+ {
+ this.value = value;
+ }
+
+ public static TestCaseExecutionType getTestCaseExecutionType( Integer integer )
+ {
+ if( integer != null )
+ {
+ if ( integer == 19)
+ {
+ return MANUAL;
+ }
+ else if ( integer == 2 )
+ {
+ return AUTOMATED;
+ }
+ }
+ return null;
+ }
+
+ public Integer getValue()
+ {
+ return value;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Enum#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return this.value.toString();
+ }
+}
View
20 src/main/java/br/eti/kinoshita/testlinkjavaapi/model/TestImportance.java
@@ -29,4 +29,24 @@ public String toString()
return this.value;
}
+ public static TestImportance getTestImportance( Integer integer )
+ {
+ if( integer != null )
+ {
+ if ( integer == 1)
+ {
+ return LOW;
+ }
+ else if ( integer == 2 )
+ {
+ return MEDIUM;
+ }
+ else if ( integer == 3 )
+ {
+ return HIGH;
+ }
+ }
+ return null;
+ }
+
}
View
6 src/main/java/br/eti/kinoshita/testlinkjavaapi/model/TestLinkMethods.java
@@ -74,7 +74,11 @@
getBuildsForTestPlan("tl.getBuildsForTestPlan"),
getLatestBuildForTestPlan("tl.getLatestBuildForTestPlan"),
getTestCaseCustomFieldDesignValue("tl.getTestCaseCustomFieldDesignValue"),
- getTotalsForTestPlan("tl.getTotalsForTestPlan")
+ getTotalsForTestPlan("tl.getTotalsForTestPlan"),
+ getTestCaseCustomFieldExecutionValue("tl.getTestCaseCustomFieldExecutionValue"),
+ updateTestCaseCustomFieldDesignValue("tl.updateTestCaseCustomFieldDesignValue"),
+ setTestCaseExecutionType("tl.setTestCaseExecutionType"),
+ getTestPlanCustomFieldDesignValue("tl.getTestPlanCustomFieldDesignValue")
;
private String value;
View
4 src/main/java/br/eti/kinoshita/testlinkjavaapi/util/Util.java
@@ -45,6 +45,7 @@
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.TestImportance;
import br.eti.kinoshita.testlinkjavaapi.model.TestLinkParams;
import br.eti.kinoshita.testlinkjavaapi.model.TestLinkResponseParams;
import br.eti.kinoshita.testlinkjavaapi.model.TestPlan;
@@ -558,6 +559,9 @@ public static final TestCase getTestCase(Map<String, Object> map)
testCase.getSteps().add( step );
}
}
+
+ testCase.setTestImportance(TestImportance.getTestImportance(
+ new Integer((String)map.get("importance"))));
}
}
Something went wrong with that request. Please try again.