我正在用编译我的C#代码,我已经安装了Specflow
我得到以下错误无法找到元素'specflow‘的架构信息
我的AppConfig文件具有以下设置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
</configSections>
<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc- config -->
</specFlow>
<appSettings>
...
</appSettings>
</configuration>为什么它抱怨找不到specflow的模式信息?
在我的步骤定义文件中,我包含在类的顶部。
using NUnit.Framework;
using OpenQA.Selenium;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TechTalk.SpecFlow;
using G.Selenium;
namespace WebdriverBdd
{
[Binding]
public class SearchSteps : SeleniumWebDriver
{
[Given(@"user is on g search page")]
public void UserIsOnGSearchPage()
{
SeleniumWebDriver selenium_driver = new SeleniumWebDriver();
}
}发布于 2015-07-16 22:10:21
注意:由于您的specFlow配置部分是空的,所以您可以直接删除它。在任何一种情况下,SpecFlow都将使用默认值。
找不到元素“specFlow”的架构信息。
该消息仅提供信息。许多configSections没有模式,因为它们非常简单、非常复杂,或者有无法跟上的插件选项。
您可以从文档或使用XML文件作为示例创建XML架构。要从一个示例中创建一个(当然,这个示例可能非常适合该示例),请打开XML (app.config)并选择菜单命令。
在App.config的情况下,模式将用于整个配置。只需将其压缩到specflow配置部分即可。我这样做是用我的,它指导MS测试的代码生成,而不是NUnit。然后,通过为unitTestProvider的名称创建一个枚举,我对其进行了一些改进。
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="specFlow">
<xs:annotation>
<xs:documentation>
Customizes SpecFlow code generation. This unofficial schema is hand-crafted based on actual use.
For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config.
Should occur zero or one times in an app.config.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="1">
<xs:element name="unitTestProvider">
<xs:complexType>
<xs:attribute name="name" type="SpecFlowUnitTestProvider" use="required" />
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="SpecFlowUnitTestProvider">
<xs:restriction base="xs:string">
<xs:enumeration value="MsTest" />
<xs:enumeration value="NUnit" />
</xs:restriction>
</xs:simpleType>
</xs:schema>https://stackoverflow.com/questions/27929387
复制相似问题