You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Frédéric THOMAS <we...@hotmail.com> on 2012/12/09 20:06:57 UTC
[Mustella] Localized Test Suite
Hi,
I commented in JIRA[1] but wanted to write down something on the list to
make sure everyone has a chance to know what is going to change in Mustella.
A- Localization:
Until now, the tests were ran only on computers whose operating system was
in English, out since Mustella was given to Apache Flex, every contributor,
committer, whatever the language of the operating system must be able to run
the tests, the original implementation didn't plan it.
1- Comparing error messages:
The original implementation of Mutella Assert, AssertError,
AssertMethodValue and AssertPropertyValue value property allowed to compare
entire Strings only, I added to those Classes another property 'errorArray'
which, guess what, take an Array as parameter and stands for error message
comparation.
Example:
- Before:
<AssertMethodValue method="try{
FlexGlobals.topLevelApplication.obj1.items.failPage(); } catch(e:Error) {
value = e.message; }" value="Error #1063: Argument count mismatch on
assets::PagedDataComp1/errorFunction4(). Expected 1, got 2." />
- After:
<AssertMethodValue method="try{
FlexGlobals.topLevelApplication.obj1.items.failPage(); } catch(e:Error) {
value = e.message; }" errorArray="['Error #1063:',
'assets::PagedDataComp1/errorFunction4()', '1', '2']" />
As you can see, doing so, we get ride the localized part of the error
message.
At the time I'm writting this mail, the patch I'm about to apply contains
the relative code and modify the existing tests in that way.
2- The default localeChain:
Until now, the assumption was that the localeChain would always start with
'en_US' by default, it's not the case if your system is in French for
example, so, when you want to write tests that compare the default
localeChain write bit of code to get the localized localeChain, something
like that for example if your locale bundles are American English, French
and Japanese :
private function get localizedLocalChain():String {
var lang:String = Capabilities.language;
switch (lang) {
case "fr":
return "fr_FR,en_US,ja_JP";
case "ja":
return "ja_JP,en_US,fr_FR";
default:
return "en_US,fr_FR,ja_JP";
}
and the test becomes :
<AssertMethodValue
method="value=ResourceManager.getInstance().localeChain.toString()"
value="{localizedLocalChain}" />
3- The Collators:
The same applies for Collators, instead of having:
- <SetProperty target="uiCustomListComp" propertyName="flashCollatorLocale"
value="en"/>
It's better to have :
- <SetProperty target="uiCustomListComp" propertyName="flashCollatorLocale"
value="{flash.system.Capabilities.language}"/>
If you've got any thoughts relative to this, thank's for sharing, I plan to
apply those changes during the week to let time folks give me some
feedbacks.
- Fred
[1] https://issues.apache.org/jira/browse/FLEX-33242
-----Message d'origine-----
From: Frédéric THOMAS (JIRA)
Sent: Sunday, December 09, 2012 7:11 PM
To: flex-dev@incubator.apache.org
Subject: [jira] [Commented] (FLEX-33242) Mustella tests failed: when your
computer language doesn't match the expected localized error
[
https://issues.apache.org/jira/browse/FLEX-33242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13527554#comment-13527554
]
Frédéric THOMAS commented on FLEX-33242:
----------------------------------------
I'm about to patch the mustella test suite and test files as well with the 4
patches relative to mustella and localization, if someone want a chance to
review them before, that's fine, otherwise, I'll apply them in few days.
> Mustella tests failed: when your computer language doesn't match the
> expected localized error
> ---------------------------------------------------------------------------------------------
>
> Key: FLEX-33242
> URL: https://issues.apache.org/jira/browse/FLEX-33242
> Project: Apache Flex
> Issue Type: Bug
> Components: Mustella
> Affects Versions: Apache Flex 4.9.0
> Reporter: Frédéric THOMAS
> Priority: Critical
> Labels: test
> Attachments: FLEX-33242.patch
>
>
> Mustella tests fail when your computer language doesn't match the expected
> localized error
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA
administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira