2 limin0017 limin0017 于 2016.03.27 18:58 提问

初学者搭建jbpm测试时报错

报错信息:
junit.framework.AssertionFailedError: No tests found in edu.qlu.bean.TestJbpm
at junit.framework.Assert.fail(Assert.java:47)
at junit.framework.TestSuite$1.runTest(TestSuite.java:90)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
源码
java代码

 package edu.qlu.bean;

import org.jbpm.api.Configuration;
import org.jbpm.api.ProcessEngine;

import org.jbpm.api.RepositoryService;
import junit.framework.TestCase;

public class TestJbpm extends TestCase{
    /**
     * 部署流程
     */

    public void deploy(){
        ProcessEngine processEngine = Configuration.getProcessEngine();//流程引擎       
        RepositoryService repositoryService = processEngine.getRepositoryService();//创建服务
        repositoryService.createDeployment().addResourceFromClasspath("test1.jpdl.xml").deploy();//部署流程


    }

}

数据库配置

 <?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
  <session-factory>

     <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
     <property name="hibernate.connection.driver_class">com.mysql.jbdc.Driver</property>
     <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpm?&amp;useUnicode=true&amp;characterEncoding=utf-8</property>
     <property name="hibernate.connection.username">root</property>
     <property name="hibernate.connection.password">root</property>
     <property name="hibernate.hbm2ddl.auto">create</property>
     <property name="hibernate.format_sql">true</property>

     <mapping resource="jbpm.repository.hbm.xml" />
     <mapping resource="jbpm.execution.hbm.xml" />
     <mapping resource="jbpm.history.hbm.xml" />
     <mapping resource="jbpm.task.hbm.xml" />
     <mapping resource="jbpm.identity.hbm.xml" />

  </session-factory>
</hibernate-configuration>

1个回答

limin0017
limin0017   2016.03.27 19:31
已采纳

把方法名deploy()改成testDeploy()以后,测试成功了!但是有点不明白,方法名为什么要以test开头

limin0017
limin0017 回复毕小宝: 但是我写的其他方法,没有使用test开头,也没加@test注释,也能测试通过啊,为什么偏偏这个方法不行呢?
一年多之前 回复
wojiushiwo945you
wojiushiwo945you 因为junit会默认执行以test开始的方法啊。
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!