RetailMeNot / TestRailSDK

TestRail integration with Java WebDriver implementation.
MIT License
25 stars 27 forks source link

unable to update TestCase typeId #14

Open jrocketz opened 9 years ago

jrocketz commented 9 years ago

I'm unable to update the test case type ID using either of the methods in the TestCase class and TestRailService class. I am using the hosted version of TestRails v4.1.0.3294 with TestRailSDK 0.9. Here is the code that you can use to test (Note: I have removed my account information):

import com.rmn.testrail.service.TestRailService;

public class TestRailUpdateTestCaseType {

    private static TestRailService testRailService;

    public static void main(String[] args) {
        testRailService = new TestRailService(clientId, username, password);
        useUpdateType(4842);
        useUpdateTestCaseType(4843);
    }

    public static void useUpdateType(int testCaseId){
        int typeId = testRailService.getTestCase(testCaseId).getTypeId();
        System.out.printf("Test Case %d type before update: %d\n", testCaseId, typeId);
        if (typeId != 1) {
            System.out.printf("Updating test case %d type\n", testCaseId);
            testRailService.getTestCase(testCaseId).updateType(1);
        }
        typeId = testRailService.getTestCase(testCaseId).getTypeId();
        System.out.printf("Test Case %d type after update: %d\n", testCaseId, typeId);
    }

    public static void useUpdateTestCaseType(int testCaseId) {
        int typeId = testRailService.getTestCase(testCaseId).getTypeId();
        System.out.printf("Test Case %d type before update: %d\n", testCaseId, typeId);
        if (typeId != 1) {
            System.out.printf("Updating test case %d type\n", testCaseId);
            testRailService.updateTestCaseType(testCaseId, 1);
        }
        typeId = testRailService.getTestCase(testCaseId).getTypeId();
        System.out.printf("Test Case %d type after update: %d\n", testCaseId, typeId);
    }

}

And here is the output:

Test Case 4842 type before update: 6
Updating test case 4842 type
Test Case 4842 type after update: 6
Test Case 4843 type before update: 6
Updating test case 4843 type
Test Case 4843 type after update: 6
mmerrell commented 9 years ago

I'll try to have a look at this in the next day or so. Thanks for the detailed repro steps!