18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Multiple session problem in java API (ant)
Hello,
I need launch multiple tests with different session with API JAVA (ant). As with the "scenario.suite"
This is my test code :
This is the result http://img11.imageshack.us/img11/3804/loginsessionfailsahi.jpg
The expected result would be with multiple session on http://img543.imageshack.us/img543/9009/loginsessionok.jpg
Maybe he should be able to activate the variable useSingleSession in Java Code ??
Thank you in advance for your help
Regards
Vincent
I need launch multiple tests with different session with API JAVA (ant). As with the "scenario.suite"
This is my test code :
public class Run {
static final String suiteName = "scripts/test/login.sah";
static final String browserType = "chrome";
static final String browserTypePath = "C:\\Users\\Vincent\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe";
static String base = "http://localhost:8080/prod1/";
static String threads = "3";
static String[] args;
static String host = "localhost";
static String port = "9999";
static String browserOption = "--user-data-dir=$userDir\\browser\\chrome\\profiles\\sahi$threadNo --proxy-server=localhost:9999 --disable-popup-blocking --always-authorize-plugins";
static String browserProcessName = "chrome.exe";
/**
* @param args
* @throws InterruptedException
* @throws IOException
*/
public static void main(String[] args) throws IOException, InterruptedException {
Run.args = args;
Test();
TestUnique();
TestMultiple();
}
public static void Test() throws IOException, InterruptedException{
HashMap<String, Object> variableHashMap = new HashMap<String, Object>();
variableHashMap.put("$n",args[0]);
TestRunner testRunner = new TestRunner(suiteName, browserType, base, threads);
testRunner.setInitJS(variableHashMap);
String status = testRunner.execute();
System.out.println(status);
testRunner = null;
variableHashMap = null;
}
public static void TestUnique() throws IOException, InterruptedException{
HashMap<String, Object> variableHashMap = new HashMap<String, Object>();
variableHashMap.put("$n",args[0]);
TestRunner testRunner = new TestRunner(suiteName, browserTypePath, base, host, port, threads, browserOption, browserProcessName);
testRunner.setInitJS(variableHashMap);
String status = testRunner.execute();
System.out.println(status);
testRunner = null;
variableHashMap = null;
}
public static void TestMultiple() throws IOException, InterruptedException{
HashMap<String, Object> variableHashMap = new HashMap<String, Object>();
variableHashMap.put("$n",args[0]);
SingleSessionTestRunner testRunnerU = new SingleSessionTestRunner("SahiAten + "+args[0], browserType, base);
testRunnerU.start();
testRunnerU.setInitJS(variableHashMap);
testRunnerU.executeSingleTest(suiteName);
String status = testRunnerU.stop();
System.out.println(status);
testRunnerU = null;
variableHashMap = null;
}
}
This is the result http://img11.imageshack.us/img11/3804/loginsessionfailsahi.jpg
The expected result would be with multiple session on http://img543.imageshack.us/img543/9009/loginsessionok.jpg
Maybe he should be able to activate the variable useSingleSession in Java Code ??
Thank you in advance for your help
Regards
Vincent
Answers
I have the same problem
I try with
impossible to have different session !!
another test
my butts being staggered launch threads
(I made a small script node js to call. bat)
This is result
The script is for all (initJS=var $n=2) while one was initialized to 1 and the other 2?
My objective is to launch thread shift in time. With different data contained in exel file.