Tagged Questions
Unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine if they are fit for use.
0
votes
0answers
4 views
Carrying out unit testing in python on a method that implements ImageDraw
I am currently experimenting with the pytest module to create unit tests for a project I'm working on. I'm trying to test the 'add_point' method which draws an ellipse based on a set of pixels. What I ...
0
votes
0answers
6 views
SFML C++ Unit test in visual studio
I am trying to write unit tests for my project using the built in visual studio system. I have created a new test solution and added my projects solution as an include. Since my project uses SFML it ...
0
votes
0answers
6 views
MSTest ignores test classes with non-test generic methods that have type constraints defined in a different assembly in .NET 4.5.1
I've been puzzling over this one for the past hour or so. I have an app and a set of unit tests that target Windows 8.1 / WinRT / .NET 4.5.1. All projects and the solution compile and link ...
0
votes
0answers
3 views
Changing unit test package name with corresponding production code package in Eclipse
I have a package structure containing Unit Tests that corresponds the production code. When I do the refactoring, I often move classes to different packages. In that case I also have to manually move ...
0
votes
0answers
7 views
Injecting test module with dagger2
I use Dagger2 in my android app.
Basically I inject a HttpClient (interface) in MainActivity.
@Module
public class MainActivityModule{
@Provides public HttpClient providesHttpComponent(){
...
0
votes
0answers
13 views
How do I start an automated test (Codedui) externally?
CodedUI tests use the UnitTest Adapter of the QualityTools namespace as shown in this stack trace upon entry of a test using TestExplorer (debug test selection).
...
0
votes
0answers
5 views
Get current controller instance in UI-Router? (in tests)
I setup a test for a route based on this answer. I now want to check if things injected to the route's controller are setup correctly. From the state object, I can only get the controller's ...
0
votes
2answers
14 views
Is it possible to patch a class instance with an existing Singleton instance?
I have a class representing our DB layer which is being instantiated internally in some classes (I cannot pass it as an outside parameter)
For example:
class MyClass(object):
def __init__(self):
...
-5
votes
0answers
28 views
Key press simulation in unit testing
I wrote below code to press three tab keys after that press enter key using robot.
But it doesn't work as expected.
public void test_11() throws InterruptedException, AWTException {
Robot ...
1
vote
1answer
14 views
How to inject references in angularjs unit test
I saw two different ways of injecting references in unit tests.
Underscore Wrapping
beforeEach( inject( function(_myService_){
myService = _myService_;
}));
or
$injector injection
...
0
votes
1answer
9 views
call_user_func() expects parameter 1 to be a valid callback - Laravel unit testing
I am testing an API that returns a JOSN object, while running the following:
public function testBasicExample()
{
$response = $this->call('GET', ...
0
votes
1answer
14 views
How to check if a GET call is not made in $httpBackend
$httpBackend offers methods for check if an HTTP call is made:
$httpBackend.expectGET('/auth.py');
I'm testing a service that has an internal cache and I would like to check if it works correctly. ...
0
votes
0answers
27 views
Mocking EF with async and Include
I'm trying to mock Entity Framework. And my method which include Async and working with 2 tables of EF.
my method (MyClass.Create):
var my = new Application(title, "", ...
0
votes
2answers
20 views
Interfaces for Rich Domain Models
Should Rich Domain Models have interfaces to assist with isolation during unit testing (e.g. when testing a service that uses the model)?
Or should the Rich Domain Model behaviour be involved in any ...
0
votes
0answers
11 views
How to prevent Kohana to serve a page (Unit Testing different projects?)
I'm trying to unit test a Kohana application using SimpleTest and Phactory.
I have two separate directories, C:\xampp\htdocs\kohana (the application directory) and C:\xampp\htdocs\unit_tests\ (where I ...
0
votes
0answers
20 views
Mocking Instance Variable in Subclass
I have a class
public class C1 : A1<I1, I2<I1>, I3<Doc>, I4<I1>, C2>
A1 is defined as
public abstract class A1<TA, TB, TC, TD, TE> : A1<TA, TE>
The class it ...
0
votes
0answers
5 views
Test fails with ShimNotSupportedException
I have a very simple test that uses a shim but when I run the test I get a "ShimNotSupportedException". I am using VS2013 Ultimate and I am not debugging.
[TestMethod]
public void ...
0
votes
0answers
18 views
CakePHP can not find table for model with another dbconfig in tests
I have a chain:
MyControllerTest ->
testAction(...) ->
MyController ->
uses (Model1, Model2) ->
Model1->method(), Model2->method() ....
Model1 has a default dbConfig, but ...
1
vote
1answer
12 views
Automake AM_LDADD workaround
I want to set the same LDADD attribute (Unit test library) to a large number of targets (unit test C++ files). I first though that maybe automake has AM_LDADD variable to add that library to all the ...
1
vote
2answers
30 views
Automated tests for Expression translation
I am using PredicateBuilder to build reusable expressions as return values of objects. For example:
public interface ISurveyEligibilityCriteria
{
Expression<Func<Client, bool>> ...
0
votes
1answer
26 views
C++ fake/mock return value based on the value of parameter
Using Typemock Isolator++.
Is it possible that the returning value from a fake method is based on the value of parameter?
for example:
WHEN_CALLED(student->GradeOfCourse("a")).ReturnVal(70);
...
0
votes
1answer
7 views
Does ScalaMock support mocking of (companion) objects and constructors?
There are somewhat contradictory statements about the abilities of ScalaMock to mock (companion) objects and constructors. The page ScalaMock step-by-step states
it can also mock:
Classes
...
4
votes
0answers
27 views
Unit tests using Automake
I am working in a project with other people in the team using GNU autotools. In the project we are using unit test for each non trivial C++ class. I found out that there is support for unit testing. ...
0
votes
0answers
22 views
Caused by PDOException: SQLSTATE[42000] - php unit test in Laravel
I am new to laravel and php unit testing.
I am trying to run a very basic test in laravel and getting the error below while running phpunit through command line:
Caused by PDOException: ...
0
votes
0answers
16 views
Jasmine + AngularJS: How do i test a firebaseio call
I have an angular service class : -
'use strict';
angular.module('triggerTips')
.service('userData', function ($rootScope, $http, $log, $firebase) {
this._log = {
service : 'userData'
};
// ...
1
vote
1answer
22 views
How to test oracle packages with inner state?
Suppose we have an oracle package, which was initialized with some value grabbed from a table holding global parameters. Despite the fact that it is an ugly practice, it could work in production since ...
0
votes
0answers
17 views
Jasmine + AngularJS: How to add value in $rootScope using provide
I have an angular service class : -
'use strict';
angular.module('triggerTips')
.service('userData', function ($rootScope, $http, $log, $firebase) {
this._log = {
service : 'userData'
};
// ...
0
votes
0answers
13 views
Google test, how to use template in test code, to check types
I am trying to write a unit test case for the below function.
SQLSMALLINT type_conversion_fn(InputType xtype) {
switch (xtype) {
case XSQL_String:
return SQL_TINYINT;
...
0
votes
0answers
17 views
MVC Unit testing [Authorize(Roles=“Role”)]
So I have been googling this for a couple of hours and I am yet to find a working solution.
Here are a couple of questions I have found that paint the picture of what I've been doing but none give me ...
0
votes
1answer
12 views
Android Tests does not recognize my test method
I am trying to add some unit tests to my android app. Following is what I tried.
Created a directory for my tests and created a package for test classes inside it.
Created following test class in ...
1
vote
1answer
21 views
How can I avoid dynamically generated classes derived from metaclass not to end up as the same class?
What I'm trying to do is to perform hundred of unit tests to a function, which I can derive from a dictionary. Unfortunately I cannot use any of the existing packages for parametrized tests (like ...
0
votes
1answer
29 views
Mocking receiver functions in Go
I'm trying to unit test a receiver function that calls other receiver functions in that struct.
Let's say I want to test Three() and mock the call to two() in the following:
type MyStruct struct {
...
0
votes
1answer
6 views
$routeUpdate not broadcast in angular karma unit test?
app.js
'use strict';
angular
.module('scrCliApp', [
'ngRoute',
'ui.bootstrap'
])
.config(function ($routeProvider) {
$routeProvider
.when('/search', {
templateUrl: ...
1
vote
1answer
18 views
Unit Testing stable production application
it seems an absolute truth in development community that Unit Test is a must have, and you should add it whatever it costs (I know it is not 100% like that).
Let me play devil's advocate here.
...
0
votes
0answers
7 views
Google test not working on Xcode 6
I am following the wiki page and some posts, here are the instructions form What is the proper way to configure googletest with Xcode 4? I am using Xcode 6.
1. Follow the instructions located at ...
-1
votes
0answers
12 views
Codeigniter unit test tools
I want to find a suitable tool for unit testing on CodeIgniter framework. PHPUnit is recommended for PHP unit testing. However, bridging libraries such as CIUnit or codeigniter-phpunit are no longer ...
0
votes
1answer
22 views
How can I set Mockito `when` method when instantiating mock objects in Spring?
The method described in this answer best suits me for instantiating my mock objects.
<bean id="dao" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg ...
0
votes
1answer
13 views
Unable to deploy Windows phone 8.1 (Windows Runtime) app with a unit test project
I've built a Windows Phone 8.1 app (Windows Runtime) and I wanted to create some unit tests for my app.
I have added a Unit Test App to my solution, which actually added a unit test project. I am ...
0
votes
0answers
11 views
Sharing resources across unit tests and instrumentation tests in Android
Now that Google has added experimental unit test support, how might one go about sharing resources across both unit tests and instrumentation test?
For example, say I have a TestUtils.java class that ...
1
vote
2answers
21 views
Using python's mock to temporarily delete an object from a dict
I am writing a test for some code that checks for a value in os.environ (I know this isn't optimal, but I have to go with it). I would like to remove an entry from os.environ for the duration of the ...
0
votes
1answer
20 views
GooleTest for Client/Server Testing [on hold]
I've got a redis-server running and I connect to it using my customized client developed in C++ (using hiredis C interface). This client subscribes to a channel and waits for another client to publish ...
0
votes
0answers
10 views
How to run local c++ unit tests using google test in Xcode 6.1.1
I am new to google test and xcode. Please provide any help.
I download the google test, and I use xcode to open the googletest.xcodeproj in googletest. I build the project successfully.
I want to ...
0
votes
0answers
6 views
OSX File System Events - unit testing
I am working on unit tests for code that deals with the File System Events API. It creates a directory tree with random data in files and subdirectories, and then performs a few changes on these files ...
0
votes
1answer
27 views
Skipping unit tests or at least showing warnings from them
I need to test code that fetches and processes some data from standard C library. However, this data may not be installed at any particular system. So at the start of each test I detect whether the ...
0
votes
0answers
11 views
Solution for storing unit tests results to MySQL
Solution and your help is needed for following case:
I am trying to find a solution for storing unit test results to MySQL. The problem:
Tests use UNIX console driver and if the driver is not ...
1
vote
0answers
10 views
showing available product quanity in two different units in openerp / odoo
i am working on odoo to implement for a liquor trading firm. Actually clent uses two different units e.g., unit(s) and case. Case size may vary. for example 1 Case = 12 or 18 or 24. In odoo if the ...
0
votes
1answer
16 views
NUnit run fails the second time I open my just saved .nunit project
I'm going crazy with this NUnit GUI unexpected behaviour:
1) I run nunit-x86.exe, then I select File \ New Project \ name the .nunit project and Save , 2) select Project \ Add Assembly and select the ...
0
votes
0answers
21 views
Unit testing classes in a Website project - how do we reference the classes?
I'm writing unit tests for a Website project in Visual Studio. The unit test project needs to reference a few classes that are in the Website project's App_Code.
In order to reference the classes, I ...
0
votes
0answers
20 views
Unexpected Request Error with $HttpBackend (AngularJS)
I am using HttpBackend to mock some Http responses for some calls that my Angular app is making.
However, I am getting the error "Unexpected Request: [object Object] undefined" when I run my tests.
...
1
vote
0answers
21 views
Type to mock must be an interface or an abstract or non-sealed class
I'm using Moq to mock the following class in VB:
Public class Factory(Of T)
Inherits Factory
Public Overridable Shadows Readonly Property Model() as TModel
Get
..
End Get
End ...