我正在尝试设置Fitnesse来运行“简单”查询,并且在运行测试时出现javalang错误
超薄协议版本错误
预期V0.3但是为V0.2
展开全部|全部收缩 ABORT
EXCEPTION :java.lang.ClassCastException:java.lang.String无法强制转换为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) 在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运行 并在今天建造它。我安装了JDK yesterda,因此Java版本是“1.6.0_23”
答案 0 :(得分:1)