什么会导致表异常没有行?

时间:2015-01-09 19:55:20

标签: java fitnesse

我不知道从哪里开始拍摄这个。我想知道我是否应该尝试不同的夹具测试。 当我进行精细测试时,我收到了这个错误: fitnesse.fixtures.TestSecurityDaoFixtureTest

fit.exception.FitFailureException:此表中没有任何行位于Fitlibrary.traverse.FitHandler的fit.Fixture.doTable(Fixture.java:154)上的fitnesse.fixtures.TableFixture.doRows(TableFixture.java:15) Fitlibrary.flow.DoFlow.runTtorytest的fitlibrary.flow.DoFlow.runTable(未知来源)at fitlibrary.flow.DoFlow.runTable(未知来源)at fitlibrary.flow.DoFlow.runTabletest的Fitlibrary.flow.DoFlowOnTable.runTable(未知来源)的.doTable(未知来源) (未知来源)at fitlibrary.suite.BatchFibLibrary.doTables(未知来源)at fitlibrary.suite.BatchFibLibrary.doTables(未知来源)at fitlibrary.suite.BatchFibLibrary.doTables(未知来源)at fitlibrary.suite.FitLibraryServer.doTables(未知)位于fitlibrary.suite.FitLibraryServer.doTables(未知来源)at fit.FitServerBridge.process(未知来源)at fit.FitServerBridge.run(未知来源)at fitlibrary.suite.FitLibraryServer.main(未知来源)

AND

FindSecurity缺少类或缺少方法。可能:

public Type getFindSecurity() { }
public Type findSecurity() { }

这是我的实际代码:

package fitnesse.fixtures;


import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.LocalDate;
import org.junit.BeforeClass;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;

import java.util.List;

/**
 * Created by V616248 on 12/17/2014.
 */
public class TestSomethingDaoFixtureTest extends BaseFixtureTest {

    private static ApplicationContext context;
    private static SomethingDao dao;

    private static Utility utility;

    @BeforeClass
    public void setUp() {
        System.out.println("in setup");
        utility= new Utility();
        utility.setUp();

    }

    /**
     *
     */
    public void findSomething(){
        System.out.println("Before find");
        List<Something> something1 = dao.findBySomethingCodeAndDate(getText(1, 0), new  
LocalDate());
        System.out.println("After find");
        if(something1 != null) {
            right(1, 0);
        } else {
            wrong(1, 0);
        }
        System.out.println("This is a test show results");
    }



    /**
     *
     * @param fitnessRows
     */
    public void showResults(int fitnessRows) {
        findSomething();

    }
}

我的content.txt文件: !| fitnesse.fixtures.TestSomethingDaoFixtureTest | !| FindSomething | | ABCD101 |

Utility setup method:
public void setUp() {
        System.out.println("exception 1");
        context = UnitTestConfig.createApplicationContext();
        System.out.println("exception 2");
        categoryDao = context.getBean(CategoryDao.class);
        dao = context.getBean(SomethingDao.class);
        System.out.println("exception 3");
        PlatformTransactionManager tm = context.getBean(PlatformTransactionManager.class);
        System.out.println("exception 4");
        TransactionTemplate tt = new TransactionTemplate(tm);
        System.out.println("exception 5");

        tt.execute(new TransactionCallback<Void>() {
            @Override
            public Void doInTransaction(TransactionStatus status) {
                System.out.println("exception 6");
                DateTime currentDateTime = new DateTime(DateTimeZone.getDefault());
                System.out.println("exception 7");
                LocalDate localDate = new LocalDate();
                System.out.println("exception 8");
                Category inCategory = null;
                System.out.println("exception 9");
                try {
                    System.out.println("exception 10");
                    Category category = new Category("5d6d0db0-4d38-424d-8f82-14aab7798ad4", currentDateTime, "O607412",
                            "G-00A", "BEFORE ALLOC-FIRM LONG");
                    System.out.println("exception 11");
                    categoryDao.save(category);
                    System.out.println("exception 12");
                    inCategory = categoryDao.findOne(new Long(1));
                    System.out.println("exception 13");


                    System.out.println("exception 14");
                    Something something= new Something("1234",
                            currentDateTime,
                            "O607412",
                            localDate,
                            inCategory,
                            "ABCD101",
                            "Test 1",
                            new Double(100),
                            new Double(100),
                            new Double(0), false);
                    System.out.println("Now saving Something");
                    dao.save(something1);
                    System.out.println("After Save 1");

                    dao.save(something3);
                } catch (Exception e) {
                    e.printStackTrace();
                    System.out.println("exception" +e.toString());
                }
                return null;
            }
        });
}

1 个答案:

答案 0 :(得分:0)

我试图在第一行的第一个单元格中发表评论。当我将真实数据放在第一个单元格中并将评论放在最后一个单元格中时,我运气更好。 例:     |!TestMyData | 100 | &lt; - 没有用     | 100 |!TestMyData | &lt; - 这工作