CodePro AnalytiX (Audit & Test), includes over 1000 audit rules and metrics, JUnit test generation & editing, code coverage, and duplicate code analysis
Moderators: gnebling, jwren, Eric Clayberg, Dan Rubel, Brian Wilkerson, dcarew
by jbsiii » Tue Jan 27, 2009 10:07 am
I'm getting a strange error when I generate test cases. If I run the cases from the Junit runner built in to Eclipse, they run fine. But CodePro refuses to execute the tests. Here's the comments it inserted into the test case code:
// An unexpected exception was thrown while executing this test:
// java.lang.SecurityException: Cannot write to files while generating test cases
// at com.instantiations.assist.eclipse.junit.CodeProJUnitSecurityManager.checkWrite(CodeProJUnitSecurityManager.java:79)
// at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
// at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
// at com.jeppesen.EDS.EssentialDeltaSet.setDirs(EssentialDeltaSet.java:37)
// at com.jeppesen.EDS.EssentialDeltaSet.<init>(EssentialDeltaSet.java:28)
Here's the line it's pointing to in the class being tested:
EDSFile = new ZipOutputStream(new FileOutputStream(EDSFileName));
What am I missing?
-
jbsiii
-
- Posts: 2
- Joined: Tue Jan 27, 2009 10:04 am
by gnebling » Thu Jan 29, 2009 7:56 am
What version of CodePro, Eclipse and Java are you using?
-
gnebling
- Moderator
-
- Posts: 243
- Joined: Tue Aug 22, 2006 7:49 am
by Brian Wilkerson » Thu Jan 29, 2009 8:14 am
In order to produce useful assertions, the test code generator attempts to execute the method under test during the test code generation process. But in order to prevent damage to your computer it first installs a security manager that disallows code that tries to access external resources, such as your hard drive.
That comment was produced by the test code generator to let you know that it was unable to produce better (or maybe any) assertions because the security manager threw an exception.
When you use JUnit to execute the tests there is no security manager, so the test runs fine.
-
Brian Wilkerson
- Moderator
-
- Posts: 32
- Joined: Fri Apr 28, 2006 9:37 am
by jbsiii » Thu Jan 29, 2009 2:26 pm
gnebling wrote:What version of CodePro, Eclipse and Java are you using?
Sorry, I forgot to mention that. Using Ganymede, JDK 1.6, and the most recent version of CodePro (evaluation underway).
-
jbsiii
-
- Posts: 2
- Joined: Tue Jan 27, 2009 10:04 am
by gnebling » Thu Feb 05, 2009 8:29 am
Thanks. Let us know if you have any other questions.
-
gnebling
- Moderator
-
- Posts: 243
- Joined: Tue Aug 22, 2006 7:49 am
Return to CodePro AnalytiX & PlusPak. EclipsePro Audit & Test
Who is online
Users browsing this forum: No registered users and 1 guest