SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    May 2008
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    [Query String Extraction ]

    Hello Group ,


    Please i want a way to extract query string in URL ....

    Thanks in advance [img]/images/graemlins/smile.gif[/img]

  2. #2
    Senior Member
    Join Date
    May 2008
    Posts
    145
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    Didn't I help you do this in one of your previous posts [img]/images/graemlins/smile.gif[/img] or via e-mail a couple of months ago?

  3. #3
    Senior Member
    Join Date
    May 2008
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    Yup,
    but when i tried it it dose not work , I donna why ,?
    know i want good way let me abel to extract this string and be global for all my web test project

    thanks [img]/images/graemlins/smile.gif[/img]

  4. #4
    Senior Member
    Join Date
    May 2008
    Posts
    145
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    If you want the extracted values to be global to all your web tests (in other words, you want to be able to share variables between web tests), then you have to store them externally (e.g. write it to database or file).

    To be able to write and read files, you need to do it through custom web test request plugins/custom extraction rule. You can refer to other threads about how to write a custom web test plugin but I'm almost certain that you have written one in the past. [img]/images/graemlins/wink.gif[/img]

  5. #5
    Senior Member
    Join Date
    May 2008
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    Thanks [img]/images/graemlins/smile.gif[/img] ..


    I'll be write anew thread.and i'll be search if there is emails or in other thread i wrote if i asked this question ,,

  6. #6
    Senior Member
    Join Date
    May 2008
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    Hell Again ,

    Really i need help .

    below is the code i used to extract Query string parameter but when I run my web test it faild ,,, i can not know where is the problem exactly :

    Imports System
    Imports System.Collections
    Imports System.ComponentModel
    Imports Microsoft.VisualStudio.TestTools.WebTesting
    Namespace Extract
    Public Class Extractquerystring
    Inherits ExtractionRule

    Private ctxParameter As String = String.Empty
    Private m_parameterName As String = String.Empty
    Private m_isCaseSensitive As Boolean = False
    <Description("Type a name for the QueryString parameter.")> _
    Public Property ParameterName() As String
    Get
    Return m_parameterName
    End Get

    Set(ByVal value As String)
    If value <> String.Empty Then
    m_parameterName = value
    End If

    End Set
    End Property
    <Description("Ignore case during search for matching the parameter name.")> _
    Public Property IsCaseSensitive() As Boolean
    Get
    Return m_isCaseSensitive
    End Get

    Set(ByVal value As Boolean)
    m_isCaseSensitive = value
    End Set
    End Property
    <Description("The name of a text context variable to associate with the extracted value.")> _
    Public Overloads Overrides Property ContextParameterName() As String
    Get
    Return ctxParameter
    End Get
    Set(ByVal value As String)
    If value <> String.Empty Then
    ctxParameter = value
    End If
    End Set
    End Property
    Public Overloads Overrides ReadOnly Property RuleName() As String
    Get
    Return "Extract Query String parameter"
    End Get
    End Property

    Public Overloads Overrides ReadOnly Property RuleDescription() As String
    Get
    Return "Extracts a query string parameter value."
    End Get
    End Property
    Public Overloads Overrides Sub Extract(ByVal sender As Object, ByVal e As ExtractionEventArgs)
    Dim compType As StringComparison
    e.Success = False

    If String.IsNullOrEmpty(m_parameterName) Then
    e.Message = "No query string parameter name defined."
    Return
    End If

    If m_isCaseSensitive = True Then
    compType = StringComparison.Ordinal
    Else
    compType = StringComparison.OrdinalIgnoreCase
    End If

    If e.Request.HasQueryStringParameters Then
    For Each parameter As QueryStringParameter In e.Request.QueryStringParameters
    If parameter.Name.Equals(m_parameterName, compType) Then
    e.Success = True

    If Not String.IsNullOrEmpty(ctxParameter) Then
    ' Check if the context variable exists
    If e.WebTest.Context(ctxParameter) Is Nothing Then
    e.WebTest.Context.Add(ctxParameter, parameter.Value)
    Else
    e.WebTest.Context(ctxParameter) = parameter.Value
    End If
    End If
    End If
    Next
    End If

    If e.Success Then
    e.Message = "Query string parameter extracted."
    Else
    e.Message = "No query string parameter extracted."
    End If
    End Sub
    End Class



    End Namespace


    Here is as an example the Query string that i wan to extract ... The URL :
    http://umniah/RACA/CRCEvents/Eve_Eve....aspx?EveID=43

    I want the value 43 .. from EVeID... and when i choose
    extraction Rule window
    I fill as the following :
    context parameter --> Event
    Parameter name--> EveID
    then I Run my web test ,,,
    but it faild,...

    Help me please

  7. #7
    Senior Member
    Join Date
    May 2008
    Posts
    145
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    I don't see the need for writing something custom for extracting the value of EveID since it is a Query Parameter, can you not just use the built-in Extract Text rule to find the value in the web request's response HTML?

  8. #8
    Senior Member
    Join Date
    May 2008
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    But it is a query string ..
    U mean to take it from HTML as text ???
    Extract TEXT or HTTP ????/
    Explain please

    Thanks [img]/images/graemlins/smile.gif[/img]

  9. #9
    Senior Member
    Join Date
    May 2008
    Posts
    111
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: [Query String Extraction ]

    I extract the value using extract text Rule

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:39 PM.

Copyright BetaSoft Inc.