Search the web
Sign In
New User? Sign Up
csunit
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Is it possible to create dynamic test?   Message List  
Reply | Forward Message #86 of 92 |
Re: Is it possible to create dynamic test?

Hi,

I managed to implements the Parameterization Test.
However, as i'm quite new to csUnit, there are certain things that
I not sure how to go about doing it.
The Parameterization is "working" now, however as there are quite
a number of processing it had to perform, and I don't get any update
accept the assetsing counter at the lower right hand corner.
Is it possible for csUnit to display the "progress"
e.g.
[Test(Categories="File Format")]
[DataSource(typeof(FixtureWithStaticDataProvider))]
public void CheckFileFormat(string filePath) {

FileStream fs = new FileStream(filePath, FileMode.Open);
TextReader tr = new StreamReader(fs);
string text = tr.ReadToEnd();

Assert.Contains("XXX", text, "xxx start indicator not found");
Assert.Contains(@"\XXX", text, "xxx end indicator not found");

Assert.Contains("XXX1", text, "xxx1 start indicator not found");
Assert.Contains(@"\XXX1", text, "xxx1 end indicator not found");

Assert.Contains("XXX2", text, "xxx2 start indicator not found");
Assert.Contains(@"\XXX2", text, "xxx2 end indicator not found");
}

Ok. To be frank. This test is "fast" enough. 5 seconds for 70++
files.
However my next test, required it to read in quite a massive
amount of data for some signal processing. I would like if i am able
to have some update on CS screen. Just like what it show when the test
failed, such as File 70's Block 2.

File 1's Block 1 -> Signal Ok
File 1's Block 2 -> Signal Ok
..
File 1's Block 96 -> Signal Ok
..
File 70's Block 1 -> Signal Ok
File 70's Block 2 -> Signal Not Ok
..
File 70's Block 96 -> Signal Not Ok

My thinking was if I am able to create a method dynamically, I
would at least be able to create method name such as
"File1_Block1Test" ,...."File70_Block96Test". At least I would be able
to know the progress of the test. But if I able to bypass all this,
then it would be great. But if i'm able to learn some reflection
stuffs, it would be nice too. ;)

Thanks,
Boon Hui

--- In csunit@yahoogroups.com, Robert Bateman <rbatemanmi@...> wrote:
>
> Why not do a parameterized test?
>
> http://www.csunit.org/documentation/2.4/parameterizedTests.html
>
> Look for the section who's title is:
>
> Parameterization With Static Method Or Property
> I think you want to use a parameterized test using the
DataSourceAttribute capability.  In your case, the DataSource returned
would be the result of your Directory.GetFiles() call...
>
> Bob
>
> --- On Sun, 2/15/09, boonhuiasd <boonhui609@...> wrote:
> From: boonhuiasd <boonhui609@...>
> Subject: [csunit] Is it possible to create dynamic test?
> To: csunit@yahoogroups.com
> Date: Sunday, February 15, 2009, 10:49 PM
>
>
>
>
>
>
>
>
>
>
>
>
> Hi all,
>
>
>
> I'm wondering whether is it possible perform this using csUnit.
>
>
>
> e.g.
>
> [SetUp]
>
> public void setUp() {
>
> filePath = Directory.GetFiles( basePath, "*_ND*");
>
> .....
>
> }
>
>
>
> [Test]
>
> public void PerformTextX( )
>
> {
>
> Assert.True( ......);
>
> }
>
>
>
> Is it possible to dynamically generate the PerformTextX so i don't
>
> have to copy and paste 100s' or more (dependig on the number of files
>
> in the folder) of the same function?
>
>
>
> Or should I just use a single PerformTest and perform a loop
>
> inside to perform all the required checks?
>
>
>
> Best Regards,
>
> Boon Hui
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>





Wed Feb 18, 2009 4:07 am

boonhuiasd
Offline Offline
Send Email Send Email

Forward
Message #86 of 92 |
Expand Messages Author Sort by Date

Hi all, I'm wondering whether is it possible perform this using csUnit. e.g. [SetUp] public void setUp() { filePath = Directory.GetFiles(basePath, "*_ND*"); ...
boonhuiasd
Offline Send Email
Feb 16, 2009
8:13 am

Why not do a parameterized test? http://www.csunit.org/documentation/2.4/parameterizedTests.html Look for the section who's title is: Parameterization With...
Robert Bateman
rbatemanmi
Offline Send Email
Feb 16, 2009
5:35 pm

Hi, Thanks for the prompt reply. This definitely sound interesting. I will give it a try. Thanks !! Boon Hui ;) ... DataSourceAttribute capability.  In your...
boonhuiasd
Offline Send Email
Feb 18, 2009
6:53 am

Hi, I managed to implements the Parameterization Test. However, as i'm quite new to csUnit, there are certain things that I not sure how to go about doing it. ...
boonhuiasd
Offline Send Email
Feb 18, 2009
6:54 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help