1

以下是我在 Fitnesse 中的页面。我有一个名为 TestSuiteFitnesse.DLL 的 .NET 类文件,这里是填充 SCRIPT 表的装置。我们传入 TT1 和 Client Registration 变量。我们有另一个 .NET 类文件调用 CRLib.dll。根据变量的值,它会做不同的工作。该工作的一部分是从 app.config 文件中读取并从用于查询数据库和构造返回的部分返回值。我遇到的问题,我现在尝试了很多网站,似乎找不到答案。当我运行 Fitnesse 页面时,我收到一条错误消息,告诉我代码在 app.config 中找不到部分。我已经阅读了有关创建suite.app 或类似内容的信息,但我无法终生让它工作,以便它读取app.config。

任何帮助都被大大接受。

<'''CC Client Registration'''>
!contents -R2 -g -p -f -h
!define TEST_SYSTEM {slim}
!define MANUALLY_START_TEST_RUNNER_ON_DEBUG {true}
!define COMMAND_PATTERN {%m -r fitSharp.Slim.Service.Runner,C:\ Fitnesse \release.2.3.net.40\fitsharp.dll %p}
!define TEST_RUNNER {C:\Fitnesse\release.2.3.net.40\Runner.exe}
!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}

!path C:\Code\branches\ProcessImprovement\src\dotNet\StandaloneUtilities\TestSuite\TestSuiteFitnesse\bin\Debug\TestSuiteFitnesse.dll

!|import |
|TestSuiteFitnesse|

|script|Register Client|TT1|Client Registration|||
|show|Return Operation|
|show|Run Task|
|show|Get Path|
|show|Get Stream|
|show|Get ID|

这是配置文件:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name="Environments">
      <section name="FUT2" type="System.Configuration.NameValueSectionHandler"></section>
      <section name="FUT1" type="System.Configuration.NameValueSectionHandler"></section>
    </sectionGroup>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  </configSections>

  <appSettings>
    <clear/>
    <!--This key is used to set the devices' base folder.-->
    <add key="DeviceBasePath" value=".\devices"/>
    <!--hpp url -->
    <add key="HPPassport"  value="https://mysite.com/login.fcc?"/>

    <!--This key is used to randomize the device name.-->
    <add key="RandomizeDeviceName" value="FALSE" />

    <!--This key is to define the times of retrying to get device ID via SBS. Between 2 retries there is a break of 5 seconds.--`>`
    <add key="RetryTimes" value="50" />
  </appSettings>
</configuration>
4

1 回答 1

0

尝试这个:

!define COMMAND_PATTERN {%m -a c:\mypath\myapp.config ... %p}

(来自http://fitsharp.github.io/FitSharp/AppConfigFile.html

于 2014-08-27T03:38:47.163 回答