Tag: 基准testing

angular2testing,我怎么模仿子组件

如何在茉莉花testing中模拟子组件? 我有MyComponent ,它使用MyNavbarComponent和MyToolbarComponent import {Component} from 'angular2/core'; import {MyNavbarComponent} from './my-navbar.component'; import {MyToolbarComponent} from './my-toolbar.component'; @Component({ selector: 'my-app', template: ` <my-toolbar></my-toolbar> {{foo}} <my-navbar></my-navbar> `, directives: [MyNavbarComponent, MyToolbarComponent] }) export class MyComponent {} 当我testing这个组件时,我不想加载和testing这两个子组件; MyNavbarComponent,MyToolbarComponent,所以我想嘲笑它。 我知道如何使用provide(MyService, useClass(…))来模拟服务,但我不知道如何模拟指令; 组件; beforeEach(() => { setBaseTestProviders( TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS ); //TODO: want to mock unnecessary directives for this component test // […]

是否有可能在轨道集成testing或规范中指定用户代理?

我之前在一个ActionController::IntegrationTest中的rails 2应用程序中执行此操作 get '/', {}, {:user_agent => "Googlebot"} 但是这在Rails 3中似乎不再适用。 我该怎么办?

Python有没有像水豚/黄瓜?

Ruby在Selenium上面有一个叫做Capybara的很好的抽象层,你可以使用它来做function/验收/集成testing。 另外还有一个名为“黄瓜”的图书馆,让你更进一步,让你用英语写实验。 这两个库都build立在Selenium之上,可以用来testing任何主要的浏览器,但是由于它们的抽象层,使用它们来编写testing是非常容易的(就像functiontesting至less可以这么简单)。 我的问题是:Python是否有类似的东西? 我发现Pythonistas用各种工具做functiontesting,但是… A)分裂:不使用Selenium(并且没有IE驱动程序) -EDIT-看起来分割器现在使用selenium(见下面的答案)。 B)Alfajor:一年多没有更新; 看起来死了 C)selenium(生):很多人似乎直接使用selenium,但它似乎是一个抽象层可以使它更容易使用 那么,有没有人知道任何类似Capybara的,或者更好的,对于Python来说,它更像Cucumber(它不一定非要使用Selenium,但它需要支持所有的主stream浏览器)? *编辑* 对于那些不熟悉Capybara的人来说,它基本上只是增加了一个API,所以你可以这样来代替普通的Selenium API: When /I sign in/ do within("#session") do fill_in 'Login', :with => 'user@example.com' fill_in 'Password', :with => 'password' end click_link 'Sign in' end 它被黄瓜使用,让你进一步抽象(几乎英文): Scenario Outline: Add two numbers Given I have entered <input_1> into the calculator And I have entered <input_2> […]

你有没有在一个真正的项目中使用Quickcheck

Quickcheck及其变体(甚至Java中有一个)似乎很有趣。 然而,除了学术上的兴趣之外,它在真正的应用程序testing(例如GUI应用程序或客户端/服务器,甚至是StackOverflow本身)中真的有用吗? 你有类似的testing发生器的任何经验,赞赏。

NUnit:testing没有预期的exception

我想创buildNUnittesting,以确保我的函数不会抛出exception。 有没有一些具体的做法,或者我应该写 [Test] public void noExceptionTest() { testedFunction(); } 如果没有抛出exception,它会成功?

angular2 testing:无法绑定到'ngModel',因为它不是'input'的已知属性

我正在尝试为控制inputtestingangular2双向绑定。 这是错误: Can't bind to 'ngModel' since it isn't a known property of 'input'. app.component.html <input id="name" type="text" [(ngModel)]="name" /> <div id="divName">{{name}}</div> app.component.ts @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent implements OnInit { name: string; } app.component.spec.ts import { TestBed, async } from '@angular/core/testing'; import { AppComponent } from './app.component'; import { AppService […]

开发smtp服务器的Windows

我正在寻找一个免费的testingsmptp服务器,可以将电子邮件保存到我的开发testing文件 。 由于我的开发环境是Windows,我更喜欢testing电子邮件服务器在Windows上运行,但我可以考虑安装任何其他基于Linux的替代品。

如何在执行bash脚本时显示行号

我有一个testing脚本,它有很多的命令,并会产生大量的输出,我使用set -x或set -v和set -e ,所以脚本会在发生错误时停止。 但是,要确定哪个线路执行停止以find问题还是很困难的。 有没有一种方法可以在每行执行之前输出脚本的行号? 或者在set -x生成的命令展示之前输出行号? 或者任何可以处理我的脚本行位置问题的方法将是一个很大的帮助。 谢谢。

Rspec – Rails – 如何遵循redirect

有谁知道如何使rspec遵循redirect(在控制器规范)? (例如,testing/单元具有follow_redirect!) 我试过“follow_redirect!” 和“follow_redirect”,但只能得到 undefined method `follow_redirect!' for #<Spec::Rails::Example::ControllerExampleGroup::Subclass_1:0xb6df5294> 例如: 当我创build一个帐户,该页面被redirect到帐户页面,我的新帐户应该在列表的顶部。 it "should create an account" do post :create, :name => "My New Account" FOLLOW_REDIRECT! response.code.should == "200" accounts = assigns[:accounts] accounts[0].name.should == "My New Account" end 但是FOLLOW_REDIRECT! 需要改变成实际工作的东西。

写“unit testing”的代码?

你使用什么样的做法来使你的代码更友好的unit testing?