Commit d718cd74 d718cd74d71fb26a926954b4a128e31c8e100c8c by Christian Gerdes
2 parents da3a3431 a14c591a
......@@ -346,6 +346,104 @@ namespace LIL_VSTT_Plugins
}
}
///<summary>
///WebTest Plugin Data Generator
///</summary>
[DisplayName("Data Generator Integer")]
[Description("(C) Copyright 2016 LIGHTS IN LINE AB\r\nGenererar en slumpad integer som context parameter")]
public class dataGenInteger : WebTestPlugin
{
Random RandomNumber = new Random(System.DateTime.Now.Millisecond);
private string paramName;
[DisplayName("Parameter namn")]
[Description("Ange namnet på parametern i ditt webtest, tex IntParameter1")]
[DefaultValue("IntegerParameter1")]
public string ParamNameVal
{
get { return paramName; }
set { paramName = value; }
}
private int intMin;
[DisplayName("Integer Min")]
[Description("Ange minsta värdet för parametern i ditt webtest, tex 0")]
[DefaultValue(0)]
public int IntegerMin
{
get { return intMin; }
set { intMin = value; }
}
private int intMax;
[DisplayName("Integer Max")]
[Description("Ange högsta värdet för parametern i ditt webtest, tex 100")]
[DefaultValue(100)]
public int IntegerMax
{
get { return intMax; }
set { intMax = value; }
}
private bool prePage = false;
[DisplayName("Uppdatera på varje Page")]
[Description("Sätt till true om du vill ha värdet uppdaterat inför varje ny sida som laddas i testet.")]
[DefaultValue(false)]
public bool PrePageVal
{
get { return prePage; }
set { prePage = value; }
}
private bool preTrans = false;
[DisplayName("Uppdatera på varje Transaktion")]
[Description("Sätt till true om du vill ha värdet uppdaterat inför varje ny transaktion i testet.")]
[DefaultValue(false)]
public bool PreTransactionVal
{
get { return preTrans; }
set { preTrans = value; }
}
private bool preReq = false;
[DisplayName("Uppdatera på varje Request")]
[Description("Sätt till true om du vill ha värdet uppdaterat inför varje nytt request i testet.")]
[DefaultValue(false)]
public bool PreRequestVal
{
get { return preReq; }
set { preReq = value; }
}
public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
update(e.WebTest.Context);
base.PreWebTest(sender, e);
}
public override void PrePage(object sender, PrePageEventArgs e)
{
if (prePage) update(e.WebTest.Context);
base.PrePage(sender, e);
}
public override void PreRequestDataBinding(object sender, PreRequestDataBindingEventArgs e)
{
if (preReq) update(e.WebTest.Context);
base.PreRequestDataBinding(sender, e);
}
public override void PreTransaction(object sender, PreTransactionEventArgs e)
{
if (preTrans) update(e.WebTest.Context);
base.PreTransaction(sender, e);
}
private void update(WebTestContext context)
{
context[paramName] = RandomNumber.Next(intMin, intMax);
}
}
///<summary>
///WebTest Plugin Data Generator
......
......@@ -2,6 +2,8 @@
<WebTest Name="WebTest3" Id="5f8fe34b-e853-4a88-95cb-a8e963383b09" Owner="" Priority="2147483647" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="">
<Items>
<Request Method="GET" Guid="359feba0-105f-4dbf-a630-32d640c10817" Version="1.1" Url="https://new.vinnarum.com/" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
<Request Method="GET" Guid="359feba0-105f-4dbf-a630-32d640c10817" Version="1.1" Url="https://new.vinnarum.com/" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
<Request Method="GET" Guid="359feba0-105f-4dbf-a630-32d640c10817" Version="1.1" Url="https://new.vinnarum.com/" ThinkTime="0" Timeout="300" ParseDependentRequests="False" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False" />
</Items>
<WebTestPlugins>
<WebTestPlugin Classname="LIL_VSTT_Plugins.ServiceManagerWebTestPlugin, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Service Manager Config" Description="(C) Copyright 2015 LIGHTS IN LINE AB&#xD;&#xA;Sätter config värden i Service Manager instansen för hela testet.">
......@@ -15,5 +17,15 @@
<RuleParameter Name="useTls12" Value="True" />
</RuleParameters>
</WebTestPlugin>
<WebTestPlugin Classname="LIL_VSTT_Plugins.dataGenInteger, LIL_VSTT_Plugins, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" DisplayName="Data Generator Integer" Description="(C) Copyright 2016 LIGHTS IN LINE AB&#xD;&#xA;Genererar en slumpad integer som context parameter">
<RuleParameters>
<RuleParameter Name="ParamNameVal" Value="TimeStampParameter1" />
<RuleParameter Name="IntegerMin" Value="0" />
<RuleParameter Name="IntegerMax" Value="100" />
<RuleParameter Name="PrePageVal" Value="True" />
<RuleParameter Name="PreTransactionVal" Value="False" />
<RuleParameter Name="PreRequestVal" Value="False" />
</RuleParameters>
</WebTestPlugin>
</WebTestPlugins>
</WebTest>
\ No newline at end of file
......