|
What are you trying to achieve? There is no inbuilt way to run the tests n times, so you'd end up having to code for this yourself.
|
|
|
|
|
Yeah , I was looking for some inbuilt attributes.There are no such attributes.I am getting an intermediate failure.So need to figure it out.
|
|
|
|
|
You could always write a quick test harness console application, load the class in and look for methods that have this attribute associated with them. It's fairly trivial to execute them once you have this info.
|
|
|
|
|
You could try Microsoft.VisualStudio.TestTools.UnitTesting.DataSourceAttribute.
I use it to run my test with different testdata:
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",
"|DataDirectory|\\MyDataSource.xml",
"Row",
DataAccessMethod.Sequential)]
|
|
|
|
|
buchstaben wrote: You could try
Microsoft.VisualStudio.TestTools.UnitTesting.DataSourceAttribute. I
use it to run my test with different testdata:
[DataSource(<SPAN class=code-string>"</SPAN><SPAN class=code-string>Microsoft.VisualStudio.TestTools.DataSource.XML"</SPAN>,
<SPAN class=code-string>"</SPAN><SPAN class=code-string>|DataDirectory|\\MyDataSource.xml"</SPAN>,
<SPAN class=code-string>"</SPAN><SPAN class=code-string>Row"</SPAN>,
DataAccessMethod.Sequential)]
I really can't see how this helps the OP. The question specifically asks about NUnit, and he hasn't asked how to associate a datasource with his test; the question asks how to run the same test class multiple times.
|
|
|
|
|
you're right. haven't seen the n in "nunit"..
nevertheless using (nearly empty) datasource is a way to achieve multiple testruns -> should work with nunit as well.
|
|
|
|
|
Bad idea.
The point of unit test is to verify that the code works. That isn't your goal here.
So what you need to is the following.
1. Create some code that demonstrates the failure. NOT a unit test itself but it certainly as a method that is suitable for use in a unit test.
2. Create a unit test that calls the code of 1.
3. Figure out the bug by running 2.
4. Re-write 1/2 as necessary to insure that the unit test run will verify, now and in the future, that your code works and continues to work.
By the way intermittent failures are often due to threads. So if you don't have any unit tests that test threading you need to add those.
|
|
|
|
|
Hi
I want a good code(log in )
thanks
|
|
|
|
|
Excellent. I'm glad you're not looking for bad code.
Now, what exactly is your question?
|
|
|
|
|
|
The problem is, you're assuming he means logging (heck, I'm assuming it's a he - he could just as easily be she). This could also be log-in/out functionality.
|
|
|
|
|
Hi
I want a billion dollars
Thanks
|
|
|
|
|
Hi,
In my solution there are multiple projects like web, win services etc.,. all the are using the same Entetprices Library config informations and Connection strings. i want to place the same in a common file and wan to access in the individual project. how to do this?
Any one have Example codes pls post and explain! Thanks in Advance :-)
|
|
|
|
|
I write my own configuration files (in XML) for database connection stuff. Then other things I put in a configuration table in a database.
|
|
|
|
|
Hi all,
I am having .dat file which i am able to read but i am not able to write the data in to it in the following format "111,233,eewr,rwerwe".
How can i add the data to the .dat file.
Thanks in advance.
|
|
|
|
|
1- What did you try (please post some code) ?
2- What do you expect ?
3- What do you get (and where in your code does it occur) ?
|
|
|
|
|
Guys, i got stuck with the some functionality, which i really needed for a tool.. Can we create a ascx file at runtime??
My tool uses ascx file, to display a widget.. Now i want to create widgets at runtime, so i need to create ascx file runtime. Is this Possible any answers?? Please help me to move forward...
thanks in advance..!
|
|
|
|
|
You already asked this in the ASP.NET forum; please post in one place only.
|
|
|
|
|
I am trying to get the PorductID from HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\.
When I look at the registry through Registry Editor I see 21 name values contained including a key ProductID. When I list the key names in C# only 17 names are returned.
I thought that maybe I needed to run the program in administrator mode but still only got 17 names in the listing.
Does any one know why some of the names in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ are not listed when sought programmatically but appear in the registry editor?
modified 10-Oct-11 10:21am.
|
|
|
|
|
Four of the entries are different from REG_SZ.
Are these the four you cannot read? If this is the case you are probably trying to retrieve them incorrectly.
Please update your question with the relevant code on how you read the registry entries.
0100000101101110011001000111001011101001
|
|
|
|
|
Good observation about some of the entries not being REG_SZ, especially when 4 are not REG_SZ on your machine. On my machine 3 are not REG_SZ, but good observation anyway.
The one I am going for, ProductId, does have a type of REG_SZ, and I am trying to retrieve it using the following:
RegistryKey HKLM = Registry.LocalMachine;
String CurrentVersionPath = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\";
String ProductId = (String)CurrentVersionKey.GetValue("ProjectId");
Which works just fine with another item that is also has a type of REG_SZ.
String BuildGUID = (String)CurrentVersionKey.GetValue("BuildGUID");
Console.Write(String.Format("Registry value for {0}: {1}\n\n", "BuildGUID", BuildGUID));
Could you please try the following and see if you get all the items in CurrentVersion?
using System;
using Microsoft.Win32;
namespace RegistryValues
{
class Program
{
static void Main(string[] args)
{
RegistryKey HKLM = Registry.LocalMachine;
String CurrentVersionPath = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\";
RegistryKey CurrentVersionKey = HKLM.OpenSubKey(CurrentVersionPath);
if (CurrentVersionKey == null)
{
Console.WriteLine("Bad CurrentVersion registry key");
Console.Read();
return;
}
String[] names = CurrentVersionKey.GetValueNames();
Int16 i = 0;
foreach (String name in names)
{
Console.WriteLine(String.Format("{0}\t{1}", ++i, name));
}
Console.WriteLine("\n");
HKLM.Close();
Console.Read();
}
}
}
|
|
|
|
|
I just ran your code on my machine (XP) and all values were retrieved.
I also tried retrieving the value of ProductId and this also worked.
0100000101101110011001000111001011101001
|
|
|
|
|
I believe in XP the ProductId is in the Windows hive (not Windows NT as in Vista and Win7).
Do you have an entry for ProductId in the Windows NT/CurrentVersion/?
<edit>
I re-read your post and see that you do. Now I am confused.
</edit>
If I remember correctly in XP it is under Windows/CurrentVersion/ or possibly a hive under that.
Thanks for checking it out.
modified 11-Oct-11 12:34pm.
|
|
|
|
|
|
Thank you for the links. I will look into them when I get home from work.
|
|
|
|