So we have some unit tests written in groovy. We have the Groovy Eclipse plugin going, we have gmaven going, but the problem is that the maven eclipse plugin doesn't automatically add the src/test/groovy directory as a source directory. So, I enlisted the build-helper plugin to add a source directory, but then the problem becomes the sou...
I have a directory struture like that:
project
| __init__.py
| project.py
| src/
| __init__.py
| class_one.py
| class_two.py
| test/
| __init__.py
| test_class_one.py
Which project.py just instantiate ClassOne and run it.
My problem is in the tests, I don't know how to import src classes. I've tried importing the...
I must be missing something, i have VS2010 Premium.
Under Templates, Test Projects -> Test Documents, there is only 1 thing listed called 'Test Project' If i select his, it adds the Unit testing framework to the solution, but the project it adds is for VB.NET --- does c# not have this option?
thanks :-)
...
I've heard of unit testing, and written some tests myself just as tests but never used any testing frameworks. Now I'm writing a wxPython GUI for some in-house data analysis/visualisation libraries. I've read some of the obvious Google results, like http://wiki.wxpython.org/Unit%20Testing%20with%20wxPython and its link http://pywinauto.o...
I just started a new project, and now with ASP.NET MVC being designed in an extremely composable way, I figured it might be a good time to start with unit testing. Most of my code is fresh, and I'm writing the tests before I'm writing the actual production code.
My frustration, though, is that I spend a lot more time fixing mistakes in ...
Hello,
How do you create a unit test case in c for a buffer overflow that does not cause a memory error such as a segfault?
I.e. Given a simple buffer overflow, such as
int function () {
int exampleArray[10];
exampleArray[10] = 5;
return 0;
}
How do you create a unit test for this code? There is clearly an error, we are ...
The other Attributes (aka. TestMethod, ExpectedException, etc.) i know where and when to use, but i don´t know what i can do with the TestProperty-Attribute.
Why should i use it and when? Whats the reason for this attribute?
I found no useful documentation on the Internet, that explains the TestProperty-Attribute. And intellisense doe...
I'd like to know if there are some unit testing frameworks which are capable of writing multi-threaded tests easily?
I would imagine something like:
invoke a special test method by n threads at the same time for m times. After all test threads finished, an assertion method where some constraints should be validated would be invoked.
My...
Hi all,
I have 2 test classes, both annotated with the unitils annotation
@DataSet("/dbunit-dataset.xml")
The target database is an HSQLDB, which is initiated in an abstract superclass method annotated with the testng annotation:
@BeforeClass
When the testrunner (Maven Surefire) arrives at the 2nd test, the database is correctly i...
Let's say I've got two classes, each fully tested. There's duplication though, so I refactor the common code into a new class. Should I unit test that new class? If so, how?
Here's the options I can see:
don't unit test the new class (it's already fully tested by the original tests)
copy+paste the original tests to the new test class
...
Suppose I need to add unit tests for the following class from legacy code (that has no unit test for now). It is just a simple map or dictionary.
function Map(...) { ... }
Map.prototype.put = function (key, value) {
// associate the value with the key in this map
}
Map.prototype.get = function (key) {
// return the value to whic...
I'm working on my first VS2008 unit test project and have run into problem. I'm using a wizard created test project and my unit test class (simplified) is -
namespace FileWrapperUnitTest
{
[TestClass]
public class UnitTest1
{
public UnitTest1()
{
// initialization stuff
}
public TestContext TestContext { get; s...
I'm wondering what is the best way to test the accelerometer? There doesn't seem to be any simulation for movement on the emulator, and mocking seems like it would be difficult.
Should I just do a best guess and wait until the real devices come out or is there another approach to consider?
...
require 'rubygems'
require 'test/unit'
class Thing
attr_accessor :foo
def set_stuff
@foo = 'bar'
end
end
class ThingTest < Test::Unit::TestCase
def setup
@thing = Thing.new
end
def test_set_stuff
@thing.set_stuff
assert 'bar' == @thing.foo
end
def test_foo_in_other_test
puts @thing.foo
assert ...
Hi all:
I have the following method;
public class MyClass
{
public Repository UserRepository { get; set; }
public void CreateUser(Message someMsg)
{
if (someMsg.CanCreate)
{
var obj = new object();
UserRepository.Save(obj)
}
}
}
In my test case, I used Moq to mock out the Obj...
I'm fairly new to the unit testing world, and I just decided to add test coverage for my existing app this week.
This is a huge task, mostly because of the number of classes to test but also because writing tests is all new to me.
I've already written tests for a bunch of classes, but now I'm wondering if I'm doing it right.
When I'...
I am getting started on the Moq framework and absolutely love it. I am writing some controller tests that have several services and interfaces to Arrange my controller for the test. I'd love to modularize it a bit more, and thought this would be a trivial task, but it turns out to be a bit trickier than I thought.
Here is one simple un...
Hi everyone,
I have a Unit Test project with 20+ .cs files. I want to run some setup code before each individual test. Kinda like how the [TestInitialize] attribute works. However, I'd need to put that attribute on all 20+ of my .cs files.
Is there a way to centralize the initializing code in one place for every test in my entire pr...
Hi,
I am trying to test some model classes that I've written with SenTest in XCode. I have dragged the model header and implementation files into the Compile Sources group within my LogicTests target, and my tests pass. The problem though is that I'm getting a ton of compiler warnings about no rule to process file such as:
warning: n...
I have just started to learn ASP.NET MVC. When comparing ASP.NET MVC with Web Forms one of the main advantage of MVC is always told to be better support of Unit Testing. Can I got a good explanation of how it has better support?
Edit :
If possible please provide example in both.
...