What is unittesting and unittesting libraries like xUnit? I understood it's testing specific code, so what's the difference between this and just opening a new project and test this specific code?
I have been designing and developing code with TDD style for a long time. What disturbs me about TDD is writing tests for code that does not contain any business logic or interesting behaviour. I know TDD is a design activity more than testing but sometimes I feel it's useless to write tests in these scenarios.
For example I have a simple scenario…
I am relatively new to unittesting and have a query about what/how I should be testing a certain method. For the following (psudo-c#) method I have created (not a real-life example) what would you test for?
Initially, my thoughts would be to test the output with variations on the dictionary of form fields, e.g. valid, invalid, missing values.…
I need to write a unit test which validates the serialization of two attributes of an XML(size ~ 30 KB) file.
What is the best way to provide an input for this test?
Here are the options I have considered:
Add the file to the project and use a file reader
Pass the contents of the XML as a string
Create the XML through a program and pass it
…
Related question: How do I cache data that rarely changes?
I'm making an ASP.NET MVC4 application.
On every request the security details about the user will need to be checked with the area/controller/action that they are accessing to see if they are allowed to view it. The security information is stored in the database.
For example:
User…
I was watching Rob Connerys webcasts on the MVCStoreFront App, and I noticed he was unittesting even the most mundane things, things like:
public Decimal DiscountPrice
{
get
{
return this.Price - this.Discount;
}
}
Would have a test like:
[TestMethod]
public void Test_DiscountPrice
{
Product p = new Product();
…
Assuming I have a relatively complex web application, I am interested in testing performances of a new version using a traffic as realistic as possible.
Traffic is relatively complex (session-based, lots of internal logic which depends on incoming requests). The webapp depends on many servers (databases, frontends, etc...). I can think…
I think I am stuck in the paralysis of analysis. Please help!
I currently have a project that
Uses NHibernate on SQLite
Implements Repository and Unit of Work pattern: http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/10/nhibernate-and-the-unit-of-work-pattern.aspx
MVVM strategy in a WPF app
Unit of Work implementation…
I manage a rather large application (50k+ lines of code) by myself, and it manages some rather critical business actions. To describe the program simple, I would say it's a fancy UI with the ability to display and change data from the database, and it's managing around 1,000 rental units, and about 3k tenants and all the finances.
…
I previously asked this question under another name but deleted it because I didn't explain it very well.
Let's say I have a class which manages a file. Let's say that this class treats the file as having a specific file format, and contains methods to perform operations on this file:
class Foo {
std::wstring fileName_;…
Our team is willing to unit-test a new code written under a running project extending an existing huge Oracle system.
The system is written solely in PL/SQL, consists of thousands of tables, hundreds of stored procedures packages, mostly getting data from tables and/or inserting/updating other data.
Our extension is not an…
Hi there,
I just recently read about "Mocking objects" for unittesting and currently I'm having a difficulties implementing this approach in my application. Please let me explain my problem.
I have a User model class, which is dependent on 2 data sources (database and facebook web service). The controller class simply use…
When you have a simple method, like for example sum(int x, int y), it is easy to write unit tests. You can check that method will sum correctly two sample integers, for example 2 + 3 should return 5, then you will check the same for some "extraordinary" numbers, for example negative values and zero. Each of these should be…
Right now i'm on testing something in a database. It's a wordpress database. i have to write and delete and do other operation on it. As you know it, it has indexing mechanism that will always make every new post inherit the next highest possible ID.
Please consider that this database is a copying of used database. it has…
Hello everyone,
I work for a small dotcom which will soon be launching a reasonably-complicated Windows program. We have uncovered a number of "WTF?" type scenarios that have turned up as the program has been passed around to the various not-technical-types that we've been unable to replicate.
One of the biggest problems…
I am building out a number of Silverlight 4.0 libraries that are part of the same solution. I like to break them into separate projects and have a Unit Test project for each:
SolutionX
-LibraryProject1
---Class1.cs
---Class2.cs
-LibraryProject1.Test
---Tests1.cs
---Tests2.cs
-LibraryProject2
---Class1.cs
---Class2.cs…
Does anyone know what unittesting tools are available when developing Tibco processes?
In the next few months I'll be working on a Tibco project and I'm trying to find any existing unittesting frameworks that might make the job easier to build with a TDD approach.
Thus far, the only one I've been able to locate is…
Before i can understand unittesting, i have to see real world examples. Every book, blog, article, or answer i've seen gives hypothetical examples that don't apply to the/my real world.
i really don't want to flood StackOverflow with hundreds of questions all titled "How do i unit-test this?" There must be another…
Hey guys, I'm pretty new to UnitTesting so bare with me.
I realize that best best practice is not to auto generate unit tests, however I'd like to use Code Generation to set-up the basic skeleton of the tests.
Now, I know Visual Studio 2008 already has the built in "create tests", however, it just creates a flat…
I am writing some unit tests in Visual Studio 2010. I can run all tests by using "Run all Tests in Current Context".
However, if I write a new unit test, it does not get picked up by the environment - in other words, I am not able to find it in Test List Editor, by running all tests, or anywhere else. If I unload…
hey folks,
I'm currently using Stephen Walther's approach to unittesting Linq to SQL and the datacontext (http://stephenwalther.com/blog/archive/2008/08/17/asp-net-mvc-tip-33-unit-test-linq-to-sql.aspx) which is working a treat for all things linq.
My Dal layer takes in an IDataContext, I use DI (via Unity) to…
R is a statistics programming language. Part of R is the use of Packages, which themselves are written in the R language. Programming best practice includes the use of unit-testing to test the functions within these packages while they are being written and when they are used.
I am aware of a few packages for…