Four things to note:
- User Hoàng Long is right, you need to specify a fully qualified class name instead of a path to the JUnit runner.
- This also means that you need to add the path to your test classes to the classpath.
- In a classpath you cannot use
*.jar
, you just use *
as a wildcard, see this answer.
- Furthermore, if you really want to use precompiled AspectJ aspects, you also need to add the AspectJ runtime aspectjrt.jar to your classpath.
Here is an example of how to run JUnit in your case. I added line breaks so as to make it more readable, everything really needs to be on one line:
java
-cp
"C:\Users\name\git\WhileyCompiler\lib\junit-4.11.jar";
"C:\Users\name\git\WhileyCompiler\lib\*";
"C:\Users\name\git\WhileyCompiler\lib\hamcrest-all-1.3.jar";
"C:\Users\name\git\WhileyCompiler\lib\aspectjrt.jar";
"C:\Users\name\git\Test\bin"
org.junit.runner.JUnitCore
wyc.testing.AllValidTests
Update:
Actually I was busy this week, but I just gave it a quick try here with LTW on the binary JARs, but the *.whiley
test files unpacked. It works nicely, I see the log output on the console. I had to change your pointcut though because it lead to bloated output in the LTW scenario when all the loaded framework classes (e.g. from JUnit) were also woven. I also simplified your aspect a bit in order to provide formatted output on System.out
directly instead of all the logging overhead with timestamps because I found that more readable.
Modified aspect:
package de.scrum_master.aspect;
public aspect TraceAspect {
pointcut traceMethods() :
execution(* *(..)) && (within(whiley..*) || within(wy*..*));
before() : traceMethods() {
System.out.printf(
"%40s | %s%n",
thisJoinPoint.getSourceLocation(),
thisJoinPoint.getSignature()
);
}
}
Console output:
JUnit version 4.11
. AllValidTests.java:2729 | void wyc.testing.AllValidTests.TypeEquals_Valid_1()
AllValidTests.java:97 | void wyc.testing.AllValidTests.runTest(String)
TestUtils.java:28 | Pair wyc.testing.TestUtils.compile(String[])
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Pipeline.java:292 | void wycc.lang.Pipeline.register(Class)
Content.java:135 | Content.Filter wyfs.lang.Content.filter(String, Content.Type)
Trie.java:238 | Trie wyfs.util.Trie.fromString(String)
Trie.java:193 | Trie wyfs.util.Trie.append(String)
Trie.java:312 | int wyfs.util.Trie.binarySearch(Trie[], int, String)
Content.java:135 | Content.Filter wyfs.lang.Content.filter(String, Content.Type)
Trie.java:238 | Trie wyfs.util.Trie.fromString(String)
Trie.java:193 | Trie wyfs.util.Trie.append(String)
Trie.java:312 | int wyfs.util.Trie.binarySearch(Trie[], int, String)
Content.java:135 | Content.Filter wyfs.lang.Content.filter(String, Content.Type)
Trie.java:238 | Trie wyfs.util.Trie.fromString(String)
Trie.java:193 | Trie wyfs.util.Trie.append(String)
Trie.java:312 | int wyfs.util.Trie.binarySearch(Trie[], int, String)
VirtualRoot.java:50 | VirtualRoot.Folder wyfs.util.VirtualRoot.root()
VirtualRoot.java:50 | VirtualRoot.Folder wyfs.util.VirtualRoot.root()
VirtualRoot.java:50 | VirtualRoot.Folder wyfs.util.VirtualRoot.root()
WycMain.java:179 | int wyc.WycMain.run(String[])
OptArg.java:322 | Map wycc.util.OptArg.parseOptions(List, OptArg[])
OptArg.java:218 | void wycc.util.OptArg.FILEDIR.process(String, String, Map)
OptArg.java:231 | void wycc.util.OptArg.FILELIST.process(String, String, Map)
WycMain.java:258 | void wyc.WycMain.configure(Map)
WycBuildTask.java:331 | void wyc.util.WycBuildTask.setVerbose(boolean)
WycBuildTask.java:335 | void wyc.util.WycBuildTask.setVerification(boolean)
WycBuildTask.java:343 | void wyc.util.WycBuildTask.setSmtVerification(boolean)
WycBuildTask.java:339 | void wyc.util.WycBuildTask.setVerificationConditions(boolean)
WycBuildTask.java:359 | void wyc.util.WycBuildTask.setWhileyDir(File)
DirectoryRoot.java:135 | DirectoryRoot.Folder wyfs.util.DirectoryRoot.root()
DirectoryRoot.java:135 | DirectoryRoot.Folder wyfs.util.DirectoryRoot.root()
WycBuildTask.java:399 | void wyc.util.WycBuildTask.setBootPath(List)
... | ...