Skip to content

Instantly share code, notes, and snippets.

@kinow
Created June 12, 2012 12:58
Show Gist options
  • Save kinow/2917343 to your computer and use it in GitHub Desktop.
Save kinow/2917343 to your computer and use it in GitHub Desktop.
TL API
/*
* The MIT License
*
* Copyright (c) <2012> <Bruno P. Kinoshita>
*
* 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.MalformedURLException;
import java.net.URL;
import br.eti.kinoshita.testlinkjavaapi.constants.ActionOnDuplicate;
import br.eti.kinoshita.testlinkjavaapi.model.TestCase;
import br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException;
/**
*
* @author Bruno P. Kinoshita - http://www.kinoshita.eti.br
* @since 0.1
*/
public class T {
public static void main(String[] args) {
String url = "http://localhost/testlink-1.9.3/lib/api/xmlrpc.php?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=13394533081041";
String devKey = "f7a289d2065ac3ee463a9c0fab5765f2";
TestLinkAPI api = null;
URL testlinkURL = null;
try {
testlinkURL = new URL(url);
} catch ( MalformedURLException mue ) {
mue.printStackTrace( System.err );
System.exit(-1);
}
try {
api = new TestLinkAPI(testlinkURL, devKey);
} catch( TestLinkAPIException te) {
te.printStackTrace( System.err );
System.exit(-1);
}
TestCase tc = api.createTestCase(
"TC Name" //testCaseName
,69 // testSuiteId
, 1// testProjectId
, "admin" //authorLogin
, "<p>This is a sample summary using &amp;'s.</p>" +
"<p>&amp;</p>" +
"<p>&lt;tab-element id=&quot;pendingapprovals&quot;&gt;</p>" //summary
, null //steps
, null //preconditions
, null //importance
, null //execution
, null //order
, null //internalId
, true //checkDuplicatedName
,ActionOnDuplicate.GENERATE_NEW //actionOnDuplicatedName
);
System.out.println(tc);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment