I am new to Java and I was trying to see if the scenario provided below is possible. Any reference or link to learn the below is highly appreciated. I have 4 classes.
I'm creating these classes because I'll be using them for completing a regression test on an application that will have a multitude of test that will be broken down in small classes. Sometimes those test only impact 1 page and sometimes those test will need to be run on the entire applications which is about 100 pages. Each of these pages will have a series of individual test.
Main class that runs class B and class C through class CallScripts. Similar, to how class Sleep is created.
Import package.B
Import package.C
Import static package.Sleep.sleep
Import static package.CallScript.callScript
// this is main class
Public class A {
Public static void main(String[] args) {
callScript(B);
callScript(C);
}
}
Second class
public class B {
//do something
}
Third class
public class C {
//do something
}
Fourth class
public class CallScript{
public static void callScript(String className)
{
/* I am stuck here, but
wanted to know if this
implementation will work
*\
}
}
I added a Sleep class, which I have working, to show the similar functionality I would like to have with callScript.
Fifth class:
public class Sleep{
public static void sleep(int x)
{
try {
Thread.sleep(x*1000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
}