Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameterize web app URL in JMX using env #10

Merged
merged 7 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ jobs:
loadTestConfigFile: 'SampleApp.yaml'
loadTestResource: ${{ env.LOAD_TEST_RESOURCE }}
resourceGroup: ${{ env.LOAD_TEST_RESOURCE_GROUP }}
env: |
[
{
"name": "webapp",
"value": "${{ env.AZURE_WEBAPP_NAME }}.azurewebsites.net"
}
]

- uses: actions/upload-artifact@v2
with:
Expand Down
17 changes: 14 additions & 3 deletions SampleApp.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">issacnitineastustest76eastus.azurewebsites.net</stringProp>
<stringProp name="HTTPSampler.domain">${udv_webapp}</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
Expand Down Expand Up @@ -93,7 +93,7 @@
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">issacnitineastustest76eastus.azurewebsites.net</stringProp>
<stringProp name="HTTPSampler.domain">${udv_webapp}</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
Expand Down Expand Up @@ -146,7 +146,7 @@
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">issacnitineastustest76eastus.azurewebsites.net</stringProp>
<stringProp name="HTTPSampler.domain">${udv_webapp}</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
Expand Down Expand Up @@ -178,6 +178,17 @@
</kg.apc.jmeter.timers.VariableThroughputTimer>
<hashTree/>
</hashTree>
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="udv_webapp" elementType="Argument">
<stringProp name="Argument.name">udv_webapp</stringProp>
<stringProp name="Argument.value">${__BeanShell( System.getenv("webapp") )}</stringProp>
<stringProp name="Argument.desc">Web App URL</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
</hashTree>
</hashTree>
</jmeterTestPlan>
12 changes: 9 additions & 3 deletions SampleApp_Secrets.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<stringProp name="Argument.desc">Value for x-secret header </stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="udv_webapp" elementType="Argument">
<stringProp name="Argument.name">udv_webapp</stringProp>
<stringProp name="Argument.value">${__BeanShell( System.getenv("webapp") )}</stringProp>
<stringProp name="Argument.desc">Web App URL</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
Expand Down Expand Up @@ -53,7 +59,7 @@
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">isaacnitinwus2.azurewebsites.net</stringProp>
<stringProp name="HTTPSampler.domain">${udv_webapp}</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
Expand Down Expand Up @@ -122,7 +128,7 @@
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain">isaacnitinwus2.azurewebsites.net</stringProp>
<stringProp name="HTTPSampler.domain">${udv_webapp}</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
Expand Down Expand Up @@ -184,7 +190,7 @@
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">isaacnitinwus2.azurewebsites.net</stringProp>
<stringProp name="HTTPSampler.domain">${udv_webapp}</stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
Expand Down
13 changes: 10 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ stages:
subscriptionId: $(azureSubscriptionId)
action: 'Create Or Update Resource Group'
resourceGroupName: '$(webAppName)-rg'
location: 'East US'
location: $(location)
templateLocation: 'Linked artifact'
csmFile: '$(System.DefaultWorkingDirectory)/windows-webapp-template.json'
overrideParameters: '-webAppName $(webAppName) -hostingPlanName $(webAppName)-host -appInsightsLocation "East US" -databaseAccountId $(webAppName)db -databaseAccountLocation "East US"'
overrideParameters: '-webAppName $(webAppName) -hostingPlanName $(webAppName)-host -appInsightsLocation "$(location)" -databaseAccountId $(webAppName)db -databaseAccountLocation "$(location)"'
deploymentMode: 'Incremental'
deploymentOutputs: 'output'

Expand Down Expand Up @@ -133,6 +133,13 @@ stages:
loadTestConfigFile: 'SampleApp.yaml'
resourceGroup: $(loadTestResourceGroup)
loadTestResource: $(loadTestResource)

env: |
[
{
"name": "webapp",
"value": "$(webAppName).azurewebsites.net"
}
]

- publish: $(System.DefaultWorkingDirectory)/loadTest
artifact: results