Coder Social home page Coder Social logo

kinow / testlink-java-api Goto Github PK

View Code? Open in Web Editor NEW
64.0 23.0 86.0 2.61 MB

TestLink Java API

Home Page: http://kinow.github.io/testlink-java-api/

License: MIT License

Java 88.51% PHP 11.29% Dockerfile 0.21%
testlink java java-api xml-rpc hacktoberfest

testlink-java-api's Introduction

TestLink Java API

Build Status Coverage Status Maven Central License

ko-fi

Project homepage: http://kinow.github.io/testlink-java-api

TestLink Java API is a Java API that interfaces TestLink XML-RPC API. This API lets you call TestLink internal methods such as createTestProject, uploadAttachment, getTestProjectByName among others.

Building

The project is built with Maven:

mvn

You can also use the Docker files included in this project repository to set up an environment with the PHP TestLink project. Simply run:

docker-compose up

That should create two containers (web and db). The MySQL database will be available on localhost:3306, and the web application on http://localhost:8000.

Versioning

The API version matches the version of TestLink it was developed for. So for TestLink 1.9.15, you should use testlink-java-api-1.9.15-x. Where x is an internal sequential number, used to distinguish between project releases.

If you use the API version 1.9.15-0 against TestLink 1.9.16, there is no guarantee it will work.

Support

This is an Open Source project. Pull requests are welcome! When reporting issues, please include as much information as possible.

If you have an issue that you need for your organisation and you need it urgentely, please consider contacting the author about sponsored work, or work with companies that contribute to Open Source software. Remember, this is an Open Source project, maintained by volunteers on their spare time.

testlink-java-api's People

Contributors

abouzy avatar chenzhang22 avatar danprogs avatar davidrova avatar dependabot[bot] avatar dida43 avatar eitzenbe avatar gs-spravallika avatar jyoti-c avatar kaiadelmann avatar kinow avatar pozharko avatar ranashahan avatar razalhague avatar rsporny avatar s2obcn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testlink-java-api's Issues

getTestCasesForTestPlan() returns mostly null values

I'm using the testlink-java-api-1.9.4-0 and trying to retrieve all TestCases for a given testplanID:

TestCase[] cases = cliconn.getTestCasesForTestPlan(testplanID,
    null, null, null, null, null, null, null, null,
    null, TestCaseDetails.FULL);

However, whatever TestCaseDetails I pick (e.g., FULL, SIMPLE, or even null), I get the same results with 'name' and 'testSuiteId' and many other values equals null, always something like this:

TestCase [id=70219, name=null, testSuiteId=null, testProjectId=null, authorLogin=null, summary=null, steps=[], preconditions=null, testImportance=null, executionType=1, executionOrder=0, order=null, internalId=null, fullExternalId=35, checkDuplicatedName=null, actionOnDuplicatedName=null, versionId=70220, version=1, parentId=null, customFields=[], executionStatus=p]

Is this a bug or am I missing something here?

CCE on castToMap

Using Testlink 1.9.3 (Prague)
Java API version 1.9.3-0

Getting following error:

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map
at br.eti.kinoshita.testlinkjavaapi.util.Util.castToMap(Util.java:593)
at br.eti.kinoshita.testlinkjavaapi.TestProjectService.getTestProjectByName(TestProjectService.java:115)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.getTestProjectByName(TestLinkAPI.java:450)
at be.vdab.commons.test.util.testlink.TestlinkDataManager.createTestCase(TestlinkDataManager.java:149)
at be.vdab.commons.test.util.testlink.TestlinkDataManager.getTestCase(TestlinkDataManager.java:137)
at be.vdab.commons.test.util.testlink.TestlinkCommunicator.sendToTestLink(TestlinkCommunicator.java:41)
at be.vdab.commons.test.junit.rules.SendToTestLinkWatcher.failed(SendToTestLinkWatcher.java:46)
at org.junit.rules.TestWatcher.failedQuietly(TestWatcher.java:84)
at org.junit.rules.TestWatcher.access$300(TestWatcher.java:46)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:62)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Any ideas?

test result by platform

any option to save test results by platform?
testlink tab "Test execution" have option to generate test resport by platform.
didn't find an option for passing platform in XML-RPC call reportTestCaseResult()

fullExternalId is always null

I'm trying to get fullExternalId:

    TestCase testCase = api.getTestCaseByExternalId("PL-2", 1);
    System.out.println(testCase.getFullExternalId());

but this returns null

At the same time I found commits that indicate that this feature was integrated:
17eda5e
30df0c1

Is this a bug or I do something wrong?

fullexternalid is always null

Testlink cannot overwrite existing testplans

Hello,

I upgraded to Testlink 1.9.9 and Java api 1.9.8-1.
The code handling the Testlink communication did not change but now I get the following stack trace:

br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: There's already a Test Suite with name: Loopbaancheques
    at br.eti.kinoshita.testlinkjavaapi.BaseService.checkResponseError(BaseService.java:123)
    at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:91)
    at br.eti.kinoshita.testlinkjavaapi.TestSuiteService.createTestSuite(TestSuiteService.java:86)
    at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.createTestSuite(TestLinkAPI.java:636)
    at be.vdab.commons.test.util.testlink.TestlinkDataManager.getTestSuite(TestlinkDataManager.java:173)
    at be.vdab.commons.test.util.testlink.TestlinkDataManager.createTestCase(TestlinkDataManager.java:150)
    at be.vdab.commons.test.util.testlink.TestlinkDataManager.getTestCase(TestlinkDataManager.java:137)
    at be.vdab.commons.test.util.testlink.TestlinkCommunicator.sendToTestLink(TestlinkCommunicator.java:43)
    at be.vdab.commons.test.junit.rules.SendToTestLinkWatcher.succeeded(SendToTestLinkWatcher.java:20)
    at org.junit.rules.TestWatcher.succeededQuietly(TestWatcher.java:75)
    at org.junit.rules.TestWatcher.access$100(TestWatcher.java:46)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:56)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

It looks like an existing test plan cannot be appended or overwritten.
As far as I know this worked in the past.

compilation error

Hi Kinow,

I'm getting the Below compilation error , when type the below line.
URL testlinkURL = new URL(BaseTest.testLinkServerUrl); -> Taking value from the properties file.

" Watchpoint:TestLinkConnection [access and modification] - 
     testlinkURL
    - Syntax error on token ";", , expected"
   public final String DEV_KEY = BaseTest.testLinkDevKey;
        URL testlinkURL = new URL(BaseTest.testLinkServerUrl);
       // TestLinkAPI api = null;
        //TestLinkAPI api = null;
        testlinkURL=  new URL(BaseTest.testLinkServerUrl);
        // Substitute your project name Here
        public final String PROJECT_NAME = BaseTest.testLinkProjectName;

        // Substitute your test plan Here
        public final String PLAN_NAME = BaseTest.testLinkPlanName;

        // Substitute your build name
        public final String BUILD_NAME = BaseTest.testLinkBuildName;

        public void updateTestLinkResult(String testCase, String exception, String result) throws TestLinkAPIException 
        {
            TestLinkAPI testlinkAPIClient = new TestLinkAPI(testlinkURL, DEV_KEY);
            //testlinkAPIClient.reportTCResult(testCaseId, testCaseExternalId, testPlanId, status, buildId, buildName, notes, guess, bugId, platformId, platformName, customFields, overwrite)
            testlinkAPIClient.reportTCResult(null, null, null, null, null, testCase,  PLAN_NAME, null, result, null, result, null, null);

        }

can you please advice on this to over come the above error.. Thanks in advance.

Exception in thread "main" br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: HTTP server returned unexpected status: Not Found

Hi,
I am trying to connect to Test Link using following code
URL testlinkURL = new URL(URL);
TestLinkAPI api = new TestLinkAPI(testlinkURL, this.devKey);

where the devKey is the one generated through TestLink -> My settings and the url is
http://testlink.pearsoncmg.com/lib/api/xmlrpc.php

This was working fine but suddenly have started geting the below error
Exception in thread "main" br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: HTTP server returned unexpected status: Not Found
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:63)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:144)
at com.TestLink_Common.setup_Testlink(TestLink_Common.java:33)
at com.TestLink_CreateTestSuite.main(TestLink_CreateTestSuite.java:24)
Caused by: org.apache.xmlrpc.client.XmlRpcHttpTransportException: HTTP server returned unexpected status: Not Found
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(XmlRpcSunHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:152)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:90)
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:60)
... 3 more

Is there something that has got changed?

getTestCaseCustomFieldExecutionValue not working

Hi,

I have seen already issues regarding getTestCaseCustomFieldExecutionValue here and here. First one seems still to be opened, the second one closed. We are using testLink 1.9.13 and still the same error is present:

Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Expected methodResponse element, got pre
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:188)
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
    at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
    at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
    at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
    at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:90)
    at br.eti.kinoshita.testlinkjavaapi.TestCaseService.getTestCaseCustomFieldExecutionValue(TestCaseService.java:689)
    ... 30 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 6; Expected methodResponse element, got pre
    at org.apache.xmlrpc.parser.XmlRpcResponseParser.startElement(XmlRpcResponseParser.java:101)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
    ... 39 more

Is there any update on this? Can maybe someone point me to this method exposed on TestLink interface itself? I would try to write it on my own then and see if it works

Report test case execution duration

The test case execution duration cannot be added when reporting a test case result (see br.eti.kinoshita.testlinkjavaapi.TestCaseService.reportTCResult). It currently has to be inserted manually.

getTestCaseCustomFieldExecutionValue method "protected"

Hi,
I'm updating the version of Testlink Java API to 1.9.8-1 and I found this issue. This method appear with the modifier "protected" instead of "public" and now I can't use it. The same occurs for "getTestCaseCustomFieldTestPlanDesignValue" (I think that this is a change of the name of the method "getTestPlanCustomFieldDesignValue". If is not correct and this is other method, "getTestPlanCustomFieldDesignValue" has dissapeared). Is this some kind of change or just a codification issue?

Regards,
Ricardo.

getTestSuiteByID() does not work with more than one ID in List

The function TestLinkAPI.getTestSuiteByID() works for Lists with one ID, but fails if the List contains more than one ID. The following code demonstrates this using two example TestSuites with IDs 82628 and 82616:

ArrayList<Integer> suiteIds = new ArrayList<Integer>();
suiteIds.add(82628);
TestSuite[] suites = cliconn.getTestSuiteByID(suiteIds);
System.out.println(suites[0]);   // works

suiteIds = new ArrayList<Integer>();
suiteIds.add(82616);
suites = cliconn.getTestSuiteByID(suiteIds);
System.out.println(suites[0]);   // works

suiteIds = new ArrayList<Integer>();
suiteIds.add(82628);
suiteIds.add(82616);
suites = cliconn.getTestSuiteByID(suiteIds);
System.out.println(suites[0]);   // null
System.out.println(suites[1]);   // ArrayIndexOutOfBoundsException

This produces the following output:

TestSuite [id=82628, testProjectId=null, name=...]
TestSuite [id=82616, testProjectId=null, name=...]
null
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException [...]

Error While Integrating TestLink with Maven Pojects

I am shabana, I tried to integrate TestLink with Selenium webDriver using Maven Framework, I use below dependency, but it showing TestLinkAPIClient symbol doesn't exist. What I observed here is TestLinkAPIClient package is missing from the dependency,
So to solve the problem I added TestlinkApIClient api dependency inside Plugin then TESTLINKAPICLIENT problem is resolved but now Maven is unable to
understand WebDriver, Also, When I integrate my framework using TestNG Framwork after downloading full testlinkapiclient package jar,
execution results successfully updated in Testlink. I went through various site but nothing seem to working.

    <dependency>
        <groupId>org.apache.xmlrpc</groupId>
        <artifactId>xmlrpc-common</artifactId>
        <version>3.1.3</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlrpc</groupId>
        <artifactId>xmlrpc-client</artifactId>
        <version>3.1.3</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>2.0.2</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId> 
        <version>3.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>br.eti.kinoshita</groupId>
            <artifactId>testlink-java-api</artifactId>
            <version>LATEST</version>
    </dependency> 

PS:

  1. I have created a group on Googlegroup as well but didn't get any reply from any one : https://groups.google.com/forum/#!forum/selenium-webdriver-integration-maven
    
  2. I have one more question, can I import executed test report through java?, basically do we have any API to import the excuted report through code.
    

Please help me for same ASAP.

Make it possible to retrieve the version with the API

When creating a test case with: ActionOnDuplicate.CREATE_NEW_VERSION

The test case is uploaded to TL, and is either created or added new version.

Problem is that object does not contain version nor version id:

testCase.getVersion() = null

In method createTestCase, on line 108:
Integer version = (Integer)((HashMap<String, Object>) responseMap.get("additionalInfo")).get("version_number");

and then:
testCase.setVersion(version);

Enum ExecutionStatus is missing KNOWN_BUG

When a test execution is marked as 'Known Bug' in the Testlink GUI, the TestCase returned by the testlink-java-api-1.9.4-0 will have an ExecutionStatus == null. However, the TestCase still returned a valid Execution object, but also there the status is null.

In other words: ExecutionStatus == null is currently the same as ExecutionStatus.KNOWN_BUG.

Exception thrown when calling createTestCase()

I've created some simple calls to the api method's. Here's a snippet:

TestSuite ts = null;
TestCase  tc = null;
TestProject project = null;
TestPlan tp = null;

 // Create a Test Project  
        try {
                project = api.createTestProject(
                                "TestLink Java API Test", //testProjectName
                                "TJAT", //testProjectPrefix
                                "Testing Java API Intergration", //notes
                                true, //enableRequirements
                                true, //enableTestPriority
                                true, //enableAutomation
                                false, //enableInventory
                                true, //isActive
                                false); //isPublic
        } catch (TestLinkAPIException e) {
                e.printStackTrace( System.err );
                System.exit(-1);
        }       

    // Create a Test Plan
    try {
         tp = api.createTestPlan("TestLink API Test Plan", "TestLink Java API Project", "Testing TestLink JAVA API", true, false);       
    } catch (TestLinkAPIException e) {
            e.printStackTrace( System.err );
            System.exit(-1);
    }       

    // Create Test Suite
    try {
       TestProject testLinkProject = api.getTestProjectByName("TestLink Java API Project");

       ts = api.createTestSuite(testLinkProject.getId(), "TestLink TestSuite", "Testing TestLink JAVA API library integration", null, 1, true, ActionOnDuplicate.CREATE_NEW_VERSION);
       System.out.println( "Created Test Suite: " + ts.getName() );
    } catch (TestLinkAPIException e) {
       e.printStackTrace( System.err );
       System.exit(1);
    }       

  // Create Test Case
    List<TestCaseStep> steps = new ArrayList<TestCaseStep>();
    TestCaseStep step = new TestCaseStep();
    step.setNumber(1);
    step.setExpectedResults("User name appeared in top menu.");
    step.setExecutionType(null);
    step.setActions("Go to login screen and enter user credentials.");
    steps.add(step);

    try {
    tc = api.createTestCase("TestLink TestCase", ts.getId(), project.getId(), "ValidUserLogin", "TestLink TestCase Summary", steps, null, null, null, new Integer(10), null, true, ActionOnDuplicate.GENERATE_NEW);
   } catch (TestLinkAPIException e) {
      e.printStackTrace( System.err );
      System.exit(1);
   }
   }

The problem I am encountering is that this appears to create the test case successfully, but the code throws an exception.

Exception I am seeing is:

Exception in thread "main" br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error creating test plan: Failed to parse server's response: Expected methodResponse element, got pre
at br.eti.kinoshita.testlinkjavaapi.TestCaseService.createTestCase(TestCaseService.java:128)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.createTestCase(TestLinkAPI.java:742)
at com.directv.TestLinkCheck.main(TestLinkCheck.java:140)
Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Expected methodResponse element, got pre
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:188)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:90)
at br.eti.kinoshita.testlinkjavaapi.TestCaseService.createTestCase(TestCaseService.java:119)
... 2 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 6; Expected methodResponse element, got pre
at org.apache.xmlrpc.parser.XmlRpcResponseParser.startElement(XmlRpcResponseParser.java:101)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
... 11 more
  • TestLink version: 1.9
  • TestLink-java-api: testlink-java-api-1.9.4.0.jar

If someone could provide me with some insight of what I may be doing wrong in the call, that would really help my understanding of the usage. Thanks

Fatal error integrating Jenkins and TestLink

Hi, I'm trying to setup Jenkins and TestLink using your plugin, and I keep getting the Fatal error below. I have followed the steps to setup TestLink and Jenkins according to the tutorial on: http://tupilabs.com/books/jenkins-testlink-plugin-tutorial/en/book.pdf

My configuration is:
Win 7
Jenkins 1.509.4
TestLink 1.9.9
Jenkins-TestLink plugin 3.10

I get the following error when I run the build in Jenkins (and the build fails to finish):

FATAL: br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(Ljava/net/URL;Ljava/lang/String;)V
java.lang.NoSuchMethodError: br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(Ljava/net/URL;Ljava/lang/String;)V
at hudson.plugins.testlink.TestLinkBuilder.getTestLinkSite(TestLinkBuilder.java:307)
at hudson.plugins.testlink.TestLinkBuilder.perform(TestLinkBuilder.java:186)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:565)
at hudson.model.Run.execute(Run.java:1592)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:237)

Any help would be appreciated!!

getSteps() for Test Case returns empty array

Even though the test case in Test Link has steps the Java API method always returns an empty array.

Using 1.9.3-4.jar against 1.9.3 TestLink

Any help greatly appreciated. Thanks

CustomFields

  When I use the getTestCase method I canโ€™t get the custom fields of the test case:

This is what I get:

        TestCase [id=134, name=CdP-OPE06, testSuiteId=6, testProjectId=null, authorLogin=null, summary=<p>prueba</p>, steps=[TestCaseStep [id=136, testCaseVersionId=null, number=1, actions=Go to login screen and enter user credentials., expectedResults=User name appeared in top menu., active=true, executionType=1]], preconditions=<p>prueba</p>, testImportance=null, executionType=1, executionOrder=null, order=10, internalId=null, fullExternalId=Z-51, checkDuplicatedName=null, actionOnDuplicatedName=null, versionId=null, version=1, parentId=null, customFields=[], executionStatus=n, platform=null, featureId=null]

And you can see, in the testlink I have two design custom fields set (Prueba,Prueba2)

Then I found you have comment in the testlinkjava API 1.9.5-0 in the Util.class all the custom fields part:

 testCase.setExecutionStatus(executionStatus);
                testCase.setTestProjectId(getInteger(map, TestLinkParams.TEST_PROJECT_ID.toString()));
                testCase.setTestSuiteId(getInteger(map, TestLinkParams.TEST_SUITE_ID2.toString()));
                // inconsistent
                // parameter
                // name
                // TODO: check if TL 2.0 allows it
                // CustomField[] customFields = (CustomField[])getArray(map,
                // TestLinkResponseParams.customFields.toString());
                // if ( customFields != null )
                // {
                // for (int i = 0; i < customFields.length; i++)
                // {
                // CustomField customField = customFields[i];
                // testCase.getCustomFields().add( customField );
                // }
                // }
                Object[] stepsArray = (Object[]) getArray(map, TestLinkResponseParams.STEPS.toString());
                if (stepsArray != null && stepsArray.length > 0) {
                    for (Object stepObject : stepsArray) {
                        Map<String, Object> stepMap = (Map<String, Object>) stepObject;
                        TestCaseStep step = Util.getTestCaseStep(stepMap);
                        testCase.getSteps().add(step);
                    }
                }
            }

So I try do discommended this part and make my own Util.class put it didnโ€™t work, jejejejej.

Then I may be found another bug, it is for getTestCaseCustomFieldDesignValue, it donโ€™t get the value inside the customfield object:

But when I discommended the part inside the util.class, for my surprise I can get the value... see

This is my TestlinkAPI.class:

package com.testselenium.subirtest;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.apache.xmlrpc.XmlRpcException;

import br.eti.kinoshita.testlinkjavaapi.TestLinkAPI;
import br.eti.kinoshita.testlinkjavaapi.constants.TestLinkMethods;
import br.eti.kinoshita.testlinkjavaapi.constants.TestLinkParams;
import br.eti.kinoshita.testlinkjavaapi.model.TestCase;
import br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException;
import br.eti.kinoshita.testlinkjavaapi.util.Util;

public class A extends TestLinkAPI {

  public A(URL url, String devKey) throws TestLinkAPIException {
        super(url, devKey);
  }

  /**
  * Get a test case
  * 
   * @param testCaseId
  * @param testCaseExternalId
  * @param version
  * @return Test Case.
  * @throws TestLinkAPIException
  */
  public TestCase getTestCase(Integer testCaseId, Integer testCaseExternalId, Integer version, Integer projectId)
              throws TestLinkAPIException {
        TestCase testCase = null;

        try {
              Map<String, Object> executionData = new HashMap<String, Object>();


              executionData.put(TestLinkParams.TEST_PROJECT_ID.toString(), projectId);

              executionData.put(TestLinkParams.TEST_CASE_ID.toString(), testCaseId);
              executionData.put(TestLinkParams.TEST_CASE_EXTERNAL_ID.toString(), testCaseExternalId);
              executionData.put(TestLinkParams.VERSION.toString(), version);

              Object response = this.executeXmlRpcCall(TestLinkMethods.GET_TEST_CASE.toString(), executionData);

// Object response = this.executeXmlRpcCall(TestLinkMethods.GET_TEST_CASE_CUSTOM_FIELD_DESIGN_VALUE.toString(), executionData);

              Object[] responseArray = Util.castToArray(response);
              Map<String, Object> responseMap = (Map<String, Object>) responseArray[0];

              testCase = Util_A.getTestCase(responseMap);
        } catch (XmlRpcException xmlrpcex) {
              throw new TestLinkAPIException("Error getting test case info : " + xmlrpcex.getMessage(), xmlrpcex);
        }

        return testCase;
  }

}

This is my Testlink util.class

package com.testselenium.subirtest;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import br.eti.kinoshita.testlinkjavaapi.constants.ExecutionStatus;
import br.eti.kinoshita.testlinkjavaapi.constants.ExecutionType;
import br.eti.kinoshita.testlinkjavaapi.constants.TestLinkParams;
import br.eti.kinoshita.testlinkjavaapi.constants.TestLinkResponseParams;
import br.eti.kinoshita.testlinkjavaapi.model.CustomField;
import br.eti.kinoshita.testlinkjavaapi.model.Platform;
import br.eti.kinoshita.testlinkjavaapi.model.TestCase;
import br.eti.kinoshita.testlinkjavaapi.model.TestCaseStep;
import br.eti.kinoshita.testlinkjavaapi.util.Util;

public class Util_A {

  public static final Object[] EMPTY_ARRAY = new Object[0];
  public static final Map<String, Object> EMPTY_MAP = new HashMap<String, Object>();

  /**
  * @param map
  * @return Test Case.
  */
  @SuppressWarnings("unchecked")
  public static final TestCase getTestCase(Map<String, Object> map) {
        TestCase testCase = null;
        if (map != null && map.size() > 0) {
              // IMPORTANT: http://mantis.testlink.org/view.php?id=4784
              // Different methods to recover test cases use different parameter
              // names for the id, some uses "id" and others "testcase_id".
              Object o = map.get(TestLinkResponseParams.TEST_CASE_ID.toString());
              if (o == null) {
                    o = map.get(TestLinkResponseParams.ID.toString());
              }

              if (o != null) {
                    Integer id = Integer.parseInt(o.toString());

                    if (id > 0) {
                         testCase = new TestCase();
                         testCase.setId(id);
                         testCase.setVersionId(getInteger(map, TestLinkResponseParams.TEST_CASE_VERSION_ID.toString()));
                         testCase.setVersion(getInteger(map, TestLinkResponseParams.VERSION.toString()));
                         testCase.setPreconditions(getString(map, TestLinkResponseParams.PRECONDITIONS.toString()));
                         testCase.setSummary(getString(map, TestLinkResponseParams.SUMMARY.toString()));
                         testCase.setParentId(getInteger(map, TestLinkResponseParams.PARENT_ID.toString()));
                         testCase.setOrder(getInteger(map, TestLinkResponseParams.ORDER.toString()));
                         testCase.setExecutionOrder(getInteger(map, TestLinkResponseParams.EXECUTION_ORDER.toString()));
                         testCase.setName(getString(map, TestLinkResponseParams.NAME.toString()));

                         Platform platform = null;
                         String platformName = getString(map, TestLinkResponseParams.PLATFORM_NAME.toString());
                         Integer platformId = getInteger(map, TestLinkResponseParams.PLATFORM_ID.toString());
                         if (platformName != null || platformId != null) { // sometimes
                               // TL
                               // may
                               // return
                               // only
                               // one
                               // or
                               // the
                               // other
                               platform = new Platform();
                               platform.setId(platformId);
                               platform.setName(platformName);
                         }
                         testCase.setPlatform(platform);

                         testCase.setFeatureId(getInteger(map, TestLinkResponseParams.FEATURE_ID.toString()));

                         // IMPORTANT: the full external id (composed by
                         // prefix-external_id) come on
                         // different parameters depending of what methods was used.
                         //
                         // In 'getTestCase' -> 'full_tc_external_id'
                         // In 'getTestCasesForTestSuite' -> 'external_id'
                         // In 'getTestCasesForTestPlan' does not come (ToDo: add)
                         String fullExternalId = getString(map, TestLinkResponseParams.FULL_TEST_CASE_EXTERNAL_ID.toString());
                         if (fullExternalId == null) {
                               fullExternalId = getString(map, TestLinkResponseParams.FULL_TEST_CASE_EXTERNAL_ID2.toString());
                               if (fullExternalId == null) {
                                     fullExternalId = getString(map, TestLinkResponseParams.EXTERNAL_ID.toString());
                               }
                         }
                         testCase.setFullExternalId(fullExternalId);

                         Integer executionTypeValue = getInteger(map, TestLinkResponseParams.EXECUTION_TYPE.toString());
                         ExecutionType execution = ExecutionType.getExecutionType(executionTypeValue);
                         testCase.setExecutionType(execution);
                         ExecutionStatus executionStatus = ExecutionStatus.NOT_RUN;
                         String executionStatusText = getString(map, TestLinkResponseParams.EXEC_STATUS.toString());
                         if (StringUtils.isNotBlank(executionStatusText)) {
                               executionStatus = ExecutionStatus.getExecutionStatus(executionStatusText.charAt(0));
                         }
                         testCase.setExecutionStatus(executionStatus);
                         testCase.setTestProjectId(getInteger(map, TestLinkParams.TEST_PROJECT_ID.toString()));
                         testCase.setTestSuiteId(getInteger(map, TestLinkParams.TEST_SUITE_ID2.toString()));
                         // inconsistent
                         // parameter
                         // name
                         // TODO: check if TL 2.0 allows it
                         CustomField[] customFields = (CustomField[]) getArray(map,
                                     com.testselenium.subirtest.TestLinkResponseParams.CUSTOM_FIELDS.toString());
                         if (customFields != null) {
                               for (int i = 0; i < customFields.length; i++) {
                                     CustomField customField = customFields[i];
                                     testCase.getCustomFields().add(customField);
                               }
                         }
                         Object[] stepsArray = (Object[]) getArray(map, TestLinkResponseParams.STEPS.toString());
                         if (stepsArray != null && stepsArray.length > 0) {
                               for (Object stepObject : stepsArray) {
                                     Map<String, Object> stepMap = (Map<String, Object>) stepObject;
                                     TestCaseStep step = Util.getTestCaseStep(stepMap);
                                     testCase.getSteps().add(step);
                               }
                         }
                    }

              }
        }
        return testCase;
  }

  /**
  * @param map
  * @param key
  * @return Integer value.
  */
  public static final Integer getInteger(Map<String, Object> map, String key) {
        Integer integer = null;
        if (map != null && map.size() > 0) {
              Object o = map.get(key);
              if (o != null) {
                    try {
                         integer = Integer.parseInt(o.toString());
                    } catch (NumberFormatException nfe) {
                         integer = null;
                    }
              }
        }
        return integer;
  }

  /**
  * @param map
  * @param key
  * @return String value.
  */
  public static final String getString(Map<String, Object> map, String key) {
        String string = null;
        if (map != null && map.size() > 0) {
              Object o = map.get(key);
              if (o != null) {
                    string = o.toString();
              }
        }
        return string;
  }

  /**
  * @param map
  * @param key
  * @return Array of objects.
  */
  public static Object[] getArray(Map<String, Object> map, String key) {
        Object[] array = null;
        if (map != null && map.size() > 0) {
              Object o = map.get(key);
              array = castToArray(o);
        }
        return array;
  }

  /**
  * 
   * @param object
  * @return Array of objects
  */
  public static Object[] castToArray(Object object) {
        Object[] array = null;

        if (object != null) {
              if (object instanceof String) {
                    array = EMPTY_ARRAY;
              } else {
                    array = (Object[]) object;
              }
        }

        return array;
  }

I Hope this can help you to fix it, I wil still trying to update design customfieldsโ€ฆ..

sorry but i cant attach the pics...

Reporting test results from soapUI to Testlink with result=NOT_RUN fails

Hi!
I'm using soapUI 4.0.1, testlink-java-api-1.9.8-1, testlink-api-client-2.0.
The problem that I encountered is the following:

In my soapUI project I have a groovy script that creates a file for execution results; second groovy script that loops through all Test Steps for each Test Case and depending on testStep.assertionStatus.toString (UNKNOWN, VALID or FAILED) writes results to this file, and the third script that reads results from the file and using testlinkAPIClient.reportTCResult sends results to TestLink. Parameter "ExecutionStatus status" for reportTCResult can be ExecutionStatus.PASSED, ExecutionStatus.FAILED or ExecutionStatus.NOT_RUN. The first two work fine, but when it gets to NOT_RUN I have error message "ERROR:br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: The status code (n) provided is not valid!"

Maybe I'm doing smth wrong...I don't know... Did anyone have the same issue?

java.lang.ClassCastException when connecting from jenkins to testlink

Sorry but I donยดt knokw whether this is the proper place to post this issue...

OS: ubuntu 12.03
DB: MySql
PHP: 5.4.22

And the maven dependency is:

br.eti.kinoshita testlink-java-api 1.9.6-1 compile

When we connect from Jenkins to Testlink through testlink java API, we met the
following problem:

09:57:13 java.lang.ClassCastException: java.util.HashMap cannot be cast to
[Ljava.lang.Object;
09:57:13 at
br.eti.kinoshita.testlinkjavaapi.util.Util.castToArray(Util.java:566)
09:57:13 at
br.eti.kinoshita.testlinkjavaapi.TestCaseService.getTestCaseIDByName(TestCaseService.java:392)
09:57:13 at
br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.getTestCaseIDByName(TestLinkAPI.java:840)
09:57:13 at
de.zalando.test_framework.cucumber.reporter.TestLinkReporter.commitTestResults(TestLinkReporter.java:159)
09:57:13 at
de.zalando.test_framework.cucumber.reporter.TestLinkReporter.reportToTestLink(TestLinkReporter.java:151)
09:57:13 at
de.zalando.test_framework.cucumber.reporter.TestLinkReporter.scenario(TestLinkReporter.java:66)
09:57:13 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
09:57:13 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
09:57:13 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
09:57:13 at java.lang.reflect.Method.invoke(Method.java:601)
09:57:13 at cucumber.runtime.Utils$1.call(Utils.java:35)
09:57:13 at cucumber.runtime.Timeout.timeout(Timeout.java:12)
09:57:13 at cucumber.runtime.Utils.invoke(Utils.java:31)
09:57:13 at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:151)
09:57:13 at $Proxy18.scenario(Unknown Source)
09:57:13 at
cucumber.runtime.junit.JUnitReporter.scenario(JUnitReporter.java:161)
09:57:13 at gherkin.formatter.model.Scenario.replay(Scenario.java:18)
09:57:13 at cucumber.runtime.model.StepContainer.format(StepContainer.java:31)
09:57:13 at
cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:39)
09:57:13 at
cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:83)
09:57:13 at
cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
09:57:13 at
cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
09:57:13 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
09:57:13 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
09:57:13 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
09:57:13 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
09:57:13 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
09:57:13 at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
09:57:13 at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
09:57:13 at cucumber.api.junit.Cucumber.runChild(Cucumber.java:82)
09:57:13 at cucumber.api.junit.Cucumber.runChild(Cucumber.java:41)
09:57:13 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
09:57:13 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
09:57:13 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
09:57:13 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
09:57:13 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
09:57:13 at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
09:57:13 at cucumber.api.junit.Cucumber.run(Cucumber.java:87)
09:57:13 at
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
09:57:13 at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
09:57:13 at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
09:57:13 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
09:57:13 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
09:57:13 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
09:57:13 at java.lang.reflect.Method.invoke(Method.java:601)
09:57:13 at
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
09:57:13 at
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
09:57:13 at
org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
09:57:13 at
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:113)
09:57:13 at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Selenium WebDriver Screenshot uploadExecutionAttachment

Hi,

I'm using Selenium and Testlink :
when a test is wrong, the webdriver take a screenshot and save it in file. The goal is to upload the screenshot on testlink.
Here's my code :

List<TestCaseFile> files = fileService.getFiles(test.getId());  
            for (TestCaseFile file : files) {
                try {
                    File attachmentFile = new File(test.getInputData()
                            + File.separator + file.getFilename());

                    String fileContent = null;
                    try {
                        byte[] byteArray = FileUtils
                                .readFileToByteArray(attachmentFile);
                        fileContent = new String(
                                Base64.encodeBase64(byteArray));
                    } catch (IOException e) {
                        e.printStackTrace(System.err);
                        System.exit(-1);
                    }
                    api.uploadExecutionAttachment(
                            result.getExecutionId(), // executionId
                            file.getFilename(), // title
                            file.getDescription(), // description
                            file.getFilename(), // fileName
                            "image/jpeg", // fileType
                            fileContent); // content

                } catch (Exception ex) {
                    ex.printStackTrace();
                }

            }

But i get an error :
br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error uploading attachment for execution: parse error. not well formed

Do you have any idea ?
Thanks.
Yan.

Cannot locate configuration source testlinkjavaapi.properties

I am getting the Error verifying developer key: Failed to parse server's response: Expected methodResponse element, got br
After some debugging I found it was being caused by the above error. Here is the stacktrace:
09:18:15.294 [pool-1-thread-2] DEBUG b.e.k.testlinkjavaapi.TestLinkAPI - Cannot locate configuration source testlinkjavaapi.properties
org.apache.commons.configuration.ConfigurationException: Cannot locate configuration source testlinkjavaapi.properties
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:249) ~[commons-configuration-1.7.jar:1.7]
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:229) ~[commons-configuration-1.7.jar:1.7]
at org.apache.commons.configuration.AbstractFileConfiguration.(AbstractFileConfiguration.java:149) ~[commons-configuration-1.7.jar:1.7]
at org.apache.commons.configuration.PropertiesConfiguration.(PropertiesConfiguration.java:252) ~[commons-configuration-1.7.jar:1.7]
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.createApplicationConfiguration(TestLinkAPI.java:157) [testlink-java-api-1.9.13-0.jar:na]
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:130) [testlink-java-api-1.9.13-0.jar:na]
at ec.ncsc.mil.sit.testlink.TestLinkIntegration.(TestLinkIntegration.java:37) [classes/:na]
at ec.ncsc.mil.sit.form810c.Form810cTest.setUp(Form810cTest.java:62) [test-classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [junit-4.11.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [junit-4.11.jar:na]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) [junit-4.11.jar:na]
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [junit-4.11.jar:na]
at com.github.webdriverextensions.junitrunner.WebDriverRunner.runChild(WebDriverRunner.java:272) [webdriverextensions-1.5.0.jar:na]
at com.github.webdriverextensions.junitrunner.WebDriverRunner.runChild(WebDriverRunner.java:86) [webdriverextensions-1.5.0.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na]
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387) [surefire-junit47-2.18.1.jar:2.18.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_79]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
09:18:15.344 [pool-1-thread-2] DEBUG b.e.k.testlinkjavaapi.TestLinkAPI - 'xmlrpc.connectionTimeout' doesn't map to an existing object
java.util.NoSuchElementException: 'xmlrpc.connectionTimeout' doesn't map to an existing object
at org.apache.commons.configuration.AbstractConfiguration.getInt(AbstractConfiguration.java:822) ~[commons-configuration-1.7.jar:1.7]
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.createXmlRpcClientConfiguration(TestLinkAPI.java:184) [testlink-java-api-1.9.13-0.jar:na]
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:133) [testlink-java-api-1.9.13-0.jar:na]
at ec.ncsc.mil.sit.testlink.TestLinkIntegration.(TestLinkIntegration.java:37) [classes/:na]
at ec.ncsc.mil.sit.form810c.Form810cTest.setUp(Form810cTest.java:62) [test-classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) [junit-4.11.jar:na]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.11.jar:na]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) [junit-4.11.jar:na]
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) [junit-4.11.jar:na]
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.11.jar:na]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) [junit-4.11.jar:na]
at com.github.webdriverextensions.junitrunner.WebDriverRunner.runChild(WebDriverRunner.java:272) [webdriverextensions-1.5.0.jar:na]
at com.github.webdriverextensions.junitrunner.WebDriverRunner.runChild(WebDriverRunner.java:86) [webdriverextensions-1.5.0.jar:na]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) [junit-4.11.jar:na]
at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:387) [surefire-junit47-2.18.1.jar:2.18.1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_79]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]

I looked in the project root but cannot find this properties file. Where can i find this properties file?
I am using TL 1.9.13 with api version 1.9.13-0

Thanks Brian

Unable to pass host name verification class

Hello

We are using testlink on https url. Unfortunatelly we do not have proper hostname in the server certificate. I want to pass fake host name verifier to SSL connection factory to work on against this server. Please add this or let me now how to o it. Now I see this error connecting the server:

br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: Failed to read server's response: java.security.cert.CertificateException: No name matching testlink found
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:64)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:145)
at testlink.Main.(Main.java:32)
at testlink.Main.main(Main.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.apache.xmlrpc.XmlRpcException: Failed to read server's response: java.security.cert.CertificateException: No name matching testlink found
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:161)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:90)
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:61)
... 8 more
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching testlink found
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1937)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1478)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:969)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:904)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1050)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1363)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1391)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1375)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1282)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1257)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.writeRequest(XmlRpcSunHttpTransport.java:104)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:151)
... 16 more
Caused by: java.security.cert.CertificateException: No name matching testlink found
at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:208)
at sun.security.util.HostnameChecker.match(HostnameChecker.java:93)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:436)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:200)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1460)
... 30 more

Process finished with exit code 255

What happened to the execution_ts?

How is it possible to get the Execution date/time of a TestCase using testlink-java-api-1.9.4? It seems that value has vanished out of the API...

Ability to get Requirements linkings and properties

The API should provide ways to get Requirements linkings to Test Cases (for example, it should give the Map of requirements linked to TC-1) and their properties (for example, Req Status, Coverage, Relations ...)

How to retrieve Attachments for other objects than just TestCases?

Hi,

I have two questions regarding attachments:

  1. It seems that with the current testlink-java-api (1.9.14-0) attachments can be uploaded for test cases, test projects, test suites, and executions. However, it's only possible to get them for test cases, they cannot be downloaded for any of the other Testlink objects. Is that true?
  2. Is there any possibility to retrieve an image embedded in a rich-text field? For example, in Testlink you can insert images directly into a TestCase summary, precondition or other rich-text fields. While I'm able to retrieve and decode such fields, they only contain the name of the image file in an HTML element like <img src="smiley.gif"> and I don't know how download that image through the API. Can you provide any advice on this?

Regards,
Dominik

Exception in thread "main" br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: Failed to parse server's response: Expected methodResponse element, got br

hi kniow
I am getting Following exception

Exception in thread "main" br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: Failed to parse server's response: Expected methodResponse element, got br
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:64)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:145)
at com.TestLink_Common.setup_Testlink(TestLink_Common.java:33)
at com.UpdateManualTestResults.main(UpdateManualTestResults.java:26)
Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Expected methodResponse element, got br
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:188)

I am using
Url; http://testlink.pearsoncmg.com/lib/api/xmlrpc.php
JavaApi=testlink-java-api-1.9.8-1.jar (i tried all from testlink-java-api-1.9.6-0)
My testlink version is 1.9.11

When i tried following with restapi
http://testlink.pearsoncmg.com/lib/api/xmlrpc/v1/xmlrpc.php?devKey=$$$$$$$$$$$$$$$
devKey is the one generated through TestLink -> My settings

i Got the following result


Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0



Warning: Cannot modify header information - headers already sent in Unknown on line 0

XML-RPC server accepts POST requests only.

Can you please suggest a solution?

Method getTestPlanCustomFieldDesignValue() missed

I'm upgrading the version of Testlink Java API bla bla bla... (I mentioned a couple of hours ago) and notice that the method "getTestPlanCustomFieldDesignValue()" is missing. It's got the following signature (from TestLinkAPI.java):

public CustomField getTestPlanCustomFieldDesignValue(String customfieldname, Integer tprojectid, Integer testplanid) throws TestLinkAPIException {
//compiled code
throw new RuntimeException("Compiled Code");
}

Please take a look.

Regards again,
Ricardo.

Relevant Bugs

My Testlink project is configured with JIRA issue tracking support, so we can link executed test cases to JIRA issues. The Testlink GUI shows linked JIRA issues for a selected test execution.

Is it possible to retrieve this list of issue also through the Java Testlink API? I searched a lot but did not find any method to achieve this...

Greetings,
Dominik

getTestSuitesForTestPlan() always return order=null

The function TestLinkAPI.getTestSuitesForTestPlan() does not return a valid node order, but always returns order=null.

TestSuite [id=82628, testProjectId=null, name=NestedTestsuite,
details=null, parentId=82616, order=null,
checkDuplicatedName=null, actionOnDuplicatedName=null]

It should behave like the function TestLinkAPI.getTestSuiteByID().

TestSuite [id=82628, testProjectId=null, name=NestedTestsuite,
details=<p>:)</p>, parentId=82616, order=101,
checkDuplicatedName=null, actionOnDuplicatedName=null]

Check the value of urgency that is being used in TestCaseService

From:

Due to my nature as professional Test Manger, I've found a bug in your API v1.9.4-1 till 1.9.6.0.

I got errors while adding TestCases to TestPlans.
You're mapping the 'urgency' value to the 'TestCaseID' value which leads to problems, when the TestCaseIDs have large values.

Please check your code in:

  • TestCaseService.java
  • Line 183

https://github.com/kinow/testlink-java-api/blob/master/src/main/java/br/eti/kinoshita/testlinkjavaapi/TestCaseService.java#L183

Currently wrong:

  • executionData.put(TestLinkParams.URGENCY.toString(), testCaseId);
    

Corrected should be:

  • executionData.put(TestLinkParams.URGENCY.toString(), urgency);
    

It would be very nice if you could fix that and provide a new version.

Thanks in advance and kind regards
Kris

getTestCaseCustomFieldExecutionValue not working

I got the following exception when calling that api:
[export_tests] br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error retrieving test case custom field value: Failed to parse server's response: Expected methodResponse element, got pre
[export_tests] at br.eti.kinoshita.testlinkjavaapi.TestCaseService.getTestCaseCustomFieldExecutionValue(TestCaseService.java:701)
[export_tests] at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.getTestCaseCustomFieldExecutionValue(TestLinkAPI.java:995)
[export_tests] at br.eti.kinoshita.testlinkjavaapi.TestLinkFacade.getExecutionCustomField(TestLinkFacade.java:140)
[export_tests] at br.eti.kinoshita.testlinkjavaapi.TestLinkFacade.getLastExecutionDate(TestLinkFacade.java:128)
[export_tests] at br.eti.kinoshita.testlinkjavaapi.TestCaseFacade.addExecutionResult(TestCaseFacade.java:22)
[export_tests] at com.orga.testlink.result.RcpTestResultBuilder.closeTest(RcpTestResultBuilder.java:93)
[export_tests] at com.orga.testlink.result.TestResultsDirector.directInternal(TestResultsDirector.java:146)
[export_tests] at com.orga.testlink.result.TestResultsDirector.direct(TestResultsDirector.java:115)
[export_tests] at com.orga.testlink.ant.FitnesseResultParserTask.execute(FitnesseResultParserTask.java:42)
[export_tests] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[export_tests] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[export_tests] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[export_tests] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[export_tests] at java.lang.reflect.Method.invoke(Method.java:597)
[export_tests] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[export_tests] at org.apache.tools.ant.Task.perform(Task.java:348)
[export_tests] at org.apache.tools.ant.Target.execute(Target.java:392)
[export_tests] at org.apache.tools.ant.Target.performTasks(Target.java:413)
[export_tests] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[export_tests] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[export_tests] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[export_tests] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[export_tests] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[export_tests] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
[export_tests] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
[export_tests] Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Expected methodResponse element, got pre
[export_tests] at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:188)
[export_tests] at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
[export_tests] at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
[export_tests] at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
[export_tests] at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
[export_tests] at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
[export_tests] at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
[export_tests] at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
[export_tests] at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:90)
[export_tests] at br.eti.kinoshita.testlinkjavaapi.TestCaseService.getTestCaseCustomFieldExecutionValue(TestCaseService.java:689)
[export_tests] ... 24 more
[export_tests] Caused by: org.xml.sax.SAXParseException: Expected methodResponse element, got pre
[export_tests] at org.apache.xmlrpc.parser.XmlRpcResponseParser.startElement(XmlRpcResponseParser.java:101)
[export_tests] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
[export_tests] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
[export_tests] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
[export_tests] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)
[export_tests] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
[export_tests] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
[export_tests] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
[export_tests] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
[export_tests] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
[export_tests] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
[export_tests] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
[export_tests] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
[export_tests] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
[export_tests] at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
[export_tests] ... 33 more

FATAL: Error verifying developer key: Failed to parse server's response: Content is not allowed in prolog.

Hi,

Any help on the below error?

FATAL: Error verifying developer key: Failed to parse server's response: Content is not allowed in prolog.
br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: Failed to parse server's response: Content is not allowed in prolog.
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:64)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:146)
at hudson.plugins.testlink.TestLinkBuilder.getTestLinkSite(TestLinkBuilder.java:331)
at hudson.plugins.testlink.TestLinkBuilder.perform(TestLinkBuilder.java:206)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.build(MavenModuleSetBuild.java:919)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:671)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1741)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Content is not allowed in prolog.
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:188)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:90)
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:61)
... 12 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1239)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
... 21 more
ERROR: Error communicating with TestLink. Check your TestLink configuration.

Exception in getTestCaseIDByName

i have testcase under a testsuite the name of the testcase under testsuite is "100-1:check whether integration is done with webdriver" when i call this methods as
api.getTestCaseIDByName("100-1:check whether integration is done with webdriver");
its throws an exception as "Cannot find matching test case. No testcase exists with the name provided!, code=5030}" Please help me

getTestCasesForTestPlan is not retrieving platforms right

getTestCasesForTestPlan method is not getting the different platforms set to the testPlan.

When you ask "if (testCaseMap.size() > 0) {" you get only the first element. What I propose is to set up an ArrayList, so you are going to get the tuple testcase-platform.

I have resolved it with this code:

    protected TestCase[] getTestCasesForTestPlan(Integer testPlanId, List<Integer> testCasesIds, Integer buildId,
            List<Integer> keywordsIds, String keywords, Boolean executed, List<Integer> assignedTo,
            String[] executeStatus, ExecutionType executionType, Boolean getStepInfo, TestCaseDetails detail)
            throws TestLinkAPIException {
        TestCase[] testCases = null;


    try {
        Map<String, Object> executionData = new HashMap<String, Object>();
        executionData.put(TestLinkParams.TEST_PLAN_ID.toString(), testPlanId);
        executionData.put(TestLinkParams.TEST_CASE_ID.toString(), testCasesIds);
        executionData.put(TestLinkParams.BUILD_ID.toString(), buildId);
        executionData.put(TestLinkParams.KEYWORD_ID.toString(), keywordsIds);
        executionData.put(TestLinkParams.KEYWORDS.toString(), keywords);
        executionData.put(TestLinkParams.EXECUTED.toString(), executed);
        executionData.put(TestLinkParams.ASSIGNED_TO.toString(), assignedTo);
        executionData.put(TestLinkParams.EXECUTE_STATUS.toString(), executeStatus);
        executionData.put(TestLinkParams.EXECUTION_TYPE.toString(), Util.getStringValueOrNull(executionType));
        executionData.put(TestLinkParams.GET_STEP_INFO.toString(), getStepInfo);
        executionData.put(TestLinkParams.DETAILS.toString(), Util.getStringValueOrNull(detail));
        Object response = this.executeXmlRpcCall(TestLinkMethods.GET_TEST_CASES_FOR_TEST_PLAN.toString(),
                executionData);

        /*
         * // The Util.castToMap method will return an empty Map if ( response instanceof String ) { throw new
         * TestLinkAPIException( "The test plan you requested does not contain Test Cases." ); }
         */

        Map<String, Object> responseMap = Util.castToMap(response);
        Set<Entry<String, Object>> entrySet = responseMap.entrySet();

        List<TestCase> testCasesList = new ArrayList<TestCase>();



        for (Entry<String, Object> entry : entrySet) {
            String key = entry.getKey();
            Map<String, Object> testCaseMap = null;

            if (entry.getValue() instanceof Object[]) {
                Object[] responseArray = (Object[]) entry.getValue();
                testCaseMap = (Map<String, Object>) responseArray[0];

                testCaseMap.put(TestLinkResponseParams.ID.toString(), key);
                testCasesList.add( Util.getTestCase(testCaseMap));


            } else if (entry.getValue() instanceof Map<?, ?>) {
                testCaseMap = (Map<String, Object>) entry.getValue();
                if (testCaseMap.size() > 0) {
                    Set<String> keys = testCaseMap.keySet();
                    Iterator it = keys.iterator();
                    while (it.hasNext()){
                        Object o = testCaseMap.get(it.next());

                        if (o instanceof Map<?, ?>) {
                            Map<String, Object> testCaseMapTmp = (Map<String, Object>) o;                           
                            testCaseMapTmp.put(TestLinkResponseParams.ID.toString(), key);
                            testCasesList.add( Util.getTestCase(testCaseMapTmp) );

                        }

                    }
                } else {
                    testCaseMap.put(TestLinkResponseParams.ID.toString(), key);
                    testCasesList.add( Util.getTestCase(testCaseMap) );

                }
            }    
        }


        testCases = new TestCase[testCasesList.size()];
        for (int i = 0 ; i <  testCasesList.size() ; i++ ){
            testCases[i] = testCasesList.get(i);
        }

    } catch (XmlRpcException xmlrpcex) {
        throw new TestLinkAPIException("Error retrieving test cases for test plan: " + xmlrpcex.getMessage(),
                xmlrpcex);
    }

    return testCases;
}

WebDriver - Testlink integration problem - Error verifying developer key

Hi Mr. Kinoshita,
I'm trying to add a new feature to my testframework (made with selenium webdriver), the integration with testlink. But somehow, when I try to run the basic API (testlink api v1.9.8) example, I'm getting the following error:

br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIE xception: Error verifying developer key: Failed to read server's response: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
at br.eti.kinoshita.testlinkjavaapi.MiscService.check DevKey(MiscService.java:64)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:145)

Here's the code:

package com.testframework.integrations.testlink;

import java.net.MalformedURLException;
import java.net.URL;

import br.eti.kinoshita.testlinkjavaapi.TestLinkAPI;
import br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException;

import com.utec.testframework.driverwrapper.Driver;

public class TestLinkInstance
{
public TestLinkInstance(Driver driver)
{
String url = "https://<my_server>/lib/api/xmlrpc/v1/xmlrpc.php";
String devKey = "<my_personal_api_id>";

TestLinkAPI api = null;
URL testlinkURL = null;

try {
testlinkURL = new URL(url);
} catch ( MalformedURLException mue ) {
mue.printStackTrace( System.err );
driver.kill();
}

try {
api = new TestLinkAPI(testlinkURL, devKey);
} catch( TestLinkAPIException te) {
te.printStackTrace( System.err );
driver.kill();
}

System.out.println(api.ping());

}
}

I investigated the testlink api source code, and I found that it throws the exception in the method named executeXmlRpcCall(String methodName, Map<String, Object> executionData), located in the following class: BaseService.java.

Hope you can give me a hand on this.

Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.