w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Can protractor test a login that is not angular based
After placing the issue on github I received the answer I was looking for. This can be found HERE! Protractor requires that Angular be present on the page and the way around this is to use the driver directly. Following the link above should stear anyone stuck on the same issue in the right direction. Kudos to JulieMR and the others who helped out with this issue.

Categories : C#

Is protractor Angular's new scenario runner?
In the AngularJS 1.2 and Beyond meetup last night they talked about Protractor and said that they are migrating all of their end to end tests to Protractor. It sounded like this is in the early stages but is the direction they are going. The slides are at: https://docs.google.com/presentation/d/1WHCcp3G3HxoE7b_ut_ERKJF4zQK_P4qFlESjE2E9AUQ/edit and I assume the video will be available in a couple of days. Here's the link to the meetup: http://www.meetup.com/AngularJS-MTV/events/120927882/ btw, there was a ton of really interesting info in the meetup -- well worth the watch.

Categories : Angularjs

Unit test thoroughness - test passing conditions as well as failing ones?
This is a scenario where you want to use one parametrized test which gets all 99 values as input. Using xUnit.net, this could look like this (untested, might contain small compilation errors): [Fact] public void Widget_CannotActiveWidgetIfStateIsCancelled() { // Arrange ... sut.State = State.Cancelled; Assert.False(sut.CanActivate); } [Theory, ValidStatesData] public void Widget_CanActivateWidgetIfStateIsNotCancelled(State state) { // Arrange ... sut.State = state; Assert.True(sut.CanActivate); } private class ValidStatesDataAttribute : DataAttribute { public override IEnumerable<object[]> GetData( MethodInfo methodUnderTest, Type[] parameterTypes) { return Enum.GetValues(typeof(State)) .Cast<State>()

Categories : Unit Testing

Why is this Model test breaking (not failing) when I run 'rake test:models'?
The trace is telling you that you have unknown command 'i' at line 39 of the file product_test.rb (that's what that product_test.rb:39) means. Do you have some misplaced i somewhere on that line? It might be outside of the snippet you quoted -- I can't tell without your line numbers.

Categories : Ruby On Rails

Test passing.But Test List is Failing
If you are testing a web application, as you know telerik tests the UI components based on the baseURL. There are 2 different locations for settings when you are running as a test(vs running as a testList). Cross verify the baseURL in both the settings section(if they are the same). As I can see the error is Element Not found. Which might be coz, the associated baseURL for that element is different.

Categories : Misc

angular-mock.js conflicts with htmlunit? How to test angular application using angular-mock.js in maven-jasmine
In the CHROME browser version the error occurs when angular tries to load JQLite a api-compatible subset of the jQuery library that allows angular to manipulate the DOM. I was able to fix the issue by downloading uncompressed versions of jQuery (v1.10.2), angular (v1.0.7), and angular-mocks (v1.0.7). I added the following to the configuration in the jasmine-maven-plugin. <preloadSources> <preloadSource>${angular-test-deps}/jQuery.js</preloadSource> <preloadSource>${angular-test-deps}/angular.js</preloadSource> <preloadSource>${angular-test-deps}/angular-mocks.js</preloadSource> </preloadSources> The angular documentation states that "Real jQuery always takes precedence over jqLite, provided it was loaded before DOMContentLoaded eve

Categories : Unit Testing

Failing rspec test
The error message is telling you that the page does not have the selector 'div.alert.alert-success'. It looks like the error is related to this line: it { should have_selector('div.alert.alert-success', text:'Welcome') }` Capybara has a nifty method called save_and_open_page that lets you inspect the HTML file that Capybara parses. Call this method and view the source to inspect the selector that is not working for you. If you are still having trouble, paste the HTML that corresponds to the selector in your question. You should clean up the formatting of your code because it is very hard to read with the inconsistent spacing and indentation.

Categories : Ruby On Rails

Test failing ndb transaction
From the docs: If the function raises an exception, the transaction is immediately aborted and NDB re-raises the exception so that the calling code sees it. You can force a transaction to fail silently by raising the ndb.Rollback exception (the function call returns None in this case). There is no mechanism to force a retry. You can raise an exception in your unittest instead of your put() routine to simulate that event, and it should emulate the same outcome - because a failure to put will cause the all datastore events in the transaction to rollback anyway. You might find these kinds of transaction exceptions: You can receive Timeout, TransactionFailedError, or InternalError exceptions in cases where transactions have been committed and eventually will be applied successfully.

Categories : Python

Automapper Failing Unit Test
The problem is that you're configuring the mapping inside a test and expecting another test to use this configuration. Take into account they are supposed to be independent so one test can't rely on other test execution. This is really important You'll need to create the mapping on Mappings_ViewModel_Address_ToDTO_pass or on a common setup.

Categories : C#

Nokogiri scraping test failing?
@department_hash is not defined within the scope of the test. If you take a simple example: require 'rspec/autorun' @department_hash = 2 puts defined?(@department_hash) #=> "instance-variable" describe "Department" do it "should scrap correct string" do puts defined?(@department_hash) #=> "" (ie not defined) end end You can see that @department_hash is defined in the main, but it is not defined within the test. You need to run your app code from within the scope of the test. For example, moving the code into the test, @department_hash will no longer be nil. require 'rspec/autorun' require 'nokogiri' require 'open-uri' describe "Department" do it "should scrap correct string" do url = "http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%

Categories : Ruby

hartl tutorial failing test at end of 9.2.1
You are missing a call to your signed_in_user filter on line 2 of your users_controller.rb. You defined the filter at the end of the controller, but you didn't call it! :) At the very end of the tutorial, that line should look like this: before_action :signed_in_user, only: [:index, :edit, :update, :destroy, :following, :followers] However since you have not created followers yet, I think it should look something like this: before_action :signed_in_user, only: [:index, :edit, :update, :destroy] I have found it very useful to copy the final source of the code on my hard drive, so I can compare my code to the original whenever I encountered a bug while doing this book.

Categories : Ruby On Rails

How to get the original error from a failing JUnit test?
One method of drilling down to the root exception is something like this: catch(Throwable t) { while(t.getCause != null) { t = t.getCause(); } t.printStackTrace(System.out); }

Categories : Java

py.test is failing to deal with creating files
Oddly enough, using 'xelatex' instead of 'pdflatex' makes things work as normal. For any future readers - I have TeXworks installed which presumably installed both these tools. I don't know if xelatex influences the final pdf produced. It seems to be producing a good .pdf Anyway, I made this answer to my own question since there doesn't seem to be anything else coming and it certainly solved my problem.

Categories : Python

AngularJS controller test failing with RequireJS
Yes, I have found the solution. Here is my blog post for the same. GitHub code is here : sample It is done through mocking the module creation. Edit : With code. The trick here is to initialize AngularJS like this : define(function(){ var app = angular.module('AngularAppModule', 'ngResource']);app.lazy = app; return app;}); This will add app.lazy reference in Angular, and then RequireJS can initialize the controllers the same way. Test-main.js file is the same. For running Karma, test-main will load all the scripts upfront and Require will not be intrusive. Let me know if you have further questions.

Categories : Angularjs

Simple HttpClient test failing on Mono
You should almost never use async void methods and this is one reason why. Your Main() will end before HttpClientCall() actually completes. And since exiting from Main() terminates the whole application, nothing will get printed. What you should do is to change your method into async Task and Wait() for it in your Main(). (Mixing await and Wait() can often lead to deadlocks, but it's the right solution for console applications.) class MainClass { public static void Main() { new Client().HttpClientCallAsync().Wait(); } } public class Client { HttpClient client = new HttpClient(); public async Task HttpClientCallAsync() { HttpClient httpClient = new HttpClient(); HttpResponseMessage response = await httpClient.GetAsync("http://vendhq.com");

Categories : C#

Allowing multiple AssertionErrors before failing a test
var found = ['Alice', 'Bob', 'John'].map(function (name) { return pageContent.indexOf(name) >= 0; }); assert.include(found, true); If I may opine that your desire for a wrapper library for fuzzy asserting sounds misguided. Your fuzzy rules and heuristics about what is a "soft" vs "hard" assertion failure seem like a much less sensible alternative than good old programming using the existing assertion paradigm. It's testing. It's supposed to be straightforward and easy to reason about. Keep in mind you can always take logic such as the above and wrap it in a function called includesOne(pageContent, needles) so it is conveniently reusable across tests.

Categories : Node Js

Why is my intern test failing with "document is not defined"
It looks like you’re trying to load some code using the Node.js client that requires a browser environment. This won’t work. You should only load the ev/tests/FilterGrid test suite in a browser. You can do this by modifying your Intern configuration file to look something like this: define([ 'intern/node_modules/dojo/has' ], function (has) { var suites = []; if (has('host-browser')) { suites.push('ev/tests/FilterGrid'); } return { // ...your existing configuration... suites: suites, // ... }; });

Categories : Unit Testing

Capybara test failing with AJAX response
The capybara test needed to have the option js: true passed into the descrbe block. Here is the result: describe "when current_user is the comment's author", js: true do it 'should edit the comment content' do visit post_path(commented_post) within ("#comment-#{commented_post.comments.first.id}") do click_on "edit" end fill_in 'comment_content', with: 'No, this is the best comment' click_on 'Edit Comment' expect(page).to have_content('No, this is the best comment') end end

Categories : Jquery

Failing rspec test on silly blocks
This doesn't work on the console neither, since n is defined within the block scope of the repeater method. What you're seeing on the console is the value returned by the times block, but if you inspect the value of n, it will still be zero. If you change your repeater method to: def repeater(x=0) if x == 0 return yield else x.times do |n| yield end end end Then the specs will pass, since the reference to n will be given by the calling context

Categories : Ruby

Unit Test failing when comparing two ILists
You need to define Equals and GetHashCode for your BusinessModel class. The default Equals implementation is reference equality, and your object references will be different for the items in the two lists. Alternatively you can create an IEqualityComparer<BusinessModel> which defines equality/hash code and pass that to SequenceEquals.

Categories : C#

Rspec test failing for POST member route
The id parameter is the id of the answer: post :vote, id: @answer.id You might also need to pass the value parameter (maybe an 'up' or 'down' value?). There may be other reasons for the test to fail, e.g. validations in the Vote model. If vote.save returns false then check the errors collection. Following comments: You need to pass the value as a param to post in your spec. It also seems you have a duplicate vote, you probably don't need to create @vote in your spec at all. The errors collection is populated by the valid? method which is called by save.

Categories : Ruby On Rails

Rspec test failing: creating new record rather than using existing one
You're mixing acceptance specs and request specs here. @roll will not be modified when you perform capybara requests (via fill_in, etc). Acceptance specs test the contents of the response. Request specs test operations on records for a given request. You might consider splitting up your tests like so: # Acceptance test describe "when visiting roll call with no notes" do before do login_as_sensei @dojo = FactoryGirl.create(:dojo, name: "Melbourne") @time = FactoryGirl.create(:times, dojo: @dojo) @roll = FactoryGirl.create(:roll_call) visit time_roll_calls_path("melbourne", "14-2-2013", "1000") end it { should_not have_content("This is a note!") } describe "and filling in note information correctly" do before do fill_in "roll_call[notes]", with: "Thi

Categories : Ruby On Rails

Why is my test failing because of inclusion error for a date range?
The shoulda matchers check the error message in addition to the range of values. If you look at the implementation at the link you posted, you'll see that both the low and high message default to :inclusion (the symbol used for looking up the internationalized version of the standard rails error message). The error message check in the allow value matcher allows the expected message to be specified as a symbol, a regexp, or a string. You're also using a different range in your validation than you are in your test (a range of dates vs a range of ints). I believe your test will pass if you change it to: it { should ensure_inclusion_of(:birthday).in_range(Date.new(1850)..Time.now.years_ago(13).to_date).with_message(/must be at least 13/) }

Categories : Ruby On Rails

Simple Channel API Related Test Failing with 1.8.2 Upgrade
I logged this as an issue on the Google App Engine SDK issue tracker. The issue I logged is mentioned in the original comments. The issue was accepted and is scheduled to be fixed in the next (1.8.3) release of the Google App Engine SDK. Thanks for reading.

Categories : Python

Rails 4 rspec test failing on numericality only_integer on boolean value?
The spec is correct. 1 is truthy (the only non-truthy values in Ruby are false and nil), but it is not a boolean. Booleans are not numeric; they are their own type. A numericality validation will validate that the type is actually numeric, and boolean is not numeric. > true.class => TrueClass > 1.class => Fixnum What you probably want instead, though, is a validation that tests for a boolean value: validates :is_foo, inclusion => {:in => [true, false]}

Categories : Ruby On Rails

failing to insert data into sqlite database via test case iOS
On iOS, you should consider using CoreData rather than using SQLite directly. CoreData, by default, persists to SQLite and it has much more friendly documentation. Also, since CoreData is not a C API, it will interoperate more nicely with the rest of your Objective-C code. There's also nice Xcode integration when using CoreData, which will let you define schemas easily. You'll also avoid, in many cases, writing SQL queries. For comparisons between the two see this related question.

Categories : IOS

Rspec validates_uniqueness_of test failing with additional validation errors
It's failing because you're not testing @answer. You're not defining your subject in these tests. So it's using rspec's subject which by default is going to a new instance of whatever class you're describing, ie. Answer.new. You either need to explicitly set the subject to @answer or explicitly test @answer. describe Answer do it { should validate_uniqueness_of(:correct).scoped_to(:question_id).with_message("correct You can only have 1 correct answer per question (true)") } it { should validate_uniqueness_of(:user_id).scoped_to(:question_id).with_message("user_id Only 1 answer per question per user (1)") } end

Categories : Ruby On Rails

Failing a scalatest when akka actor throws exception outside of the test thread
Other than examining the logs, I can think of two ways to fail tests when an actor crashes: Ensure that no Terminated message is received Check the TestActorRef.isTerminated property The latter option is deprecated, so I'll ignore it. Watching Other Actors from Probes describes how to setup a TestProbe. In this case it might look something like: val probe = TestProbe() probe watch ref // Actual test goes here ... probe.expectNoMessage() If the actor dies due to an exception it will generate the Terminated message. If that happens during the test and you expect something else, the test will fail. If it happens after your last message expectation, then the expectNoMessage() should fail when Terminated is received.

Categories : Scala

Error with growl
Either put the growl in your own form as follows <h:form id="login-form"> <p:growl id="noti-growl"/> </h:form> Or you should update with full name by putting growl in different form: <h:form id = "growlForm"> <p:growl id="noti-growl"/> </form> <h:form id="login-form"> <p:panel> <h:commandButton value="Đăng nhập" class="button-login" action="index" update = ":growlForm:noti_growl"> </p:panel> </h:form>

Categories : JSF

Hartl RoR Tutorial Chapter 5 Exercise 1: Failing test: it_should_behave_like and should_not have_title
Try updating Capybara to the version 2.1.0 in your Gemfile. have_title is one of the new selectors. Check out this answer for more information

Categories : Ruby On Rails

Jquery BlockUI Growl at bottom right
The problem was that BlockUI was putting top percentage by default: Try this: $(document).ready(function() { $.blockUI({ message: $('div.growlUI'), fadeIn: 700, fadeOut: 700, timeout: 20000, showOverlay: false, centerY: false, css: { right: 0, bottom: 0, left: '', top: '' } }); });

Categories : Jquery

button_to form submittal working in browser but failing rspec/capybara test with routing error
You want a regular submit tag. If using a form helper block: <%= f.submit "RSVP Now" %> Or use the standalone tag helper: <%= submit_tag "RSVP Now" %> Read the documentation on how button_to works. It is mainly used as links that should POST, such as actions that change data in some way. It is not for use with normal forms.

Categories : Ruby On Rails

How to display growl message in left side of layout screen
Default css for .ui-growl class is : .ui-growl { position: fixed; right: 20px; top: 20px; width: 301px; } You can achieve growl on left by applying following css for .ui-growl class: .ui-growl { left: 20px; position: fixed; top: 20px; width: 301px; } would work.

Categories : JSF

JSF / Primefaces : How to show growl faces message when executing a method?
For this purpose, there a primefaces component called BlockUI which will wait for the ajax response to complete. Using this, you can show any image as overlay when the method is being executed and you can block the user to perform any operation in that duration. http://www.primefaces.org/showcase/ui/blockUI.jsf

Categories : JSF

why growl message not dispalying left side of screen using common layout
Anything outside <ui:composition> is ignored during building the view. In your commonLayout.xhtml master template you should add a new <ui:insert> inside <h:head>: <h:head> ... <ui:insert name="head" /> </h:head> Then define it inside the <ui:composition> of your template client: <ui:composition template="..."> <ui:define name="head"> <style>.ui-growl{ #{msg['msg']}: 20px; }</style> </ui:define> <ui:define name="content"> ... </ui:define> </ui:composition> (by the way #{msg['msg']} is absolutely not self-documenting; I'd myself also rather have used <html dir="#{direction}"> so that you can just use e.g. html[dir='rtl'] .ui.growl selector) See als

Categories : JSF

post create test for user count failing. Should be changed by 1, but was changed by 0
Your test involves creating a second user with FactoryGirl, but the creation of the second user is failing because the email is the same as the first and you have a uniqueness validation on that attribute. You can either not create the first user at all or you'll need to make the emails different (e.g. by passing in an email parameter to your FactoryGirl call or changing the Factory to make each email address unique).

Categories : Ruby On Rails

angular unit test - controller
controller = $controller("app.controllers.merchant.create", $scope: scope, $location: location "app.services.user": user "app.services.sector": sector keyboardManager: bind: -> ) The mistake was that I tested the create controller, but I wrote edit there :P

Categories : Unit Testing

Can't get angular controller test to pass
As mentioned in the comments I am using angular 1.1.5 (for the new ng-animate). To get my tests passing I needed to install the angular-mocks 1.1.5. bower install angular-mocks-unstable or update the bower.js (or components.js) file and run: bower install And update my karma.conf.js file files = [ JASMINE, JASMINE_ADAPTER, 'app/components/angular-unstable/angular.js', 'app/components/angular-mocks-unstable/angular-mocks.js', // need unstable here '.tmp/scripts/*.js', '.tmp/scripts/**/*.js', '.tmp/spec/**/*.js' ];

Categories : Angularjs

How to test for 401 redirect in e2e angular tests
401 is an http error, not a redirect. Most servers send a 302 (moved permanently) but sometimes the developers change things to send a 301 (moved temporarily). Additionally, you should also be testing the value of location.path() and not window.location.

Categories : Angularjs

Angular E2E Test: Getting "input" from "element"
Yeah, the E2E input() method is sort of a nuisance as it does a find based on the ng-model of a particular input.. So for situations like ng-repeat, it doesn't lend itself to any practical use. Good news is, you can get the functionality you want just using element(). element('my_element_here').val('Value I want to enter!') expect(element('my_element_here').val()).toEqual("Value I want to enter!") Basically, the element() call can be chained with any of these jQuery-esque methods: val, text, html, height, innerHeight, outerHeight, width, innerWidth, outerWidth, position, scrollLeft, scrollTop, offset. The E2E Test harness for Angular is... interesting. And in desperate need of some TLC. But it's actually pretty good at what it does, once you get over the awkwardness of it! (And assu

Categories : Angularjs



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.