Fitnesse .Net Java 语言错误

发布于 2024-10-17 22:34:17 字数 4597 浏览 0 评论 0原文

我正在尝试设置 Fitnesse 来运行“简单”查询,但在运行测试时收到 javalang 错误

Slim 协议版本错误

预期是 V0.3,结果是 V0.2

全部展开|全部折叠 中止

异常:java.lang.ClassCastException:java.lang.String无法转换为java.util.List 在fitnesse.slimTables.QueryTable$QueryResults.makeRowMap(QueryTable.java:178) 在fitnesse.slimTables.QueryTable$QueryResults。(QueryTable.java:170) 在fitnesse.slimTables.QueryTable.scanRowsForMatches(QueryTable.java:84) 在fitnesse.slimTables.QueryTable.evaluateReturnValues(QueryTable.java:72) 在fitnesse.responders.run.slimResponder.SlimTestSystem.evaluateTable(SlimTestSystem.java:365) 在fitnesse.responders.run.slimResponder.SlimTestSystem.evaluateTables(SlimTestSystem.java:360) 在fitnesse.responders.run.slimResponder.HtmlSlimTestSystem.createHtmlResults(HtmlSlimTestSystem.java:40) 在fitnesse.responders.run.slimResponder.SlimTestSystem.processTablesAndGetHtml(SlimTestSystem.java:280) 在fitnesse.responders.run.slimResponder.SlimTestSystem.processAllTablesOnPage(SlimTestSystem.java:263) 在fitnesse.responders.run.slimResponder.SlimTestSystem.runTestsAndGenerateHtml(SlimTestSystem.java:207) 在fitnesse.responders.run.MultipleTestsRunner.executeTestSystemPages(MultipleTestsRunner.java:126) 在fitnesse.responders.run.MultipleTestsRunner.startTestSystemAndExecutePages(MultipleTestsRunner.java:106) 在fitnesse.responders.run.MultipleTestsRunner.executePagesInTestSystem(MultipleTestsRunner.java:92) 在fitnesse.responders.run.MultipleTestsRunner.internalExecuteTestPages(MultipleTestsRunner.java:83) 在fitnesse.responders.run.MultipleTestsRunner.executeTestPages(MultipleTestsRunner.java:56) 在fitnesse.responders.run.TestResponder.performExecution(TestResponder.java:141) 在fitnesse.responders.run.TestResponder.doSending(TestResponder.java:45) 在fitnesse.responders.ChunkingResponder.startSending(ChunkingResponder.java:67) 在fitnesse.responders.ChunkingResponder.access$000(ChunkingResponder.java:17) 在fitnesse.responders.ChunkingResponder$RespondingRunnable.run(ChunkingResponder.java:106) 在 java.lang.Thread.run(来源不明)

这是代码:

!path C:\...\UnitTest\bin\Debug\TestBuildingMeasurement.dll

!|import|

|TestBuildingMeasurement|

!|Query:fitTest|

|StartDate|EndDate|KWHValue|

|11/6/2010 12:00:00 AM|11/6/2010 1:00:00 AM|1533.01|

|11/6/2010 1:00:00 AM|11/6/2010 2:00:00 AM|1391.76|

|11/6/2010 2:00:00 AM|11/6/2010 3:00:00 AM|1311.90|

C# 代码

public List<Object> query()

    {

        DateTime startDate = new DateTime(2010, 11, 06);//Day before the 2010 change to DST.  

        DateTime toDate = new DateTime(2010, 11, 09);  // Get the data from the day after the change to DST.

        MeterUsageLogic logicTest = new MeterUsageLogic();


        var values = new List<Object>();

        int buildingID = 1;

        MeterUsage_001 dsUsage = logicTest.GetMeterUsageInUTC(buildingID, startDate, toDate, 3600);

        if (dsUsage.Usage.Count == 72)

        {

            for (int count = 0; count < 72; count++)

            {

                Object[] record = dsUsage.Usage.Rows[count].ItemArray;

                DateTime StartDateValue = (System.DateTime)record.GetValue(0);

                string tempStartDateValue = Convert.ToString(StartDateValue);

                DateTime EndDateValue = (System.DateTime)record.GetValue(1);

                string tempEndDateValue = Convert.ToString(EndDateValue);

                Decimal kWHValue = (System.Decimal)record.GetValue(2);

                string tempkWHValue = Convert.ToString(kWHValue);

                List<string> temp = new List<string>();


                List<string> temp1 = new List<string>();

                List<string> temp2 = new List<string>();

                List<string> temp3 = new List<string>();

                //temp1.Add("StartDate");

                temp.Add(tempStartDateValue);

                //temp2.Add("EndDate");

                temp.Add(tempEndDateValue);

                //temp3.Add("KWHourValue");

                temp.Add(tempkWHValue);


                values.Add(temp);


            }

        }

        return values;

    }

另外,如果我得到版本错误的原因,我们将不胜感激。 新安装 我在原始安装中遇到了问题,所以我把它撕下来,再次从 Source forge (20110104) 下载了 Fitnesse,今天从 Github 下载了 .Net runner 今天建造了它。我昨天安装了 JDK,所以 Java 版本是“1.6.0_23”

I am trying to setup Fitnesse to run a "simple" query and I am getting a javalang error when I run the test

Slim Protocol Version Error

Expected V0.3 but was V0.2

Expand All | Collapse All
ABORT

EXCEPTION:java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
at fitnesse.slimTables.QueryTable$QueryResults.makeRowMap(QueryTable.java:178)
at fitnesse.slimTables.QueryTable$QueryResults.(QueryTable.java:170)
at fitnesse.slimTables.QueryTable.scanRowsForMatches(QueryTable.java:84)
at fitnesse.slimTables.QueryTable.evaluateReturnValues(QueryTable.java:72)
at fitnesse.responders.run.slimResponder.SlimTestSystem.evaluateTable(SlimTestSystem.java:365)
at fitnesse.responders.run.slimResponder.SlimTestSystem.evaluateTables(SlimTestSystem.java:360)
at fitnesse.responders.run.slimResponder.HtmlSlimTestSystem.createHtmlResults(HtmlSlimTestSystem.java:40)
at fitnesse.responders.run.slimResponder.SlimTestSystem.processTablesAndGetHtml(SlimTestSystem.java:280)
at fitnesse.responders.run.slimResponder.SlimTestSystem.processAllTablesOnPage(SlimTestSystem.java:263)
at fitnesse.responders.run.slimResponder.SlimTestSystem.runTestsAndGenerateHtml(SlimTestSystem.java:207)
at fitnesse.responders.run.MultipleTestsRunner.executeTestSystemPages(MultipleTestsRunner.java:126)
at fitnesse.responders.run.MultipleTestsRunner.startTestSystemAndExecutePages(MultipleTestsRunner.java:106)
at fitnesse.responders.run.MultipleTestsRunner.executePagesInTestSystem(MultipleTestsRunner.java:92)
at fitnesse.responders.run.MultipleTestsRunner.internalExecuteTestPages(MultipleTestsRunner.java:83)
at fitnesse.responders.run.MultipleTestsRunner.executeTestPages(MultipleTestsRunner.java:56)
at fitnesse.responders.run.TestResponder.performExecution(TestResponder.java:141)
at fitnesse.responders.run.TestResponder.doSending(TestResponder.java:45)
at fitnesse.responders.ChunkingResponder.startSending(ChunkingResponder.java:67)
at fitnesse.responders.ChunkingResponder.access$000(ChunkingResponder.java:17)
at fitnesse.responders.ChunkingResponder$RespondingRunnable.run(ChunkingResponder.java:106)
at java.lang.Thread.run(Unknown Source)

Here is the code:

!path C:\...\UnitTest\bin\Debug\TestBuildingMeasurement.dll

!|import|

|TestBuildingMeasurement|

!|Query:fitTest|

|StartDate|EndDate|KWHValue|

|11/6/2010 12:00:00 AM|11/6/2010 1:00:00 AM|1533.01|

|11/6/2010 1:00:00 AM|11/6/2010 2:00:00 AM|1391.76|

|11/6/2010 2:00:00 AM|11/6/2010 3:00:00 AM|1311.90|

C# code

public List<Object> query()

    {

        DateTime startDate = new DateTime(2010, 11, 06);//Day before the 2010 change to DST.  

        DateTime toDate = new DateTime(2010, 11, 09);  // Get the data from the day after the change to DST.

        MeterUsageLogic logicTest = new MeterUsageLogic();


        var values = new List<Object>();

        int buildingID = 1;

        MeterUsage_001 dsUsage = logicTest.GetMeterUsageInUTC(buildingID, startDate, toDate, 3600);

        if (dsUsage.Usage.Count == 72)

        {

            for (int count = 0; count < 72; count++)

            {

                Object[] record = dsUsage.Usage.Rows[count].ItemArray;

                DateTime StartDateValue = (System.DateTime)record.GetValue(0);

                string tempStartDateValue = Convert.ToString(StartDateValue);

                DateTime EndDateValue = (System.DateTime)record.GetValue(1);

                string tempEndDateValue = Convert.ToString(EndDateValue);

                Decimal kWHValue = (System.Decimal)record.GetValue(2);

                string tempkWHValue = Convert.ToString(kWHValue);

                List<string> temp = new List<string>();


                List<string> temp1 = new List<string>();

                List<string> temp2 = new List<string>();

                List<string> temp3 = new List<string>();

                //temp1.Add("StartDate");

                temp.Add(tempStartDateValue);

                //temp2.Add("EndDate");

                temp.Add(tempEndDateValue);

                //temp3.Add("KWHourValue");

                temp.Add(tempkWHValue);


                values.Add(temp);


            }

        }

        return values;

    }

Also an help as to why I am getting the version error would be appreciated.
NEW install I was having issues with the original install so I ripped it out downloaded Fitnesse again from Source forge (20110104), Downloaded the .Net runner from Github today
and built it today. I installed the JDK yesterda so Java version is "1.6.0_23"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文