Bug 4128 - Unit test and production result inconsistent
Summary: Unit test and production result inconsistent
Status: RESOLVED INVALID
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NUnit ()
Version: 2.8.6
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-03-28 12:39 UTC by Jeff
Modified: 2012-03-30 12:18 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Source file for the method I want to unit test (3.84 KB, text/plain)
2012-03-28 12:39 UTC, Jeff
Details
TestSelectScalar() is the method that fails (781 bytes, text/plain)
2012-03-28 12:42 UTC, Jeff
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Jeff 2012-03-28 12:39:10 UTC
Created attachment 1591 [details]
Source file for the method I want to unit test

I have a method a method I'd like to test with unit testing. The method takes a query string, submit the query string to a sub-process through Standard Input, and gets the result of the query through Standard Output.

The code from my application returns the correct result without any problem, but the unit test for the method returns an error from the sub-process. The query I use in my application and in test is the same.

My configuration
Ubuntu 10.04 LTS
Mono 2.10.8.1-1~dhx1~lucid1
MonoDevelop 2.8.6.3+dfsg-2~dhx1~lucid1

--

The child process I run is Rdf3xquery, which can be found http://code.google.com/p/rdf3x/
Comment 1 Jeff 2012-03-28 12:42:06 UTC
Created attachment 1592 [details]
TestSelectScalar() is the method that fails

TestSelectScalar() is the method that fails
Comment 2 Jeff 2012-03-28 12:43:08 UTC
public string SelectScalar(string variable, string patterns) is the method I want to perform unit testing.
Comment 3 Mike Krüger 2012-03-30 03:00:44 UTC
I can't find QueryRewriter - but looking at the source I think the test is the problem.

1) You're using the constructor to set up the test - that's what test setups are for.

2) You're using a relative path - that's something you shouldn't do. 
start from the path of typeof(Rdf3xqueryAdapter).Assembly.Location
Comment 4 Jeff 2012-03-30 12:18:01 UTC
I have modified my test code to use a SetUp method for test init as below, but I'm still getting the same error.

[SetUp]
public void Init()
{
	rdf3xAdapter = new Rdf3xqueryAdapter("rdf3xquery", "\"../../Test Data/au_gas\"");
}

I don't think the relative path make the difference -- other than probably bad practice -- and I have verified that the underlying process does run. I've also change the path to absolute to make sure that wasn't the source of error.