Login Form






Lost Password?
No account yet? Register
Home arrow Forums
ECharts
Welcome, Guest
TestSuite run from command prompt is causing error (0 viewing) 
Go to bottom Post Reply Favoured: 0
TOPIC: TestSuite run from command prompt is causing error
#203
Muqthar Ahmed (User)
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
TestSuite run from command prompt is causing error 1 Year, 6 Months ago  
Hi i have created a new test case using kitCAT
where in i am accessing the methods of an another class .

i have created two java files.

myTestSuite.java
FirstTest.java

from myTestSuite.java i am accessing the methods of FirstTest.java file.

The contents of myTestSuite.java File are

public class myTestSuite extends CATTestCase {
Logger logger;
int listenPort=23456;

public myTestSuite() {
//this.enableLoggingPerTest();
logger = this.getLogger();
logger.info("myTestSuite ctor called");
}

@BeforeClass public static void runOnceBeforeAllTests() {
}

@AfterClass public static void runOnceAfterAllTests() {
}

@Before public void runBeforeEachTest() {
try {
logger.info("running test setup");
}
catch (Exception e) {
logger.error("test setup failed", e);
}
}

@After public void runAfterEachTest() throws Exception {
logger.info("running test tear down");
this.release();
}

@Test public void test() throws Exception {
try {
//this.init(this.sipListenPort);

FirstTest ft = new FirstTest();
ft.simpletest();

} catch(Exception e) {
logger.error("Test failed!!", e);
throw e;
} catch(Error e) {
logger.error("Test failed!!", e);
throw e;
}
}
};


and the contents of FirstTest.java file are

public final class FirstTest extends org.echarts.test.sip.CATTestCase {
/** Version control identifier strings. */
public static final String[] RCS_ID = {
"$URL$",
"$Id$",
};

String appServer;
String httpServer;
int sipListenPort;
Logger logger;

public FirstTest() throws Exception {
logger = this.getLogger();
try {

sipListenPort = 12345;
}
catch (Exception e) {
logger.error("error loading/reading test configuration file", e);
throw e;
}
}

@BeforeClass static public void runOnceBeforeAllTests() {
}

@AfterClass static public void runOnceAfterAllTests() {
}

@Before public void runBeforeEachTest() {
try {
logger.info("running test setup");
}
catch (Exception e) {
logger.error("test setup failed", e);
}
}

@After public void runAfterEachTest() {
try {
logger.info("running test cleanup");
this.release();
}
catch (Exception e) {
logger.error("test cleanup failed", e);
}
logger.info("====================");
}

/** A simple test.
*
* @throws Exception
*/
@Test public void simpletest() throws Exception {
try {
this.init(this.sipListenPort);
logger.info("Test called from gets called from myTestSuite");
SIPAgent caller = createAgent("caller");
SIPAgent callee = createAgent("callee");

//Uncomment this line to test against an appserver.
//caller.setProxy(appServer);

caller.call(callee);
processSIP(2000);

assertThat(callee, has(recvdRequest("INVITE")));
callee.answer();

processSIP(2000);
assertThat(caller, is(connectedTo(callee)));

processSIP(2000);
caller.end();

processSIP(2000);
assertThat(callee, is(disconnected()));

runAfterEachTest();
logger.info("Test passed");
} catch(Exception e) {
logger.error("Test failed!!", e);
throw e;
} catch(Error e) {
logger.error("Test failed!!", e);
throw e;
}
}
}


when i run the file myTestSuite.java from NetBeansIDE environment myTestSuite works fine.

but when i am trying to execute the same thing from the command prompt my TestSuite is giving errors

Can somebody help me to figure out what i am missing so that myTestSuite can be run from the command prompt also.

Thanks,
Muqthar
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#205
Venkita Subramonian (Admin)
Admin
Posts: 60
graphgraph
User Offline Click here to see the profile of this user
Re:TestSuite run from command prompt is causing error 1 Year, 6 Months ago  
Hi Muqthar,

I am not sure about what exact error/exception you are seeing. Could you post it here? Could you also tell me how you are running the test from the command line - using testdriver.sh? using 'ant test'? Note that if you generated your project and are using 'ant test', then the generated build._xml_ considers all .java files in the source directory as JUnit test cases and tries to run them. You can change this to run just the test suites you want, by changing the build._xml_ appropriately.

hope this helps,
venkita
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#206
Muqthar Ahmed (User)
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
Re:TestSuite run from command prompt is causing error 1 Year, 6 Months ago  
hi Venkita,

i am using ant test from the command prompt.
i have generated the test Suite FirstTest.java using testgen.sh and the generated file FirstTest.java i copied to examplessrc of Twoway.java which is
supplied with kitCAT and modified Twoway.java to
create an _object_ of FirstTest and accessing its
method.

and when i run the Twoway.java testsuite from command prompt using ant test i am getting something like this

test:
[mkdir] Created dir: C:UsersmuqtharDesktopKitCAT_1.0-betaKitCAT_1.0-betaexamplesreport
[junit] Running org.echarts.test.sip.examples.TwoWay
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
[junit] Test org.echarts.test.sip.examples.TwoWay FAILED

[junitreport] Processing C:UsersmuqtharDesktopKitCAT_1.0-betaKitCAT_1.0-betaexamplesreportTESTS-TestSuites._xml_ to
C:UsersmuqtharAppDataLocalTempnull2122904283
[junitreport] Loading _style_sheet jar:file:/C:/Users/muqthar/Desktop/apache-ant-1.7.1-bin/
apache-ant-1.7.1/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-_frame_s.xsl
[junitreport] Transform time: 1332ms
[junitreport] Deleting: C:UsersmuqtharAppDataLocalTempnull2122904283

BUILD SUCCESSFUL

if i have to modify build._xml_ then which lines i need to modify (build._xml_ is same as the supplied one with Twoway.java)please let me know.

Thanks,
Muqthar
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#207
Venkita Subramonian (Admin)
Admin
Posts: 60
graphgraph
User Offline Click here to see the profile of this user
Re:TestSuite run from command prompt is causing error 1 Year, 6 Months ago  
Hi Muqthar,

I can't see the actual error/exception from this output. Could you check the file logs/run.log which is the output log file and see whether there is any error/exception there? Also, could you open the report/index.html (the test report generated by ant) in your browser and check whether you can see exceptions?

thanks
venkita
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#208
Muqthar Ahmed (User)
Fresh Boarder
Posts: 11
graphgraph
User Offline Click here to see the profile of this user
Re:TestSuite run from command prompt is causing error 1 Year, 6 Months ago  
Hi Venkita,

Thanks for the response.

The issue is resolved its a classpath issue.
through netbeans IDE the classpath was getting picked up automatically.

but from command prompt we need to explicitly configure in the classpath which was missing in my case. once i configured that i am able to run from command prompt also.

Thanks,
Muqthar
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
Copyright © 2006-2009 echarts.org