Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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.
Solved! Go to Solution.
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
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
Thank you very much and I can confirm this works perfectly.
