tl.addTestCaseToTestPlan

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
testlinkiscool
Advanced user
Posts: 24
Joined: Mon May 24, 2010 2:24 am

tl.addTestCaseToTestPlan

Post by testlinkiscool »

hi, im using the java api and testlink 1.8.5. i really need to add testcases into a testplan. Everything was passed in correctly.

Code: Select all

public static Object[] AddTestcases(String dev_key, int tpid, int Testid,
			String excaseid, int version) {
	
		String[] params = { "devKey", "testprojectid", "testplanid",
				"testcaseexternalid", "version" };
	
		Object[] values = { DEV_KEY, tpid, Testid, excaseid, version };
	
		System.out.println("values:   " + DEV_KEY + " " + tpid + " " + Testid
				+ " " + excaseid + " " + version);
		Object[] result = callAddCase("tl.addTestCaseToTestPlan", params,
				values);

	
		return result;

	}

Code: Select all

public static Object[] callAddCase(String method, String[] param,
			Object[] values) {
		try {
			XmlRpcClient rpcClient;
			XmlRpcClientConfigImpl config;
			// tpid = 15;
			config = new XmlRpcClientConfigImpl();
			config.setServerURL(new URL(SERVER_URL));
			rpcClient = new XmlRpcClient();
			rpcClient.setConfig(config);
			// HashMap hm = new HashMap();

			ArrayList<Object> arraylist = new ArrayList<Object>();
			HashMap<String, Object> hm = new HashMap<String, Object>();

			// Hashtable<String, Object> executionData = new Hashtable<String,
			// Object>();
		
			hm = new HashMap<String, Object>();
			for (int i = 0; i < param.length; i++) {
				hm.put(param[i], values[i]);
				
			}

			arraylist.add(hm);
		
			System.out.println(arraylist);
			Object[] result = (Object[]) rpcClient.execute(
					"tl.addTestCaseToTestPlan", arraylist);
		
			return result;
		} catch (Exception e) {
			return null;
		}

	}
No errors were shown. However, testcases that were added into a particular testplan did not appeared after i run this methods.. sigh... :(
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: tl.addTestCaseToTestPlan

Post by fman »

till we will have time to give a look, you can try adding debug on xmlrpc.php code and use the php examples.
I know is the solution, but can help if you can not wait

Anyway try with included PHP examples, because you can have more debug info (IMHO)
testlinkiscool
Advanced user
Posts: 24
Joined: Mon May 24, 2010 2:24 am

Re: tl.addTestCaseToTestPlan

Post by testlinkiscool »

Hi fman,
first thing first, thank you for your reply. I only have the client side api with me. The xmlrpc.php shld be located at the server side right? Currently i don't have access to it, i wanted to know if am i the only person that got this bug on 1.8.5? or wait for version 1.9 beta 5 to come out?
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: tl.addTestCaseToTestPlan

Post by fman »

1. you can install a local copy to play with xmlrpc.php
2. for issues is better to use mantis,and then search there to understand if this is an issue, and has been already reported
testlinkiscool
Advanced user
Posts: 24
Joined: Mon May 24, 2010 2:24 am

Re: tl.addTestCaseToTestPlan

Post by testlinkiscool »

1)ok, i will look more into it. :D
2)yeah, i reported this as an issue in testlink mantis. :D
testlinkiscool
Advanced user
Posts: 24
Joined: Mon May 24, 2010 2:24 am

Re: tl.addTestCaseToTestPlan

Post by testlinkiscool »

hi fman, i have installed testlink on localhost. however,what do you mean debug on xmlrpc.php? and where can i locate the php examples? if its cool with you, mind just telling me where to edit and the possibly most direct solution.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: tl.addTestCaseToTestPlan

Post by fman »

See mantis issue for info regarding how to fix it
testlinkiscool
Advanced user
Posts: 24
Joined: Mon May 24, 2010 2:24 am

Re: tl.addTestCaseToTestPlan

Post by testlinkiscool »

check out mantis
AutoTestLink
TestLink user
Posts: 4
Joined: Thu May 27, 2010 12:40 pm

Re: tl.addTestCaseToTestPlan

Post by AutoTestLink »

Hi fman and testlinkcool,
Request you for the mantis URL to check for the defect logged for this method in mantis.

I am getting a similar issue with "addTestCaseToTestPlan".
I am using TestLink 1.8.5 with WAMP.
I tried using Sample client "addTestCaseToTestPlan" php version.
I am getting the following error message when is pass correct values for parameters, both required and optional.
"<br />
<b>Fatal error</b>: Call to undefined function reportFatal() in <b><testlinkinstallpath>\testlink\lib\functions\database.class.php</b> on line <b>193</b><br />

something went wrong - -32700 - parse error. not well formed


Result was: NULL".

But if I pass wrong values to parameters I get the correct error message displayed.
For Example: Test case ID does not exists or invalid value for parameter.

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

Re: tl.addTestCaseToTestPlan

Post by fman »

Please stop this thread, is this is a bug has to be followed on mantis
error you got regarding repotFatal(), has been reported and fixed => search on mantis wihtoit hiding status
AutoTestLink
TestLink user
Posts: 4
Joined: Thu May 27, 2010 12:40 pm

Re: tl.addTestCaseToTestPlan

Post by AutoTestLink »

Hi Fman,
Please read my request again, I only want the Mantis URL and the defect id mapped to this issue. I am not opening this issue again. I know this issue is closed.

Thanks for your help.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: tl.addTestCaseToTestPlan

Post by fman »

Sorry very much but to give info you are requested I need to do same work you have to do: search on mantis.
you can access mantis using the tracker link on left side on home page of www.teamst.org
Post Reply