locked
Extraction rule failing test RRS feed

  • Question

  • I have an extraction rule where I through regex extract two variables. It is valid for these extractions to not extract anything at all for certain users. The extraction rules have required set to false, the validation level in the load test is low. Still, the tests that can't extract anything fails..isn't there some way to fix this??
    Friday, May 21, 2010 12:08 PM

Answers

  • Hello,

    I have an extraction rule where I through regex extract two variables.

    The built-in extraction rule could only extract one variable only. It is not able to extract more than one.

    It is valid for these extractions to not extract anything at all for certain users.

    How do you achieve the goal that 'for certain users'?

    If you run the web test separately, does this issue still exist that  tests that can't extract anything fails? Could you please go to web test editor, click the extraction rule and verify whether the property 'Level' is set to Low?


    Edwer Fang [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Monday, May 24, 2010 8:58 AM
    Moderator
  • I know this is probably late but fwiw and in case anyone else can use it, I ran into this VSTS 2010 bug.  To work around the issue, I created a custom Extraction rule that inherits from ExtractRegularExpression.  I add an override of the Extract method and inside my override, I call the base method and then add a line where I set e.Success=true.  Seems to work as expected.  Here's the full code:

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ComponentModel;
    using Microsoft.VisualStudio.TestTools.WebTesting;
    using Microsoft.VisualStudio.TestTools.WebTesting.Rules;

    namespace [YourNamespace].ExtractionRules
    {
    [DisplayName("Extract Regular Expression Not Required")]
    [Description("Extract text matching a regex and add it to the test context.  If no match is found, do not fail webtest.  This gets around a VSTS bug where 'Required' property of the Extract Regular Expression rule is not honored.")]
    public class ExtractRegularExpressionNotRequired : ExtractRegularExpression
    {
    public override void Extract(object sender, ExtractionEventArgs e)
    {
    base.Extract(sender, e);
    e.Success = true;
    }
    }
    }

    • Marked as answer by mattias_s Tuesday, June 12, 2012 5:59 PM
    Tuesday, February 15, 2011 10:45 PM

All replies

  • Hi,

    For the Extraction rule - you can set the property 'Required' to 'false', and I believe in this case Test will not be marked as failed if extraction has failed.

    ~Hem

     


    Hemchand
    Saturday, May 22, 2010 6:57 PM
  • As I wrote in my original post: "The extraction rules have required set to false"
    Monday, May 24, 2010 6:44 AM
  • Hello,

    I have an extraction rule where I through regex extract two variables.

    The built-in extraction rule could only extract one variable only. It is not able to extract more than one.

    It is valid for these extractions to not extract anything at all for certain users.

    How do you achieve the goal that 'for certain users'?

    If you run the web test separately, does this issue still exist that  tests that can't extract anything fails? Could you please go to web test editor, click the extraction rule and verify whether the property 'Level' is set to Low?


    Edwer Fang [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Monday, May 24, 2010 8:58 AM
    Moderator
  • Hello,

    Is your issue resolved?


    Edwer Fang [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.

    Thursday, May 27, 2010 6:02 AM
    Moderator
  • Hello,

    I will mark the reply as answer, if you find it no help, you can feel free to unmark it.


    Edwer Fang [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Friday, May 28, 2010 3:34 AM
    Moderator
  • This is not resolved, some clarifications:

     

    1. This is an extraction rule of type "Extract Regular Expression"

    2. If I run the web test separately, the test fails if the extraction rule does not find the regular expression

    3. I want the test to pass regardless of the the outcome of this extraction rule

     

    "Could you please go to web test editor, click the extraction rule and verify whether the property 'Level' is set to Low?" I do not find the Level property?


     

    Monday, June 28, 2010 11:57 AM
  • Hello,

    Now that you want the test to pass regardless of the the outcome of this extraction rule, in the 'Add Extraction Rule' dialog, select "Extract Regular Expression" in the left panel, and set the value of 'Required' property to 'False'. This should work for your case.


    Edwer Fang [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Tuesday, June 29, 2010 8:36 AM
    Moderator
  • As I stated in my first post: "The extraction rules have required set to false, the validation level in the load test is low". This is from the Details tab of the failing Request, the extraction rule is marked as failed:

    "RegularExpression was not found in the response"  "RegularExpression=(?<=value=")[0]{4}(?="), IgnoreCase=False, Required=False, Index=0, HtmlDecode=True"


    Friday, July 2, 2010 8:06 AM
  • Hello,

    This is really confused and strange. It should mark this request pass.

    Try the following steps to see if they fix this issue:

    a)     Try to run devenv /ResetSettings (in command prompt) to eliminate the related potential settings problem.

    b)     Try disabling Add-ins (e.g. “Tools” | “Add-in Manager”) or run “devenv.exe /SafeMode”.This can eliminate the possibility that third party Add-ins or packages are causing problems. (For more detailed VS command line switches information, see: http://msdn2.microsoft.com/en-us/library/xee0c8y7.aspx )

    c)     Try creating a new project. Sometimes corrupted project settings can cause problems. These are project specific.

    d)     Make sure that we have the latest service pack applied. Apply VS2008 SP1.

    e)     Try to reboot the operating system to safe mode. This can help to isolate whether any other applications are interfering with Visual Studio. Note that some features (like IIS) are not available under safe mode. Please check whether this can be applied or not. In addition to safe mode, we can also try “clean boot”: How to configure Windows XP to start in a "clean boot" state http://support.microsoft.com/kb/310353 .

    f)      Try to create a new user account. This can help isolate user profile corruption related causes.


    Edwer Fang [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Monday, July 5, 2010 8:24 AM
    Moderator
  • Maybe I posted this in the wrong forum since I'm running VSTS 2010?
    Monday, July 5, 2010 11:02 AM
  • Hello,

    This would be the right place. If convenient, could you please send the whole solution to me(v-jinfan@microsoft.com) for better troubleshooting?


    Edwer Fang [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Tuesday, July 6, 2010 6:54 AM
    Moderator
  • I know this is probably late but fwiw and in case anyone else can use it, I ran into this VSTS 2010 bug.  To work around the issue, I created a custom Extraction rule that inherits from ExtractRegularExpression.  I add an override of the Extract method and inside my override, I call the base method and then add a line where I set e.Success=true.  Seems to work as expected.  Here's the full code:

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ComponentModel;
    using Microsoft.VisualStudio.TestTools.WebTesting;
    using Microsoft.VisualStudio.TestTools.WebTesting.Rules;

    namespace [YourNamespace].ExtractionRules
    {
    [DisplayName("Extract Regular Expression Not Required")]
    [Description("Extract text matching a regex and add it to the test context.  If no match is found, do not fail webtest.  This gets around a VSTS bug where 'Required' property of the Extract Regular Expression rule is not honored.")]
    public class ExtractRegularExpressionNotRequired : ExtractRegularExpression
    {
    public override void Extract(object sender, ExtractionEventArgs e)
    {
    base.Extract(sender, e);
    e.Success = true;
    }
    }
    }

    • Marked as answer by mattias_s Tuesday, June 12, 2012 5:59 PM
    Tuesday, February 15, 2011 10:45 PM
  • This has saved me a lot of time. Great fix... Thanks for sharing.

    Cheers

    Richard.

    Thursday, September 29, 2011 2:40 PM