FAQ Database Discussion Community


Expect fails for verifying inner HTML

jquery,selenium,testing,jasmine,protractor
For some reason my assert in protractor fails, what i'm trying to do is get the innerHTML (text) from an element: var stuff = $('css').html(); expect(stuff).toBe("Inner HTML Text here"); I verified that the $().html() yields the text i desire on the console, what is wrong with my expect statement? TypeError:...

Transferring large application to Android Wear through Android Studio

android,debugging,testing,android-wear,large-files
I am developing a large application for Android Wear through Android Studio (~200 MB). Trying to test the application on my LG G Watch R through "Debugging over Bluetooth" is taking a lot of time to send the large app to the Watch. Are there any alternatives / faster methods...

Count Sort Algorithm, Unable to sort Perfectally

c#,performance,algorithm,sorting,testing
I been trying to Implement Count Sort Algorithm. Every time I run the algorithm it gives me wrong answer at Index 0 and 1 It is been continuous 20 hours, and I am unable to track what I am doing wrong... Generated_Array 17 88 14 91 151 50 95 175...

setting up fake data in mongodb for testing

database,node.js,mongodb,testing,mongoose
We have a project in which we need to create a fake database and fake data for functional testing. Initially we started with a script that creates the entities using mongoose, initializes them and save them. var StudentA = new Student(); StudentA.name = "Bob"; StudentA.surname = "Marley"; StudentA.save(); As the...

Mock class inside REST controller with Mockito

java,testing,junit,spring-boot,mockito
I have a spring-boot application which exposes a REST interface via a controller. This is an example of my controller: @RestController public class Controller { @Autowired private Processor processor; @RequestMapping("/magic") public void handleRequest() { // process the POST request processor.process(); } } I am trying to write unit tests for...

Protractor: cleanup after test suite is finished

javascript,selenium,testing,protractor,end-to-end
In my "conf.js" test suites are arranged as follows(using saucelab's webdriver): suites: { abc: './abc/spec.js', xyz: './xyz/spec.js', pqr: './pqr/spec.js' }, The problem with above arrangement is if one of the alert box/window unexpectedly appears in one of the test suite,test suites after that particular suite suffer and start failing. Is...

How to log in/out users with Devise in Rails4 testing

ruby-on-rails,ruby,ruby-on-rails-4,testing,devise
I'm trying to ensure proper user access is maintained with Devise in Rails 4, and I'm having a hard time logging a user in in the test suite. The simplest case: require 'test_helper' include Devise::TestHelpers class SiteLayoutTest < ActionDispatch::IntegrationTest def setup @user = users(:test1) end test "logged in should get...

How do I check enable and disabled button using helium?

testing,automation,qa,helium
The code of attached button is: <div style="position: absolute; right: 0; top: 0;"> <button class="prev btn btn-warning disabled" style="padding: 4px 8px;"> <i class="fa fa-chevron-left" style="margin: 0"/> </button> <button class="next btn btn-warning" style="padding: 4px 8px;"> <i class="fa fa-chevron-right" style="margin: 0"/> </button> </div> How can I check that which one is...

Overriding TestNG Summary

java,testing
I do not want the default testNG summary (shown below) to show =============================================== Simple Reporter Suite Total tests run: 3, Failures: 1, Skips: 1 =============================================== is there any way that I can override that. (I know that I can implement my own report by implementing the IReport interface)...

How to use tests in Xcode (iOS application)

ios,objective-c,iphone,xcode,testing
In every new project I see the file with the content (and this file belongs to different target ProjectNameTests): - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown...

How to write JUnit tests with progressive state

java,testing,junit
I am new to JUnit and looking for advice. To start myself off I picked a simple helper object, that is used to manage a Table of Strings. The tests have a progression that argues against the granularity encouraged in the guides I've read. Trying to keep the granularity fine...

Protractor - Where to use browser.waitForAngular()

javascript,angularjs,testing,protractor,angularjs-e2e
I have some tests written using protractor for angular.js app. I am using Page Objects design pattern and there i have some methods that navigate to other pages by clicking on links and buttons. and soon after that i am calling browser.waitForAngular(). Page Object module.exports = function () { this.companyNameLink...

Ignore synchronization for $http, but not $timeout

javascript,angularjs,selenium,testing,protractor
Is there a way to ignore synching with the http request for a angular app? I have this form that should be disabled during the POST of the form. When this POST request is pending, the form should be disabled and this is what I would like to write specs...

How to verify `onclick` event in javascript for an Anchor tag using selenium webdriver

html,testing,selenium-webdriver,automation
How to verify the onclick event asscoiated with the anchor tag in the html below: <div class="itp-sb-left" style="float:left; width:100%; border:solid 1px #cccccc; padding:2px 0 2px 5px;"> <a title="Submit to Facebook" target="_parent" onclick="window.open('https://www.facebook.com/sharer.php? s=100&p[title]=...

Protractor - How to get first or last CHILD value

angularjs,testing,protractor
I have some HTML which looks like this: <div class="label label-primary ng-scope" ng-if="vehicle.manufacturerCode"> <strong class="ng-binding">AUDI</strong> <small class="ng-binding">[00]</small> <span class="btn btn-flat" ng-click="axCarSearch.removeIdentification(1, $event)"> <span class="glyphicon glyphicon-remove-sign"></span> </span> </div> From this HTML i need to get values of first or last ng-binding. I can imagine I can get to vehicle.manufacturerCode with something...

rspec controller empty session

ruby-on-rails-3,testing,rspec,controller
app/controllers/new_controller.rb: class NewController < ApplicationController def enter_time session[:dr] = 'dr' if !params[:time].nil? then Time.zone = @franchise.time_zone inanhour = 1.hour.since(Time.zone.now) delivery_time = delivery_time_format(params[:time]) delivery_time = delivery_time.change(offset: (Time.zone.now.utc_offset / 3600).to_s) session[:target_time] = [delivery_time, inanhour].max.to_s end end end spec/controllers/new_controller_spec.rb: require 'spec_helper' describe NewController, :type => :controller do...

Is it possible to write a MATLAB script that can give command line input to a function?

matlab,testing,input
I am writing MATLAB code that will fit together with other MATLAB functions that I cannot modify. Some of these existing functions take input from the command line. Is there a way I can write a test script in MATLAB that can call these functions, and then provide the input...

undefined local variable or method `start_test_server_in_background' for #

testing,cucumber,calabash,calabash-ios
This has been asked before for .12.0 but I am now getting a similar error in .14.2 . Up until a few weeks ago I was running calabash.framework 11.4 because it worked, was stable, and it was under lock and key on our development server. We went through a recent...

Comparasion of Integer.equals() and Objects.equals()

java,testing,equals
Here are my test for two equals methods: Random generator = new Random(); long startTime = System.nanoTime(); for(int i = 0; i<1000; i++) { Integer int11 = generator.nextInt(1000); Integer int22 = generator.nextInt(1000); int11.equals(int22); } long endTime = System.nanoTime(); long duration = (endTime - startTime); System.out.println(duration + " ns"); Random generator1...

Protractor synchrozation - timeout

javascript,angularjs,testing,protractor,end-to-end
I am writing simple protractor test four our application: login page is without angularhs - working fine all other pages are with angularjs When i want to write angularhs test - i got this error (following this installation) : Timed out waiting for Protractor to synchronize with the page after...

Does a Fuzz Testing Tool use the TCP/IP Stack of the Operating System?

testing,fuzzing,fuzz-testing
Fuzz testing tools generate malformed packets of protocols. Do they use their own TCP/IP stack to generate these malformed packets? Does the operating system's TCP/IP stack play any role in Fuzz testing? I am working on a MPLS Fuzz testing tool running on Windows 7 OS. The tool is testing...

Why do i need a constructor in an abstract class?

java,testing,junit,junit4
I'm currently working my way through a java tutorial, where i am being introduced to abstract classes and testing with J-Unit. I have 2 files, AthleteTest & BikerTest, with BikerTest extending AthleteTest.AthleteTest contains the common methods and variables of my different tests, while BikerTest contains the specifics. ATHLETETEST import static...

How to make grunt run some tasks at a special point in time?

javascript,node.js,testing,gruntjs,automated-tests
I am using Grunt to run Jasmine tests and Nightwatch.js tests. Is it possible to make Grunt run the tests at a special point in time? For example Grunt could run the tests always when saving changed code. Or Grunt could run the tests always at 1 am in the...

NPE when calling MockitoAnnotations.initMocks() in AndroidTestCase

java,android,testing,gradle,mockito
Trying to use mockito in my AndroidTestCase. I added the dependencies to the build.gradle: final DEXMAKER_VERSION = '1.2' dependencies { ... androidTestCompile "com.google.dexmaker:dexmaker:${DEXMAKER_VERSION}" androidTestCompile "com.google.dexmaker:dexmaker-mockito:${DEXMAKER_VERSION}" androidTestCompile 'org.mockito:mockito-core:1.10.19' } The TestCase with the mockito initialization: public class UsersListPresenterTest extends AndroidTestCase { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } public void...

Javascript Regex: “Any word” pattern

javascript,regex,testing,jasmine,karma-jasmine
In a Jasmine test, I am trying to set this match to fit with expressions like: 'Request <any_word> for <any_word> - Open actions menu'. However, it's not being possible with this line, but Javascript doc says that \\w is the regex for any word: expect(item.getIconToolTip()).toMatch('Request \\w for \\w - Open...

Android Studio can not find AndroidJUnit4.class + tests fail

android,testing,android-studio
When I try to start a test like this: ./gradlew app:connectedCheck Then the grade output will be: deleteDir(/myapp/build/outputs/androidTest-results/connected) returned: true deleteDir(/myapp/build/outputs/code-coverage/connected) returned: true Starting 0 tests on Device - 4.4.2 Tests on Device - 4.4.2 failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException' com.android.builder.testing.ConnectedDevice > No tests found.[Device - 4.4.2] FAILED...

SQL Server procedure optimization testing pattern improvement

sql-server,testing,sql-server-2014
I've been doing some SQL Server procedures optimization lately and was looking for a testing pattern (time and result wise). I've came with this solution so far: SET NOCOUNT ON; ---------------------------------------------------------------------------------------------------------------- -- Procedures data and performance testing pattern ---------------------------------------------------------------------------------------------------------------- -- Prepare test queries (most likely will be taken from Logs.ProcedureTraceData...

How to select the nth html element in a table that has special class?

javascript,html,css,testing,nightwatch.js
I am using Nightwatch.js to test a website. On this website there is a table which looks like this: <tr> <td class="sorting_1">...</td> <td class="sorting_2">...</td> <td class="sorting_3">...</td> <td class="sorting_3">...</td> </tr> Now I want to check if this table contains the correct words. I found out that it is possible to select...

How to exclude generated code from coverage statistics

testing,go
I have thrift generated code in my project? How do I stop this from affecting my coverage stats? They're dismal.

How to test a meteor method that relies on Meteor.user()

testing,meteor,jasmine
I am trying to determine the best way to test my code and am running into complications from every direction I've tried. The basic code is this (though far more complex due to several layers of "triggers" that actually implement this): Client populates an object Client calls a meteor method...

Difference between Android Instrumentation test and Unit test in Android Studio?

android,unit-testing,testing,android-studio,integration-testing
As of Android Studio 1.1rc there's Unit testing support and I'm wondering what's the difference between Android Instrumentation Tests and Unit tests. As I understand it: Unit tests are useful for testing code which doesn't call the Android API, and the Android instrumentation tests are rather integration tests to test...

Ruby on Rails - Testing changes to Capistrano's deploy.rb

ruby-on-rails,testing,deployment
I'm trying to test some changes out on production without having to commit and push the changes because I only want to commit what actually works. The project I'm working on was created with Rails (3.0.2), and deploys with Capistrano (3.1). I've tried making changes in the root folder of...

Django testing wastes too much time on test database creating

python,django,testing,django-testing
We are try to cover tests on an old, big project which has more than 500 tables in database, and that waste too much time on database creating(more than 1 hour on my RMBP) and db migrations. We are using PostgreSQL as the Database, cause some GIS about service needs...

Where to put external files for testthat tests

r,testing,testthat
Suppose I have test like this: require(testthat) context("toy test") test_that("toy", { df = my.read.file("test.txt", header=TRUE) expect_true(myfunc(df) == 3.14) }) and this test relies on a external file test.txt, where should I put this file then?...

Rspec view test with url parameters

ruby-on-rails,unit-testing,testing,rspec,rspec-rails
I have a page dashboard.html.erb that may be redirected to from several different controllers/actions. When it receives the redirect, it also receives several url parameters. Controller code: class PlansController def some_action redirect_to dashboard_path(show: "default", cool_array: ["test", "test"]) end end class StaticpagesController def dashboard end end View code: <% if cool_array...

Multiple behaviours for single entity

testing,process,entity,vhdl
I wrote a VHDL Testbench which contains the following : Lots of signal declarations UUT instantiations / port maps A huge amount of one-line concurrent assignments Various small processes One main (big) process which actually stimulates the UUT. Everything is fine except the fact that I want to have two...

How can I get simulated react events to update the values of the ref in my component?

javascript,unit-testing,testing,reactjs,reactjs-testutils
So I have a react component that looks something like this: class SignInForm extends React.Component { constructor(props) { super(props); } onFormSubmit(event) { const username = React.findDOMNode(this.refs.username).value; const password = React.findDOMNode(this.refs.username).value; // very basic validation if (username && password.length > 6) { this.props.flux.signIn({ username, password }); } event.preventDefault(); } render() {...

Pick out certain lines from files

list,testing,tcl
I am writing a tcl script that reads from a file and displays certain lines from this file. I can read from the file n problem but I cant figure out how to pick out certain lines BEFORE filtering out what I don't need. I am reading the file to...

Unable to trace an element by attribute or text

java,testing,selenium-webdriver,webdriver
I am having trouble with clicking at an element of a menu which is written like this: <div class="menu"> <ul class="tabs ctrlTabsProfile"> <li class="active" data-tab="tabDetail">User Details</li> <li data-tab="tabEmail">Email</li> <li data-tab="tabPass">Change password</li> <li data-tab="tabAdress">Account Details</li> </ul> </div> I have tried these: driver.findElement(By.linkText("Account Details")).click();...

Visual Studio 2012 - Fill message test result

c#,asp.net,unit-testing,visual-studio-2012,testing
When a test end its running i have a list like this Result1 Name: 01- AutoGenerateRequest (requestgenerationtest) Result1 Outcome: Passed Result1 Duration: 0:00:26,2924949 Result1 Message: Result1 StackTrace: how can i write something in the result message or stacktrace?...

Load additional CONFIG file with values

javascript,selenium,testing,protractor,end-to-end
I am using lot's of values for my test like username and password. For this purpose I created a config file where I store just this data in JSON, it looks like: { "login": "test", "password": "pass", "number": "1234", } It works for me if I request it at start...

Not able to click ExtJS Dropdown button and select list elements - Selenium Webdriver Java

java,selenium,testing,extjs,selenium-webdriver
I am having difficulty in clicking a drop down and selecting option from the list. Below screenshot of the application. Our application uses heavy ExtJS and below is the HTML code for dropdown button and textbox. <div id="combobox-1115-bodyEl" class="x-form-item-body x-form-trigger-wrap-focus" role="presentation" style="width: 325px;"> <div id="ext-gen1273" class="x-hide-display x-form-data-hidden" role="presentation"></div> <input id="ext-gen1272"...

how to spy on linux binaries for testing of shell scripts

linux,bash,shell,testing,spy
sorry if this is a duplicate, i had no idea what to search for... my use case is more complex, but can be narrowed down to the following problem: i want to run a bash script, which invokes all sorts of binaries, for example: grep. i want to assert that...

rails controller test failing non-deterministicly wrt state leak (I think)

ruby-on-rails,testing,controller,strong-parameters
I have a standard rest controller (with load_and_authorize_resource) for which I have the following strong params allowed: def subscription_params params.require(:subscription).permit(:email,:confirmed) end update action: def update respond_to do |format| if @subscription.update(subscription_params) format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' } format.json { render :show, status: :ok, location: @subscription } else...

Django Test Case Can't run method

python,django,testing
I am just getting started with Django, so this may be something stupid, but I am not even sure what to google at this point. I have a method that looks like this: def get_user(self,user): return Utilities.get_userprofile(user) The method looks like this: @staticmethod def get_userprofile(user): return UserProfile.objects.filter(user_auth__username=user)[0] When I include...

How to test Dart Polymer elements using the new Test library?

unit-testing,testing,dart,dart-polymer
How do you test Polymer elements using the new test library? Using the new test library to test a Dart Polymer element, I build my_element_test.html as prescribed. Please see my repo: polymer-dart-testing. No Polymer Initiation Passes my_element_test.html and my_element_test.dart (commenting out Polymer initiation) passes tests as expected: my_element_test.html <!doctype html>...

How can performed method setUp only once in tests

java,testing,junit,integration-testing
I have test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TestRepositoryConfig.class}) @Transactional public class ServiceTest { @Autowired private UserRepository userRepository; @Autowired private Service service; static { initTestUser(); } public void setUp() { userRepository.seve(testUser); } public void test1() { ... } public void test2() { ... } I need first start method setUp, saving testUser,...

Test if an object conforms to an interface in TypeScript

testing,typescript
If I have a plain-old JavaScript object and a TypeScript interface, how can I write a test that asserts object conforming to my interface? interface Person { name: string age?: number } describe('Person interface check', () => { it ('should conform to "Person" interface', () => { let obj1 =...

How does one test net.Conn in unit tests in Golang?

unit-testing,testing,tcp,go
I'm currently looking into creating some unit tests for net.Conn interface in Go, as well as other functions that build up on top of that functionality, and I'm wondering what is the best way to unit test that in Google Go? My code looks like: conn, _:=net.Dial("tcp", "127.0.0.1:8080") ... fmt.Fprintf(conn,...

Python Django REST API test

python,django,testing,django-rest-framework
As my first attempt in python to create a API test, my test file currently looks like this: from django.test import TestCase, RequestFactory from customer.models import Customer, CustomerStatus from customer.views import CustomerPartialView from rest_framework.test import APIRequestFactory import pprint from django.utils import timezone class CustomerTest(TestCase) : def setUp(self) : self.factory =...

testing - How to approach integration tests that create new data

testing,junit,automated-tests,integration-testing
Say I have a test that asserts whether registration of a new user in the system actually succeeds: RegistrationIntegrationTest#testRegister() Now, this creates a new test user in the actual database, since I want this test to run on the actual environment. This means that the test must not be run...

How to stub Time.now.hour

ruby-on-rails,testing,time,rspec,stubbing
I have a helper method which outputs a greeting #{greet(Time.now.hour)} in the view pending the time of day: users_helper.rb: def greet(hour_of_clock) if hour_of_clock >= 1 && hour_of_clock <= 11 "Morning" elsif hour_of_clock >= 12 && hour_of_clock <= 16 "Afternoon" else "Evening" end end And I am trying to test this...

How to use EqualsVerifier in a Spock test

testing,junit,spock,equalsverifier
I have been writing my tests using spock. But to test Equals Hashcode contracts, I am trying to use EqualsVerifier. So my test code looks like: def "test equals hashcode contract"() { EqualsVerifier.forClass(Content.class).verify(); } But this does not look like its running with spock. How can I workaround this? I...

Can anyone tell me how to test my Camel Route if I have a choice operation?

java,unit-testing,testing,apache-camel
I have a Camel route that has implemented a Content based Routing EIP(Choice operation). I need to test it. I'm new to Camel. So, I'm unsure how to do it. Can anyone tell me how to test this operation. I have mentioned a sample code below that has to be...

Upload file - Protractor

javascript,selenium,testing,protractor,end-to-end
I fight with protractor because for some tests I need to UPLOAD file. My HTML looks like: <div class="panel-footer"> <ul class="list-unstyled"> <!-- ngRepeat: file in imagesToUpload --> </ul> <button class="btn btn-sm btn-success pull-right ng-binding ng-hide" ng-show="imagesToUpload.length" ng-click="uploadImages()">Nahrát na server</button> <button class="btn btn-sm btn-primary ng-binding" ng-file-select="onImageSelect($files)" data-multiple="true" style="overflow: hidden;">Vybrat soubory<input...

running same test with different dataprovider in testng

java,testing,automation,testng,testng-dataprovider
For example: Data provider 1: dataA Data provider 2: dataB, dataC Data provider 3: dataD, dataE, dataG So my test takes in a data provider. But I want it to chose different data provider for different test type depending on test group. For example if I am running group "smoke"...

Appium: isDisplayed() vs findElements(by).size

java,iphone,testing,automation,appium
Traditionally I always checked for the presence of objects in appium using: int count = driver.findElements(by).size(); if (count == 0) { Logger.LogMessage("ElementDoesNotExist: " + by, Priority.Medium); return true; } else { Logger.LogMessage("ElementDoesExist: " + by, Priority.Medium); return false; } However, I see there is now a isDisplayed() method: driver.findElement(by).isDisplayed() Anyone...

Rails testing error: argument of WHERE must be type boolean, not type integer

ruby-on-rails,testing
Users can vote for Posts through a has_many association. I'm getting this error from running tests: ActiveRecord::StatementInvalid: PG::DatatypeMismatch: ERROR: argument of WHERE must be type boolean, not type integer From this test: test "should unvote a post the standard way" do @user.vote(@post_2) postvoterelationship = @user.active_post_vote_relationships.find_by(voted_id: @post_2.id) assert_difference [email protected]', -1 do...

How do I trigger a subscription error to test recovery on exchange web service

c#,testing,ews,exchangewebservices
My application uses the EWS API with a Streaming Subscription and everything is working fine and thats a problem for me as i havn't been able to exercise my recovery code for the OnSubscriptionError event. Here is the code i use to subscribe for streaming notifications private void SetStreamingNotifications(List<FolderId> folder_ids)...

How do I log into a web service that was auto-generated by Azure Mobile Web Services?

c#,testing,azure-mobile-services,visual-studio-2015
Microsoft's Azure Mobile Web Services lets you download a .NET or JavaScript Service and a client that talks to the Service. These are written in C#, or JavaScript. I chose to get one in C#. There is are several parts in the generated solution A Windows 8.1 desktop client (yourname.Windows)...

Can't get the value in an input with protractor

javascript,angularjs,selenium,testing,protractor
I'm using angularJS to develop an application. To test it I use protractor. I want to check the value in an input area. This is my input: <input id="rank-max-range" class="form-control has-feedback" name="inputMax" type="number" placeholder="Maximum" ng-model="selectedItem.range.max" min="{{selectedItem.range.min}}" max="{{selectedItem.answers.length}}"> And this is the test: it('should be fill the max range with the...

cmocka free operation and catching exceptions

c,unit-testing,testing,cmocka
I started my adventure with cmocka library, and I have two questions. Is it possible to find out if free() operation was made correctly? I mean, I would like to test function which is cleaning up tree structure. I've read about test_free(), but honestly I don't understand idea behind that....

How does Robot's Telnet library work?

python,testing,robotframework
I've been taking a look at Robot's Telnet library(https://github.com/robotframework/robotframework/blob/master/src/robot/libraries/Telnet.py) and I haven't found an answer in the documentation to this question. I get that The Telnet object handles opening and closing of TelnetConnections, and stores the current connection. But when something like write is called, how does Robot know to...

Testing Flask web app with unittest POST Error 500

python,testing,flask,python-unittest
This is my test.py file: import unittest, views, json class FlaskTestCase(unittest.TestCase): def setUp(self): self.app = views.app.test_client() def test_index(self): rv = self.app.get('/') assert 'Hamptons Bank' in rv.data def test_credit(self): response = self.app.post('/credit', data=json.dumps({ 'amount': '20', 'account': '1' }), content_type='application/json') print response.data assert 'Deposit of 20 to account 1' in response.data if...

Penetration testing for PHP security vulnerabilities

php,security,testing,penetration-testing
I am doing a undergrad research paper on "Identifying and Testing security vulnerabilities in websites". Initially I thought I would test manually as I had specified in my methodology that I would only test for few chosen vulnerabilities i.e. SQL injection, Cross site scripting, error reporting, session hijacking and input...

How to run mtouch command to launch Xamarin.iOS app on simulator for automated testing?

testing,xamarin,monotouch
I am new to Xamarin and I need to be able to launch a Xamarin iOS app on iOS simulator from command line. I have tried running mtouch but obviously am missing on something as I am not able to successfully launch the app on simulator. I don't know if...

About the android robotium release

android,testing,robotium
I have already finish most of the code of the robotium testing which is running on the android studio. I am just wondering which is the most effective way to make a release? To make a jar(how to do that)? Or make a interface? Because the QA team do not...

'ProgrammingError' on django test case

django,unit-testing,testing,bdd,django-1.6
I wrote a test case for an image api, but I got this error AttributeError: 'ProgrammingError' object has no attribute '__traceback__' I create an image, I go to the api url, then I test if the image is there, all is good but when I try to delete this image...

Play 2.3.x: Multiproject, disable BoneCP

scala,testing,playframework,playframework-2.3,specs2
I've got a Play project with some subprojects. One of the subproject needs JDBC, so BoneCP (it accessed MySQL DB). On the other hand, the root project doesn't need JDBC at all. My problem is: JDBC is declared in the build.sbt of the subproject. When I run all the tests,...

How to test use of DI (NInject)

.net,testing,dependency-injection,ninject
I have an ASP.NET MVC app that has a NInject container for dependency injection. As advertised, IoC makes it pretty easy for me to test components in isolation, and then easy to compose components in the application. I want to test my use of the DI. I don't want to...

testing non returning method in go

testing,go
I have a simple method, which just checks if a parameter is empty and then calls one of 2 methods based on a struct field. How would I test it? func (cT *customType) someMethod(message string) { if message == ""{ return } if cT.value == nil { cT.doFunctionOne() } else...

Authlogic: Functional Test Failing Validation

ruby-on-rails,ruby,testing,functional-testing,authlogic
I'm hoping someone can help me out. I'm in the process of building the standard blog application as part of learning Rails and have elected to include Authlogic for authentication/authorisation. For some reason - and I can't for the life of me figure it out - the following functional test...

How to inspect code behind Swing GUI

java,swing,testing
I once had java app/plugin which allowed me to view the code behind any given Swing application panel. So while a Swing app is running right click on a section of the app and view the code for that section. What is the name of this plugin ? Searches :...

Gradle configuring TestNG and JUnit reports dirs

testing,junit,gradle
I am relatively new to gradle and we use both JUnit and testNG unit tests in our project. With google help I figured out how to make both testNG and JUnit tests running. Below is how I ended up by achieving it build.gradle .... task testNG(type: Test) { useTestNG {}...

Element is not clickable at point - Protractor

javascript,testing,protractor,end-to-end
I'm getting an error that element I am trying to click on is not click able which I belieave is not true. My error looks: 1) Open VehiclePage and populate data Populate vehicle data Message: UnknownError: unknown error: Element is not clickable at point (1315, 371). Other element would receive...

CMake and CTest: automatically run test's dependencies

c++,c,testing,cmake,ctest
In my CMakeLists.txt I have something like this: set_property(TEST testX APPEND PROPERTY DEPENDS testY) set_property(TEST testX APPEND PROPERTY DEPENDS testZ) And I want some way to run testX and all its dependencies automatically. Something like: ctest <options> testX and as a result, CTest will run textY, testZ and testX. Is...

nose reports cumulative coverage

python,unit-testing,testing,nose
Image a situation where you have a BASE_CLASS. Several class inherits from that class: CHILD_A, CHILD_B, CHILD_C. Now let us write unit tests, but ONLY for CHILD_A, CHILD_B, CHILD_C. I would suspect, that the coverage for BASE_CLASS is 0%. Unfortunately, nose takes cumulative coverage, which is not what I want....

how to autowire in spring for test classes?

spring,testing
I am making some test for my classes in spring. I am making the mockups and all, but I want to include certain services, I was wondering if there is any annotation to make this @autowire for test cases. I checked for the @contextConfiguration but I dont know if is...

UISpec4J tests in Eclipse are not found

java,eclipse,user-interface,testing,uispec4j
I am trying to run tests using the UISpec4J library, but Eclipse says it can not find them. I have tried restarting Eclipse, cleaning the project, etc. The class gives no errors and I have followed the examples given on the website. package com.health.gui; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test;...

Config.properties returns value only when called twice

java,testing,junit
I have a program that I'm running tests for, and I have a particular method that attempts to access a config.properties file value. It returns null the first time I call it, and only returns a value after the second time it's called and I can't figure out why. Here...

Testing template based class with const template parameter which has to be varied

c++,templates,testing,const,const-cast
I am developing a template based library to support fixed point integers and I came up with this class and now I have to test it for various values of INT_BITS and FRAC_BITS. but since they are const (and they have to be so for a reason), I am unable...

Get attribute from table - Protractor

javascript,testing,protractor,end-to-end
Hey guys I have a table with multiple TR row, i need to be able to click on or any child <td> where VALUE is 91, In this example below there are just 2 values, but in a futurue there can be a 20 of them, and they can be...

Jhipster - JpaRepository “principal.username” @Query - org.springframework.expression.spel.SpelEvaluationException

testing,spring-security,jhipster
I have an error while I am testing my rest controller on a specific method. I am using the @Query annotation to do my database query. And it's using the "principal.username" to do it. I don't have the all picture on how principal.username is fetched and used in my application....

How to run a Perl Dancer Test

perl,testing,dancer
Reading through the Dancer::Test documentation made it seem straightforward to do a test, but I'm missing something. If I have the following Dancer application (WebApp.pm): package WebApp; use Dancer; # declare routes/actions get '/' => sub { "Hello World"; }; dance; and then the following testing file 001_base.t: use strict;...

How to get notified when unfiltered Netty server actually gets shutdown?

scala,testing,netty,unfiltered
I have an Unfiltered Netty server that I need to shutdown and restart after every test. val mockService = unfiltered.netty.Server.http(mockServicePort).handler(mockServicePlan) before { proxyServer.start() } after { proxyServer.stop() } Currently, this is not working, and I am fairly certain that is because the stop() function is non-blocking and so the following...

Send existing LCOV file to SonarQube

javascript,testing,sonarqube,code-coverage
Because of the way my project is built, I can't use SonarQube to run coverage on my project. I have my JavaScript coverage all working with Karma and other tools. These tools output a valid LCOV file. Everything else I've found requires you to have SonarQube run the coverage and...

Testing for asynchronous results without sleep in Go

unit-testing,testing,go
I have quite a few components in my code that have persistent go-routines that listen for events to trigger actions. Most of the time, there is no reason (outside of testing) for them to send back a notification when they have completed that action. However, my unittests are using sleep...

how to return object from protractor

javascript,angularjs,selenium,testing,protractor
I have written following code to return text from the table. Now, I want that thing in here: dnassgn is page name, but after calling that function the return value is coming as blank. Please suggest me where I am wrong. fetch_text_from_cell_in_table: function(col_val){ var name_var=""; var km = 0; var...

Visual Studio 2012 Ordered Test, how to monitor test execution

c#,visual-studio-2012,testing,ordered-test
I have an ordered test that have some tests that run properly. My problem is that during the test execution I can't see which test is running. How can I monitor the execution of the ordered tests?...

python cross platform testing: mocking os.name

python,testing,mocking,nose
what is the correct way to mock os.name? I am trying to unittest some cross-platform code that uses os.name to build platform-appropriate strings. I am running on a Windows machine but want to test code that can run on either posix or windows. I've tried: production_code.py from os import name...

How to get the value from selectbox?

javascript,selenium,testing,protractor,end-to-end
I am trying to verify that correct option is selected from selectbox using protractor. This is how I pick value from selectbox: element(by.id('form-mileage-unit')).click().then(function() { element(by.cssContainingText('option', browser.params.lengthUnit)).click(); });; So base on this I write code below: it('Verify paint color', function() { element(by.id('form-mileage-unit')).click().then(function() { element(by.cssContainingText('option', browser.params.lengthUnit).getAttribute("value")).toEqual(browser.params.lengthUnit); });; });...

Selenium when to use By id/name/class/spath/css, and page object

java,selenium,testing
I start to work with selenium webdriver v2, I have a few questions: When to use By.id,By.name,By.className, By.cssSelector, By.xpath...? Is it OK to combine all the By functions in the same test project? When to use page object? Is it recommended to use for dynamic site? ...

Browser.wait() until .getAttribute() returns true

javascript,angularjs,selenium,testing,protractor
I'm still learning Protractor so I'm not sure if this is a simple answer that I'm not getting but I'm just trying to have the browser wait until the attribute I'm retrieving is true. I'm testing the pizza option for this site. Complete code: browser.get('https://material.angularjs.org/latest/#/demo/material.components.select'); var topping = element(by.model('topping')); topping.click();...

Grails Test Domain Model - Mocks

unit-testing,grails,testing
I am trying to test some methods within a Domain object, the code seems to execute (based on log) but the assertions fail. The code being tested (extendDates), is working, I am just adding the unit tests now. I assume I am doing something wrong in the mocking.The following is...

Dynamic expectations in Rspec

ruby-on-rails,ruby,testing,rspec,tdd
I am trying to test a dynamic url path through an Rspec expectation, as below: describe 'registering a user' do context 'with valid data' do it 'confirms user registration' do visit '/users/new' fill_in 'Name here...', with: 'johnny bloggs' fill_in 'Your email here...', with: [email protected]' click_button 'Notify me' expect(current_path).to eq [email protected]'...

Angularjs: Testing controller function, which changes $scope

angularjs,testing,jasmine
I'm trying to test this controller function: $scope.deleteAccount = function(account) { Account.deleteAccount(account._id) .then(function() { angular.forEach($scope.accounts, function(a, i) { if (a === account) { $scope.accounts.splice(i, 1); } }); }) .catch(function(err) { $scope.errors.other = err.message; }); }; It is on a admin page. The function calls the factory (with promise) and the...

database restore for integration tests with phpunit

php,testing,phpunit,integration-testing
I'm using phpunit and I'd like to know if there is a correct form for restoring the database before running integration tests. At the moment I'm calling an sql server script with php exec() on the testcase setUp method, but don't know if this is the best choice class...

How to read a text from a page using Helium?

java,testing,automation,qa,helium
I want to read the text showing in the picture and want to print that text using Helium. I tried the following code import org.openqa.selenium.WebDriver; //import com.heliumhq.selenium_wrappers.WebDriverWrapper; import static com.heliumhq.API.*; public class MainClass { public static void main(String[] args) { WebDriver ff = startFirefox("http://172.16.0.200:8001/"); waitUntil(Text("Streams Tech, Inc.").exists); streamstech lg...

How to use Jasmine and CucumberJS with Protractor

angularjs,testing,jasmine,cucumber,protractor
I'm looking to use Protractor, CucumberJS, and Jasmine for testing my project. How do I use both Jasmine and CucumberJS with Protractor? Here's the project setup I've created: /path/to/myproj/protractor.conf.js exports.config = { seleniumServerJar: 'node_modules/protractor/selenium/selenium-server-standalone-2.45.0.jar', specs: [ 'features/*.feature' ], baseUrl: 'http://localhost:8080', multiCapabilities: [ { 'browserName': 'chrome' } ], allScriptsTimeout: 380000, getPageTimeout:...

Protractor map function returning undefined

javascript,selenium,testing,selenium-webdriver,protractor
Given an app with multiple widgets on it, each with their own title and whatnot, I would like to map each widget's elements, to make them easy to handle in tests. For example, a page: this.widgets = element.all(by.css('ul.widget-grid')).map(function(widget, index) { return { index: index, title: widget.element(by.css('div.title')).getText() }; }); And then...