How to create Platforms and Requirements ?

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
LauraG
TestLink user
Posts: 14
Joined: Mon Jul 18, 2016 6:10 pm

How to create Platforms and Requirements ?

Post by LauraG »

Hi !
I am asked to automate the creation of a whole project in TestLink. To do that, I face with 2 major problems.

First problem : I can't manage to create a platform and then assign it to a TestPlan.
As the "createPlatform" method doest not exist, I tried it this way :

Code: Select all

Platform platform=new Platform(id, platformName, platformDescription);
api.addPlatformToTestPlan(projectId, testPlanId, platformName); //where api=new TestLinkAPI(...);
When I execute this, I get the error : "platform does not exist !". So I suppose that just using the "new Platform" method is not enough to add it to the project but is there a way to do that ?

Second problem : I can't manage to create or even just assign a list of requirements to a test case.
I couldn't find any method to create a requirement so I tried just to assign one given its ID, its specification ID and its document ID.
I made it like this :

Code: Select all

Requirement requirement=new Requirement(requirementId, requirementSpecificationId, requirementDocumentId);
requirements.add(requirement); //where requirements is an ArrayList of Requirement
api.assignRequirements(testCaseId, projectId, requirements);
When I execute it, I get the error : "methodResponse element expected but got pre"


If you could help me to resolve one or both of these problem, it would be very nice from you !
Thank you all

Laura
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: How to create Platforms and Requirements ?

Post by fman »

Not all GUI operation has been implemented on API, if something is missing you can try to implement using exiting code as example, not a too difficult thing to do IMHO.

It will be bettere if you provide FULL examples that will allow people to make his/her own tests.
LauraG
TestLink user
Posts: 14
Joined: Mon Jul 18, 2016 6:10 pm

Re: How to create Platforms and Requirements ?

Post by LauraG »

Thank you for your quick answer.
I understand that these functions are then not implemented.
Unfortunately, I can't put a lot of code lines on the internet because of the confidentiality of the project I am working on.

Do you have any explanation about the error giving by the execution of the assignRequirements method ?
To solve this problem, I am trying to send my own xml file using a xml-rpc post method (which I used before and I know it works) but could you please tell me what is the right format to send to testlink to assign requirements ?

Thank you
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: How to create Platforms and Requirements ?

Post by fman »

Have you checked
https://github.com/TestLinkOpenSourceTR ... .class.php

you will find there all implemented methods => createPlatform() exists

What can happens is that client implementation you are using do not implement it.
On testlink distribution there are PHP samples for (theorically) all method implemented

IMHO your best choice is play with these PHP examples to understand is everything is OK
LauraG
TestLink user
Posts: 14
Joined: Mon Jul 18, 2016 6:10 pm

Re: How to create Platforms and Requirements ?

Post by LauraG »

I finally managed to create platforms using my own XML-RPC file.

I still have problem when assigning requirements to test cases.

In the code below :

Code: Select all

 /**
* Assign Requirements to a test case
* we can assign multiple requirements.
* Requirements can belong to different Requirement Spec
*
* @param struct $args
* @param string $args["devKey"]
* @param int $args["testcaseexternalid"]
* @param int $args["testprojectid"]
* @param string $args["requirements"]
* array(array('req_spec' => 1,'requirements' => array(2,4)),
* array('req_spec' => 3,'requirements' => array(22,42))
*
*/
public function assignRequirements($args)
Please could you tell me what the array(2,4) and array(22,42) correspond to ?

Thank you
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: How to create Platforms and Requirements ?

Post by fman »

IMHO is important that conversation is not unidirectional, in order to be useful for other people, then

1. If someone (me) suggest you that something is missing on your api (createPlatform), it would be great if you are kindly enough to confirm is true or false.
2. if you have solved an issue creating your own XML then be kindly enough to share your findings/example (ready to use example) with other people.

If you are not able to share your code because is top secret, then IMHO you can not request help, because people is sharing his/her knowledge with you for free and you not able to give back knowledge. Not fair IMHO. This is all about help/info exchange in both directions.

3. Regarding
array(array('req_spec' => 1,'requirements' => array(2,4)),
array('req_spec' => 3,'requirements' => array(22,42))

not documented (I'm going to improve), but IMHO with a minimal effort and/or trial and error you can figure out that the numbers are the DataBase ID (internal) ID of these entities.
LauraG
TestLink user
Posts: 14
Joined: Mon Jul 18, 2016 6:10 pm

Re: How to create Platforms and Requirements ?

Post by LauraG »

Here is the model xml file I used to create a platform :

Code: Select all

<methodCall>
<methodName>tl.createPlatform</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>devKey</name>
<value>
<string>myDevKey</string>
</value>
</member>
<member>
<name>testprojectname</name>
<value>
<string>myProjectName</string>
</value>
</member>
<member>
<name>platformname</name>
<value>
<string>myPlatformName</string>
</value>
</member>
<member>
<name>notes</name>
<value>
<string>myNotes</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
Thank you for your answers.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: How to create Platforms and Requirements ?

Post by fman »

any news about your requirement creation problems?
LauraG
TestLink user
Posts: 14
Joined: Mon Jul 18, 2016 6:10 pm

Re: How to create Platforms and Requirements ?

Post by LauraG »

I couldn't find any solution to solve the requirement creation problems so I decided to create a XML file which I will have to manually import in TestLink then.
Thank you for your interest
Post Reply