cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

Edit Test Step by Java API

BillThompson
5-Regular Member

Edit Test Step by Java API

I've found that It is possible to edit a test step using the CLI with: 

tm editresult --stepVerdict="stepID=216:verdict=Passed" --sessionid=228 78.

 

However when I try an equivalent command using the Java API I get an error:

Could not save modified test result: Invalid step verdict value specified: "stepID=216:verdict=Passed"

 

Can anyone please advise on the correct syntax to use within the Java API to perform this command?

 

I'm using ILM version 12 server.

ACCEPTED SOLUTION

Accepted Solutions

I was able to edit the test step verdict with the following code:

 

import java.util.*;
import com.mks.api.*;
import com.mks.api.util.*;
import com.mks.api.response.*;

public class sample {
    public static void main(String[] args) {
        try {
            Command cmd = new Command("tm", "editresult");
            Option testStep = new Option("stepVerdict","stepID=568:verdict=Passed");
            Option sessionID = new Option("sessionID","1638");
            cmd.addOption(testStep);
            cmd.addOption(sessionID);
            cmd.addSelection("572");
            

            IntegrationPointFactory factory = IntegrationPointFactory.getInstance();
            IntegrationPoint ip = factory.createIntegrationPoint("localhost", 7001, 4, 16);
            Session s = ip.createNamedSession("mySession", null, "tester", "password");
            CmdRunner cr = s.createCmdRunner();
            Response r = cr.execute(cmd);

            Result res = r.getResult();
            ResponseUtil.printResult(res, 1, System.out);
            
        } catch (APIException e) {
            ResponseUtil.printAPIException(e, 1, System.out);
        }
    }
}

The output is:

Result:
  Message    = Edited test result

View solution in original post

2 REPLIES 2

I was able to edit the test step verdict with the following code:

 

import java.util.*;
import com.mks.api.*;
import com.mks.api.util.*;
import com.mks.api.response.*;

public class sample {
    public static void main(String[] args) {
        try {
            Command cmd = new Command("tm", "editresult");
            Option testStep = new Option("stepVerdict","stepID=568:verdict=Passed");
            Option sessionID = new Option("sessionID","1638");
            cmd.addOption(testStep);
            cmd.addOption(sessionID);
            cmd.addSelection("572");
            

            IntegrationPointFactory factory = IntegrationPointFactory.getInstance();
            IntegrationPoint ip = factory.createIntegrationPoint("localhost", 7001, 4, 16);
            Session s = ip.createNamedSession("mySession", null, "tester", "password");
            CmdRunner cr = s.createCmdRunner();
            Response r = cr.execute(cmd);

            Result res = r.getResult();
            ResponseUtil.printResult(res, 1, System.out);
            
        } catch (APIException e) {
            ResponseUtil.printAPIException(e, 1, System.out);
        }
    }
}

The output is:

Result:
  Message    = Edited test result
BillThompson
5-Regular Member
(To:awalsh)

Thank you very much and I can confirm this works perfectly.

Announcements


Top Tags