locked
Query on creating test case in Visual Studio Test Manager 2010 using TFS SDK for Java. RRS feed

  • Question

  • Hello,

    I have been trying to create test case in Visual Studio Test Professional 2010 using TFS SDK for Java. I were successfully able to create test case but the creation of test steps is posing some challenge.

    If I use this:
    workItem.getFields().getField("Steps").setValue(String) will create a test step but only in Action field. I cannot create Expected result field.

    Also I found that the datatype for Steps is TestStepsControl. I tried it in XML format but found no luck.
    XML format I used was:

    <?xml version="1.0" encoding="utf-16"?>	<steps id="0" last="1"><step id="1" type="ValidateStep"><parameterizedString><text>Enter the credentials</text></parameterizedString><parameterizedString><text>Login should be successful</text></parameterizedString></step></steps>

    Can you please tell how can I create a test case using SDK in java where I can manually put data into all the fields including Expected Result.

    Thanks,
    Aniketha

    Monday, March 17, 2014 10:16 AM

Answers

  • Hi Mireille,

    Thank you for replying.

    I had tried that earlier to posting the question.

    However I missed one attribute while creating the xml.

    If your xml is in the below format it will work fine.

    <steps id="20" last="20">
    <step id="20" type="ValidateStep">
    <parameterizedString><text>Click on home screen</text></parameterizedString>
    <parameterizedString><text>Resp pages should be opened</text></parameterizedString>
    <description/>
    </step>
    <step id="21" type="ValidateStep">
    <parameterizedString><text>Click on home screen</text></parameterizedString>
    <parameterizedString><text>Resp pages should be opened</text></parameterizedString>
    <description/>
    </step>
    </steps>

    In the above xml, it is mandatory to give some value in 'last' attribute in the <steps> node. I missed that all the way through and it was putting the entire xml in Action field.

    Can you please tell me what does that 'last' signify?

    If you provide that, the first parameterized string will go to Action field and second will go to Expected result.

    It will be seen both in MTM and browser.

    Thanks,

    Aniketha


    • Marked as answer by Aniketha Monday, March 24, 2014 6:29 AM
    • Edited by Aniketha Monday, March 24, 2014 6:35 AM Changed
    Monday, March 24, 2014 6:26 AM

All replies

  • Hi Aniketha,

    I am also trying to create expected result field.

    I have tried in this way also : workItem.getFields().getField("Steps").setValue(String,String)

    but no luck,If you got any info, can you share me?

    Thanks In Advance.

    Rajesh

    Thursday, March 20, 2014 10:15 AM
  • Hi,

    Here is what you need to do to create a test step, if the action is "Create an app" and the expected result is "app created", you need to do this

    workItem.getFields().getField("steps").setValue("

    <steps><step type=\"ValidateStep\" id=\"1\"><parameterizedString isformatted=\"true\">Create an app</parameterizedString><parameterizedString isformatted=\"true\">app created</parameterizedString><description /></step></steps>

    ")

    I know this is not ideal but this is the support that we have now.

    Please let me know if you have any other questions/issues.

    Thanks

    Mireille

    Thursday, March 20, 2014 6:59 PM
    Moderator
  • Hi,

    I tried your answer, but it is not working. Expected Result is still blank. Whatever you put in setValue() is coming in Action field itself. Can you please check it from your side?

    There is one more question which I had posted:

    I want to create test plan and test suites under my project. And later I want to add test cases and requirements to the created test suites. Is there any way I can create Test Suites and Plans using TFS SDK for Java?

    Please answer these two questions.

    Thanks
    Aniketha

    Friday, March 21, 2014 4:37 AM
  • Hi Aniketha,

    One thing to try is to create a test case manually using Test Manager or Web access then use the sdk to query for that workitem and check what is the value in the steps field then follow the same format in your code. In the sdk samples, there is a sample to editWorkItemByID, you can modify it a little and use it.

    Please let me know what did you find out.

    Thanks

    Mireille

    Friday, March 21, 2014 2:23 PM
    Moderator
  • Hi Mireille,

    Thank you for replying.

    I had tried that earlier to posting the question.

    However I missed one attribute while creating the xml.

    If your xml is in the below format it will work fine.

    <steps id="20" last="20">
    <step id="20" type="ValidateStep">
    <parameterizedString><text>Click on home screen</text></parameterizedString>
    <parameterizedString><text>Resp pages should be opened</text></parameterizedString>
    <description/>
    </step>
    <step id="21" type="ValidateStep">
    <parameterizedString><text>Click on home screen</text></parameterizedString>
    <parameterizedString><text>Resp pages should be opened</text></parameterizedString>
    <description/>
    </step>
    </steps>

    In the above xml, it is mandatory to give some value in 'last' attribute in the <steps> node. I missed that all the way through and it was putting the entire xml in Action field.

    Can you please tell me what does that 'last' signify?

    If you provide that, the first parameterized string will go to Action field and second will go to Expected result.

    It will be seen both in MTM and browser.

    Thanks,

    Aniketha


    • Marked as answer by Aniketha Monday, March 24, 2014 6:29 AM
    • Edited by Aniketha Monday, March 24, 2014 6:35 AM Changed
    Monday, March 24, 2014 6:26 AM
  • HI All,

    Thanks for Posting. That helped me a lot.I have one more question  

    I am using Visual Studio Test Professional 2013.

    I were successfully able to create test case using TFS SDK for Java.

    I created test plan and test suites manually under my project. And later I want to move/add test cases to the created test suites.

    Can you please tell me Is there any way I can move/add Test cases  in existing Test Suites of a project using TFS SDK for Java?

    Thanks In Advance

    Rajesh



    • Edited by Rajesh_TFS Tuesday, March 25, 2014 3:43 PM
    Tuesday, March 25, 2014 1:10 PM