i have two functions one that builds path to set of files and another that reads the files the function as below
def pass_file_name(self):
self.log_files= []
file_name = self.path+"\\access_"+self.appliacation+".log"
if os.path.isfile(file_name):
self.log_files.append(file_name)
for i in xrange(7):
fil...
I'm trying to think of a good way to clean up my controllers to make them more testable without having to rely on a constant database connection. I thought I had a decent start by abstracting away my object context with an IObjectContext. This works well for the context, but my next problem is that I have a generic repository that I use ...
I am writing a unit test for some thread locking logic, so as to make the test more likely to fail quickly; I wish to have all the threads switch between each other very often and at random times.
I know this will not prove we don’t have any bugs, but at least it should make the bugs show up more often.
Thanks to everyone saying "don...
I would like to add a unit test to test the style class gets set correctly. Unfortunately the getter getStyleClass requires a FacesContext. Any ideas?
...
Scenario:
I have a base controller which disables caching within the OnActionExecuting override.
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
filterContext.HttpContext.Response.Cache.SetValidUntilExpires(false)...
I am trying to run my units test and it is failing. Not much info is supplied by Visual Studio.
When I click on the "Test Run Error" link I get this screen.
This is spectacularly unhelpful. Does anyone know where I can get a call stack on what is really happening?
The solution builds just fine so I don't see how it can be "Invalid...
Hi,
I am trying to create a unit test framework using CPPUnit for a large code base. I need to be able to test individual modules, all of which are part of a module tree that begins with a specific root module.
Due to a non-technical reason, I cannot touch the production file (my original approach involved adding an ifdef to the root m...
I have this method which is dependent on current date. It checks if today is Sun, Mon, Tue or Wed, then it gives 5 days of lead time for arrival of shipped items. If its Thur, Fri or Sat then it gives 6 days of lead time to account for the weekend.
private DateTime GetEstimatedArrivalDate()
{
DateTime estimatedDate;
if (DateTi...
I have an abstract testcase "AbstractATest" for an interface "A". It has several test methods (@Test) and one abstract method:
protected abstract A unit();
which provides the unit under testing. No i have multiple implementations of "A", e.g. "DefaultA", "ConcurrentA", etc.
My problem:
The testcase is huge (~1500 loc) and it's growin...
I've got a unit test for a Seam component that should fail if a value isn't provided in the context before the backing bean is created. I've been able to test this manually but would like to cover this scenario with a unit test.
I'm basically getting a org.jboss.seam.InstantiationException caused by a java.lang.IllegalArgumentException ...
I'm wondering if the Maven surefire plugin either runs tests multi-threaded by default (and if so can the number of threads be controlled? ) or if it runs tests from the Test classes in a random order or predictable order, or if the order can dictated by some means.
I haven't verified this yet (I'll do so tomorrow just looking for som...
Suppose I have several unit tests in a test class ([TestClass] in VSUnit in my case). I'm trying to test just one thing in each test (doesn't mean just one Assert though). Imagine there's one test (e.g. Test_MethodA() ) that tests a method used in other tests as well. I do not want to put an assert on this method in other tests that use ...
I recently started using netbeans for python development and really like it. However, the test runner in netbeans does not run my doctests, nor does it run my test functions written using nose. I always have to switch to the shell and run 'setup.py test' or 'nosetests' manually. Is there a way to integrate this into netbenas 6.8?
...
I have an object that gets passed into a method as a parameter. This object has a event on it which should get subscribed to when I call this method with the object as the argument.
Does NUnit allow me to check this?
Edit: Added a code sample:
[Test]
public void AddingToCollectionShouldHookPropertyChangedEventUp()
{
...
Hi all,
I have a method that i want to mock that takes an array as a argument. In a real call, the method would modify this array and the resultant array would be use further along in code.
What i tried to do was pass in array to the mocked method call, that had values that would be valid when the array is used again. However what i fin...
We are getting the above error when we try and run our tests in debug mode.
We have a .net solution written in C#, which we have developed using Visual Studio 2008 on Windows XP.
We have now got new machines :). Windows 7 64 bit.
The solution has several wcf host and web services host, it also runs some windows workflows.
It appears ...
I am trying to run a simple test on a controller in MVC. This controller validates the input using xVal and DataAnnotations. When I run the test (using NUnit via Resharper, NUnit standalone or TestDriven.Net) it crashes the runner with no decent error message. In the event logs it just has a fairly generic .NET Runtime 2.0 Error Repor...
In MVVM it is normal to connect View to the ViewModel with data binding.
Therefore if the name of a properties changes on one of the Model objects that is databound to there is no compiler error.
When the compiler will not stop a bug, the next thing I think of is “UnitTest”, However
How do you unit test this without
spending for...
HI,
We are a small TDD team.
We have a LCD screen mounted on the wall which we would like to have display the status of our builds together with current code coverage.
Are there any tools that will provide this out ot the box?
If not is this pretty straight forward to develop on our own?
We are using TFS 2008.
Cheers!
...
I want to create a unit test for integration testing. What class should I inherit to be able to commit/rollback transactions? AbstractTransactionalSpringContextTests is deprecated. It's recommended to use AbstractJUnit38SpringContextTests instead, but I cannot find how to control transactions there.
...