-
1. Re: How to get the current execution testname?
Michael Labriola Aug 3, 2010 9:40 AM (in response to hadzhiyski)Radi,
It isn't quite as easy in FlexUnit 4 as it is a very different programming model.
What version are you using presently 4.0 or one of the 4.1 betas? I ask because there are some ways I can help you get this data cleanly, but it will be *much* cleaner in the 4.1 versions.
Mike
-
2. Re: How to get the current execution testname?
hadzhiyski Aug 3, 2010 9:44 AM (in response to Michael Labriola)Hi,
I am using just 4 not the 4.1 because it is beta, but it would be nice, when you tell me both ways
Regards
Radi
-
3. Re: How to get the current execution testname?
Michael Labriola Aug 3, 2010 10:15 AM (in response to hadzhiyski)Radi,
Not so easy as that.
In the 4.1 stuff, I can show you how to write a very simplistic rule that gives you the information you want. I will need to think of a way to get you this in 4.0
Mike
-
4. Re: How to get the current execution testname?
hadzhiyski Aug 3, 2010 11:12 AM (in response to Michael Labriola)Mike,
well then tell me, how to do it with 4.1
and then later if you find a solution for 4, just post it too.
Radi
-
5. Re: How to get the current execution testname?
Michael Labriola Aug 3, 2010 11:42 AM (in response to hadzhiyski)I created a class for you named MethodNameRule. Right now it is setup to be in the default package, but you should move this wherever it works for your project.
http://dl.dropbox.com/u/7563631/MethodNameRule.as
As long as you are using FlexUnit 4.1 beta 2 or later (I would suggest beta 3) you can do this in your test case:
public class SomeTest {
[Rule]
public var methodNameRule:MethodNameRule = new MethodNameRule();
[Test]
public function myTest() : void {
trace( methodNameRule.methodName ); //will read myTest
}
[Test]
public function myTest2() : void {
trace( methodNameRule.methodName ); //will read myTest2
}
}
Mike
-
6. Re: How to get the current execution testname?
Ilkka Kudjoi Jan 27, 2011 7:07 AM (in response to Michael Labriola)Hi,
I would be extremely happy to see FlexUnit 4.0.0 solution to this problem, because integration of 4.1RC2 into Flash Builder 4 doesn't seem easy either. I'm trying to find a way to convert our asynchronous tests on Fluint to use FlexUnit4. We use test method meta data to determine which user we should use to run the test, like
[Auth(username="dev_user")] or [Auth(username="special_user")].
This information was used in the setUp method for login routine. How could I find out which test method is about the get executed after the [Before]-marked method. This would be extremely helpful to me as I wouldn't have to rewrite all tests.
- Ilkka
-
7. Re: How to get the current execution testname?
Michael Labriola Jan 27, 2011 8:27 AM (in response to Ilkka Kudjoi)To change Flash Builder to 4.1, you change 1 SWC file in builder or simply put the FlexUnit rc2 swc file in your projects library.
That's all.
There are many bug fixes and new features in the 4.1 version and we will not be changing the 4.0 version at this point. All future updates from adobe will also be on 4.1
Mike
-
8. Re: How to get the current execution testname?
Ilkka Kudjoi Jan 30, 2011 9:46 PM (in response to Michael Labriola)Hi,
I thought that it wouldn't work as Flash Builder automatically adds the 4.0.0 versions to the project, but it does, thank you!
BR Ilkka

