开发者

Fitnesse .Net Java Lang error

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);

    开发者_JAVA技巧            //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"


The Slim query table expects a list of lists of lists. See http://fitnesse.org/FitNesse.UserGuide.SliM.QueryTable and http://github.com/jediwhale/fitsharp/blob/master/source/Samples/SlimSamples.cs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜