最好的方法是将您的测试封装在可以利用内置日志记录机制的自定义 mojo 中。然后你可以使用 javas runtime exec 来执行你的 vb,收集你的结果,并将它们打印到日志中。可能是这样的:
/**
* Goal which generates.
*
* @goal vbtest
*
* @phase test
*/
public class VbTestMojo extends AbstractMojo {
/**
* @parameter expression="${project}"
*/
private MavenProject project;
/**
* The directory for exploded something or other.
*
* @parameter default-value="${vbtest.scriptFile}"
* @required
* @readonly
*/
private String vbScriptFile;
public void execute() throws MojoExecutionException {
getLog().info( "Running VB Test " + vbScriptFile.getName() );
// execute your vb script here and log whatever...
}
}
把它放在它自己的项目中,然后包括在你的 pom 中:
...
<plugin>
<groupId>mygroup</groupId>
<artifactId>myartifact-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-vb</id>
<phase>test</phase>
<goals>
<goal>vbtest</goal>
</goals>
<configuration>
<scriptFile>${project.basedir}/vbtests/vbtest.vb</scriptFile>
</configuration>
</execution>
...
这显然不是完整的解决方案,但可能会给您一个很好的起点。