In unit testing, the setup method is used to create the objects needed for testing.
In those setup methods, I like using assertions: I know what values I want to see in those
objects, and I like to document that knowledge via an assertion.
In a recent post on unit tests calling other unit tests here on stackoverflow, the general feelin...
Hi! I'm new to unit-testing and NUit in particular.
I'm just typing some examples from the book which refers to Java and JUnit. But I'm using C# instead.
The problem is: I've got a class with overriden methods such as Equals() and GetHashCode(), but when I am trying to compare two objects of this class with Assert.AreEqual() my code is ...
During testing, I'm stuck with testing a piece of code that receives a list of numbers and that's supposed to return a new random key that doesn't exist in the list.
The valid range is any number between 1 and 1,000,000 - which makes it too hard to brute-force in tests.
What's the best approach for testing this? I've considered testing...
I have two identical byte arrays in the following segment of code:
/// <summary>
///A test for Bytes
///</summary>
[TestMethod()]
public void BytesTest() {
byte[] bytes = Encoding.UTF8.GetBytes(Properties.Resources.ExpectedPacketData);
TransferEventArgs target = new TransferEventArgs(bytes);
...
Does anyone know why is it not possible to get the virtualpath when you are running the
asp.net mvc unit test project? Is it because it creates a Temp folders under TestResults Folder.??
...
During the process of building software applications, you would start testing what you have built in stages even before it is complete and you could start seeing issues/bugs. How do you track them, Do you use your regular bug tracking tool to add them as issues(waste of time - since it is a work in progress), just have them in your head ...
I'm currently debugging some fairly complex persistence code, and trying to increase test coverage whilst I'm at it.
Some of the bugs I'm finding against the production code require large, and very specific object graphs to reproduce.
While technically I could sit and write out buckets of instantiation code in my tests to reproduce the...
I am attempting add some tests to an existing QT GUI application using QTest. The GUI uses quite a bit of complicated start-up code so I'd rather not write another main() to start it again.
To me, it seems like the easiest way would be instantiate the app and then run the tests on it. I am just not sure, however what function I could p...
My strategy for threading issues in a Swing Java app is to divide methods in three types:
methods that should be accessed by the GUI thread. These methods should never block and may call swing methods. Not thread-safe.
methods that should be accessed by non-GUI threads. Basically this goes for all (potentially) blocking operations suc...
hi all
currently im writing a test for a report function
the more functionality the project gets the more
reports need to be written
in my case reports get a few 'search' paramters and limitations like
number of rows or such
now my question:
anyone knows how to generate test cases automatically for a function
which has a well known se...
I am just starting to do Test Driven Development, and I am wondering the major differences between RhinoMock, TypeMock, and NUnit's built-in mocking?
Any information would be greatly appreciated!
...
I'm working on a generic repository and I would like to test it using a NUnit.Mocks . According to Mike Hadlow in his article you can do it using Rhino mocks like this:
User[] users = new User[] { };
...
Expect.Call(userRepository.GetAll()).Return(users);
So I thought maybe I could write the same thing in NUnit.Mocks like this :
data...
I've been trying to understand how to start writing and running JUnit tests.
When I'm reading this article:
http://junit.sourceforge.net/doc/testinfected/testing.htm
I get the the middle of the page and they write, "JUnit comes with a graphical interface to run tests. Type the name of your test class in the field at the top of the win...
We're building a web app on top of the Amazon Web Services stack, and I'm loving it so far.
We're also making full use of test driven development and that is also proving to be fantastic.
I'm just hoping someone can help me out with an issue I've come across which relates to Amazon SimpleDB's "eventual consistency".
The best example o...
For example this article introduces them.
What is the benefit?
Static analysis seems cool but at the same time it would prevent the ability to pass null as a parameter in unit test. (if you followed the example in the article that is)
While on the topic of unit testing - given how things are now surely there is no point for code cont...
Hi
I am wondering how to you test TimeZone logic? For me my timezone stuff is used to filter data from the database(what of course in unit tests gets mocked up and not tested).
But I would like to test the logic around it to see if I give certain times in that it would be converted right.
I am not sure how to do this though.
...
Having searched StackOverflow, and Google I think what I'm doing is suppose to be right, however results don't seem to be going well
[TestMethod]
public void LoginAction_Should_Return_View_and_User_Authenticated()
{
// Arrange
var mock = new Mock<ControllerContext>();
var mockSession = new Mock<HttpSe...
Hi,
Disclaimer: This is my first time writing unit tests...be gentle! :)
I am trying to write a test for the following method and would like people's thoughts an whether I am thinking about this the correct way. I have an interface called IAuthenticationProvider with the following method:
bool Authenticate(string username, string pass...
I'm having a little annoying problem with resharper trying to run my unit tests, using mstest. I can select an individual unit test and run/debug it fine but when I select the parent node to run a bunch of tests, the tests don't run; it just displays pending for a few seconds and then the test goes grey. If I set breakpoints in the tests...
Hi!
I am trying to create a set of test case to cover my django application. I need pre defined database data, to run some of my test. So I decided to use fixtures.
What I did was:
1) created fixture file:
oleg$ python manage.py dumpdata goserver > fixture1.json
2) Placed the fixture in the directory where application lives
oleg...