testing

Send parameter to Nancy module from test

て烟熏妆下的殇ゞ 提交于 2020-01-04 06:31:13
问题 I'm trying to test a module with parameter (below is only code where I'm trying to figure the problem out) public class StuffModule : NancyModule { public StuffModule() : base("/Stuff") { Get["/All/"] = parameters => { string str = parameters.one; return Response.AsJson(str); }; } } private Browser _browser; [SetUp] public void SetUp() { var module = new StuffModule(null); var mock = new Mock<IRecipeExtractor>(); var bootstrapper = new ConfigurableBootstrapper( with => with.Dependency(mock

Cypress not matching routes

与世无争的帅哥 提交于 2020-01-04 05:51:06
问题 I am trying to write a cypress test that emulates a slow API, so after reading some documentation I came up with this: before(function() { cy.server({delay: 5000}); }); beforeEach(() => { cy.route({ method: "GET", url: "**/api/**" }); cy.visit("http://localhost:9000"); }); That should add a 5 second delay to all requests to API , right? The issue I am seeing is that it is not matching to any requests even through there are plenty of calls to */api/* . The cypress GUI does however see the

XC Testing Framework iOS(XCode 6.1) Test session exited(80) without checking in

两盒软妹~` 提交于 2020-01-04 04:23:09
问题 I have a project in XCode which runs fine, but when i try testing it using the (XCTestCase) Testing framework I get this error "Test session exited(80) without checking in : Executable does not provide an architecture compatible with the current process" The architecture setting for the project is "standard architectures(armv7,arm64)" From the error statement it looks like i have issues with the architecture settings of the project, which I am unable to figure out what exactly. From the

CasperJS test coverage

我只是一个虾纸丫 提交于 2020-01-04 04:22:06
问题 Is it possible to get test coverage for casperJS tests? (Like istanbul or mocha-lcov). I googled a lot and could not find any official or unofficial coverage tool. 回答1: Look at this casper issue: https://github.com/gotwarlost/istanbul/issues/153 Currently Istanbul is recommended: https://github.com/gotwarlost/istanbul-middleware 来源: https://stackoverflow.com/questions/25229613/casperjs-test-coverage

Internet Explorer versions testing in February 2014: browserstack, saucelabs, ghostLab, spoon & other tools

不羁岁月 提交于 2020-01-04 04:04:09
问题 I am currently (February 2014) trying to find the best tool to perform Internet Explorer versions testing (IE8, IE9, and so on) . I found that my options were the following: Run any web browsers instantly from the web, using: www.browserstack.com, saucelabs.com , ghostLab or www.spoon.net Run IE VMs from Modern.IE project (for IE web browsers testing) One Windows VM + multiple standalone versions of Internet Explorer using http://utilu.com/IECollection/ (for IE web browsers testing) Dedicated

Factory Girl with has many relationship (and a protected attribute)

我是研究僧i 提交于 2020-01-04 04:02:44
问题 I have this kind of relation: class Article < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :article attr_protected :article_id end The default scenario inside controllers looks like: @article = Article.create(:title => "foobar") @comment = @article.comments.create(:content => "w00t") I had tried to write those factories: Factory.define :article do |f| f.title "Hello, world" end Factory.define :comment do |f| f.content "Awesome!" f.association

Factory Girl with has many relationship (and a protected attribute)

我的梦境 提交于 2020-01-04 04:02:44
问题 I have this kind of relation: class Article < ActiveRecord::Base has_many :comments end class Comment < ActiveRecord::Base belongs_to :article attr_protected :article_id end The default scenario inside controllers looks like: @article = Article.create(:title => "foobar") @comment = @article.comments.create(:content => "w00t") I had tried to write those factories: Factory.define :article do |f| f.title "Hello, world" end Factory.define :comment do |f| f.content "Awesome!" f.association

How to test a component which contains a custom form control?

荒凉一梦 提交于 2020-01-04 03:01:07
问题 I got a component like this @Component({ selector: 'app-custom-form-control', templateUrl: '<input>', providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SelectComponent), multi: true } ] }) export class CustomFormControlComponent implements ControlValueAccessor {...} As you see it's a custom form control. I use it in a component which I'm going to test. @Component({ selector: 'app-root', templateUrl: '<div [formGroup]="form"> <app-custom-form-control formControlName="my

Invalid JSON in Playframework 2.1 Test POST Request

微笑、不失礼 提交于 2020-01-04 02:56:07
问题 I am trying to test a POST route (on Playframework 2.1/ Java) and keep getting Bad Request - Invalid JSON response. Please let me know what I am doing wrong. My Test code is below. running(fakeApplication(), new Runnable() { public void run() { Map map = new HashMap(); map.put("key1", "val1"); map.put("key2", 2); map.put("key3", true); JsonNode df= Json.toJson(map); Result result = route (fakeRequest(POST, "/item").withHeader("Content-Type", "application/json").withSession(AccountTest.USER

Sinatra tests always 404'ing

不想你离开。 提交于 2020-01-04 02:54:34
问题 I have a very simple Sinatra app which I'm having trouble testing. Basically, every single request test returns a 404 when I know from testing in the browser that the request works fine. Any ideas as to what the problem might be? test_helper.rb: ENV["RACK_ENV"] = 'test' $: << File.expand_path(File.dirname(__FILE__) + '/../lib') require 'app' Sinatra::Synchrony.patch_tests! class Test::Unit::TestCase include Rack::Test::Methods end app_test.rb require 'test_helper' class AppTest < Test::Unit: