我们正在构建一个基于SalesForce.com云的大型CRM系统.我正在尝试为系统制定一个测试计划,但我不确定如何创建系统范围的测试.我想为此使用一些行为驱动的测试技术,但我不确定如何将它们应用于平台.
对于我们将在系统中构建的自定义部件,我计划使用Cucumber of SpecFlow在UI上驱动Selenium操作.但对于SalesForce UI Customisations,我不确定测试的深度.诸如工作流和验证规则之类的定制可以封装我认为应该测试的许多复杂逻辑.
在SalesForce中为这个开箱即用的功能编写Selenium测试对于价值来说似乎过于繁琐.您能否与SalesForce.com平台分享您在系统测试方面的经验,我们该如何处理?
我有ExcelStepDefinition类,其中有我的excel测试步骤.我也有WordStepDefinition类.由于我有两个类相同的大量步骤,我创建了一些StepDefinition类,它将成为这两个类的基类.
在这个基类中,我需要在构造函数中有一些args,这取决于实例化的类(excel或word).我已经做了所有这些,但是当我在Nunit中开始测试时,它失败并跟随堆栈跟踪:
System.IndexOutOfRangeException : Index was outside the bounds of the array.
TearDown : System.IndexOutOfRangeException : Index was outside the bounds of the array.
at TechTalk.SpecFlow.ScenarioContext.GetBindingInstance(Type bindingType)
at TechTalk.SpecFlow.ScenarioContext.GetBindingInstance(Type bindingType)
at lambda_method(ExecutionScope )
at TechTalk.SpecFlow.Bindings.MethodBinding.InvokeAction(Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.TestRunner.FireEvents(BindingEvent bindingEvent, IEnumerable`1 tags)
at TechTalk.SpecFlow.TestRunner.FireScenarioEvents(BindingEvent bindingEvent)
at TechTalk.SpecFlow.TestRunner.OnScenarioStart(ScenarioInfo scenarioInfo)
at ABZ.ExcelTest.DisplayValueOfLinkedItemUsingFormattingRulesDefinedForAGivenLanguageFeature.ScenarioSetup(ScenarioInfo scenarioInfo) in D:\Projects\VS2008\ABZ\ABZ Report Office\ABZ.ExcelTest\ExcelSwitchLanguage.feature.cs:line 0
at ABZ.ExcelTest.DisplayValueOfLinkedItemUsingFormattingRulesDefinedForAGivenLanguageFeature.DisplayFactValueWithFormattingDefinedInSelectedLanguage(String cell, String column, String label, String lang, String cellValue) in d:\Projects\VS2008\ABZ\ABZ Report Office\ABZ.ExcelTest\ExcelSwitchLanguage.feature:line 23
--TearDown
at TechTalk.SpecFlow.ScenarioContext.GetBindingInstance(Type bindingType)
at …Run Code Online (Sandbox Code Playgroud) 有没有人将 Specflow 与ApprovalTests一起使用?
我发现它限制了每个 NUnit 测试只能批准一个文件,因此每个场景只能有一个批准的文件。即使您使用场景大纲,情况也是如此。
这意味着我通常必须连接文件并批准一个代表大量独立测试结果的大文件。
我想知道有没有人找到更好的方法?
是否可以从Visual Studio 2012中的Visual Studio 2010获得相同的测试列表编辑器功能?
我想做的是制作一组包含我想要运行的测试的列表.运行列表时,我希望能够轻松地将测试从一个列表移动到另一个列表.这在VS2010中很容易,但是VS2012中的测试资源管理器不再可能了.我知道类别功能,但这不是我想要的.它本质上可能与VS2010的测试列表编辑器中的测试完全相同,但需要更多的工作.
有没有人知道一个有效的解决方法或插件或类似的东西,以在VS2012中获得相同的功能?
// UPDATE
几个月没有使用SpecFlow后,我使用SpecFlow选择了另一个项目.在VS2012中使用SpecFlow进行测试时发生了一些变化.现在可以在VS2012中获得与VS2010中描述的功能相近的功能.这就是我的诀窍:
我希望这次更新能够帮助那些遇到与我相同问题的人.
我试图通过使用Moq这里测试我的帐户控制器是我做了什么
调节器
private readonly IWebSecurity _webSecurity;
public AccountController(IWebSecurity webSecurity)
{
this._webSecurity = webSecurity;
}
public ActionResult Login(LoginModel model, string returnUrl)
{
if (ModelState.IsValid && _webSecurity.login(model))
{
return RedirectToLocal(returnUrl);
}
// If we got this far, something failed, redisplay form
ModelState.AddModelError("", "The user name or password provided is incorrect.");
return View(model);
}
private ActionResult RedirectToLocal(string returnUrl)
{
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction("Index", "Home");
}
}
Run Code Online (Sandbox Code Playgroud)
IWebSecurity
public interface IWebSecurity
{
bool login(LoginModel model);
} …Run Code Online (Sandbox Code Playgroud) 我使用VS2013 specflow页面中的"下载"按钮安装 了Specflow
我使用添加新项目和选择SpecFlow功能文件为我的Specs项目添加了一个功能
当我构建项目时,我得到错误1无法找到类型或命名空间名称'TechTalk'(您是否缺少using指令或程序集引用?)
我也提到错误,提到NUnit丢失了.
我在哪里可以找到要引用的文件,如何使用TechTalk.Specflow 1.9.3.0检查它们是否正确?
我想在Specflow语法中重载步骤定义.与此类似.你能帮我写正确的正则表达式吗,因为现在它们不能一起工作.谢谢
[Given(@"^Click on ""(.*)""$")]
And Click on "Ok"
[Given(@"^Click on ""(.*)"" in \$""(.*)""$")]
And Click on "Search" in $".someselector"
Run Code Online (Sandbox Code Playgroud) 我们的 Visual Studio 项目有 > 600 个测试。该项目在本地执行单元测试和规范流测试运行 3 次,而在我的同事 pc 中他们执行一次(显然是第三次,这是一个巨大的预期效果)。我似乎找不到如何让我的单元测试只执行一次而不是三次,我该怎么做?
我正在使用 c#、selenium 和 specflow 运行自动化测试套件。如果可能,我希望能够查看为当前场景分配了哪些标签,以便我可以为每个场景实例化特定的浏览器类型。这甚至可以使用 XUnit 吗?
登录功能文件:
Feature: Login
In order to login to DRIVE
As a user
We have to enter login details
Background:
Given I am on the login page
@headless
Scenario: Logging in as a valid user
And I enter a valid user and password
When I submit the login form
Then The user should be logged in
Run Code Online (Sandbox Code Playgroud)
WebDriverContext.cs 文件
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.PhantomJS;
namespace Drive.Acceptance.Tests
{
public interface IWebDriverContext {
IWebDriver GetDriver();
} …Run Code Online (Sandbox Code Playgroud) 我创建了一个新的SpecFlow特征文件,我通过右键单击然后"生成步骤定义..."创建了步骤定义.
步骤定义文件SpecFlowFeature1Steps.cs在那里,并且特征文件的intellisense没有标记紫色的任何行(这是用于缺少步骤定义).
然而,当我进行单元测试时,我得到了:
One or more step definitions are not implemented yet.
SpecFlowFeature1Steps.GivenIHaveEnteredIntoTheCalculator(50)Given I have entered 50 into the calculator
-> pending: SpecFlowFeature1Steps.GivenIHaveEnteredIntoTheCalculator(50)
And I have entered 70 into the calculator
-> skipped because of previous errors
When I press add
-> skipped because of previous errors
Then the result should be 120 on the screen
-> skipped because of previous errors
Run Code Online (Sandbox Code Playgroud)
这是功能文件:
Feature: SpecFlowFeature1
In order to avoid silly mistakes
As a math idiot
I want to be told …Run Code Online (Sandbox Code Playgroud) specflow ×10
c# ×4
testing ×2
unit-testing ×2
asp.net-mvc ×1
cucumber ×1
moq ×1
regex ×1
salesforce ×1
selenium ×1
xunit ×1