Browserstack service / webdriverIO / Automate / Session Name is changing during the test - continuous-integration

since the lasts versions of webdriverIO with browserstack-service 6.4.7, I am facing some issues with the session name on Browserstack : The Continuous integration is sending a name (with a job unique ID) to Browserstack as a "Session Name" and during the test it changed...
(I can see that the name is the right one at the beginning of the test on Browserstack)
it's very difficult for me to find my way around in the tests as they all have the same name which is the suites or Feature name
have you encountered this kind of problem?
thank you very much for any help !

I believe the session name is being picked up and set from within the framework itself. Have you had the chance to output a few variables to the console from this file, https://github.com/itszero/wdio-browserstack-service/blob/47786feacef79c674e79d812cddb99cb87b2a267/lib/browserstack-service.js#L55 and verify the session name being set?

I am using the WebdriverIO version 7 with Mocha framework and BrowserStack.
As per https://webdriver.io/docs/browserstack-service
Add following in your configuration file:
services: [
['browserstack', {
browserstackLocal: false, // Set this flag as per your requirement
}],
],
This will automatically set the session's name to the test suite's name.

Related

How to set variable and its value in Jmeter container like User Parameters using script

I need to set and get variables in Jmeter for API automation.
I am using the groovy script for same.
I am able to store key-values in Property Files using below code:
props.put("shubhamKey", "shubhamValue")
I do not want to use the main property as it contains so many other keys which may use by Jmeter and we can't place any hardcode key in property directly.
But I am not an able set similar thing in any of below containers :
User Defined Variables
User Parameters
The code I am trying is as below:
vars.put("shubhamUserKeyagain","shubhamUservalue")
Use vars.put and execute the script and click on User Defined Variables. The new key should reflect there but it's not. That is my main issue
I have tried to place User Parameters just below in TestPlan, With-in the request where JSR223 Assertion is present, also tried to place it before and after JSR223 Assertion
My get value is working fine from these containers but the set is not reflecting over the containers. Below code, I am using to get the value
vars.get("shubhamLocalVariable")
Another code I have tried :
vars.putAll("myNormalValue","changeho")
Is there any other container in which I can set and get key-values using the script as groovy.
Environment :
OS : Window 10
Jmeter Version: 3.2 r1790748
Running bat file as an administrator
I have added my project in below URL:
https://ufile.io/7r6tk
Please refer and let me know if I missed anything
Reference Screenshots:
User Parameter
JSR233 Assertion
This one works for me - I have cleared up your script

Jmeter 3.2- Error in NonGUIDriver org.apache.jorphan.util.JMeterStopTestException

I have a JMeter test suite, which is working fine till apache-jmeter-2.13.
When upgrade to JMeter 3.2 and I get below exceptions in non GUI mode.
I didn't do any change in the JMeterscript, why this error is throwing in JMeter versions later 2.13 or in version 3.2?
jmeter -n -t E:\testsuite.jmx -l E:\tmp\RORlogs.csv
Error in NonGUIDriver org.apache.jorphan.util.JMeterStopTestException: ModuleCon
troller:Tracker_List_Artifacts has no selected Controller (did you rename some e
lement in the path to target controller?)
Test was shutdown as a consequence
Add an answer to close the problem:
In earlier versions of jmeter 2.13, it didn't validate the controllers which is disabled.
But from Jmeter version 3.2, irrespective of disabling all the controllers should have proper target values.
Fix the issue by assign proper target controller is assigned to disabled module controller.
Not sure if you've got the exact same situation, but what we've found is that JMeter has a problem where if you have a script with a module controller that includes another script that also has a module controller the file paths may be off and so the module controller of the included script will error.
For example. Say I have 'main.jmx' that has a module controller that points to 'external.jmx'. 'external.jmx' has a module controller that points to 'another_script.jmx'.
'main.jmx' is located in 'Documents/scripts', and this is also the directory we lauched JMeter from. 'main.jmx' has a relative path that points to 'external.jmx'. However, 'another_script.jmx' does not have the same relative path and so JMeter throws an error.
Pro tip: renaming your test elements to descriptive names will make debugging scripts far easier (it looks like you've done this, but this is more for other people reading this).
I am using Jmeter 5* and here irrespective of how many target controller names you modify, you finally need to touch all transactions/module controller from top to bottom once. Its kind of re-associating module controller with target controller. After that its working fine for me.

Simple Coded UI login test on remote server

I used Microsoft Test Manager to create a test for a log on page (not locally hosted) and recorded this. All steps were executed without errors.
Then I've created a Coded UI test project in Visual Studio 2013.
I added a Coded UI Test with the existing recording.
I ran the test and I got the message below:
"FailedToPerformActionOnHiddenControlException: Cannot perform 'SetProperty of Text with value " on the username field.
I received this message when using the existing recording, but also if I record using the recording function in Visual Studio.
Has someone got experience with Coded UI Tests and maybe give me an example as to how to set it up.
If I understand correctly, you're basically trying to have Coded UI input a value into an HtmlInput control that's a text box on a web page. The error message "FailedToPerformActionOnHiddenControlException: Cannot perform 'SetProperty of Text with value" normally means that the value you're trying to submit isn't able to be taken by the control, either because a value isn't accepted (example, numeric values in a name field) or because it's more characters than can be accepted by the field. It could also be that the recording isn't defining the object properly, and that the property Text isn't an option on the control that was found.
So, confirm these three things:
1. The control you're tying to send value to is actually an HtmlInput. You can't send the Text property to, for example, an `HtmlDiv`.
2. The value you're submitting is a valid value for your control (you're not trying to submit numbers, for example, into a field that won't accept them).
3. The value you're submitting is within the length limit for the field.
If I were a betting man, I would say that you probably don't have the object defined properly. Take a look at the SearchProperties of the control in question first and make sure that it matches the HTML on the page itself.
Do I need to set a standard environment for testing on an other server.
I develop the Coded UI test project in a workspace on a development environment, but I need the tests to be run on a acceptation environment (the recorded tests are executed on the acceptation environment).
I read it's easy to setup this environment though, but what is best practise?
Is it better to execute it on the same environment?
Here's a code snippet:
[TestMethod]
public void TestLogonToAccount()
{
// To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
this.UIMap.Enterusername();
this.UIMap.Enterpassword();
this.UIMap.Clickonlogin();
this.UIMap.ClickonCentral();
this.UIMap.Searchforemailaddress();
this.UIMap.Clickonlogin1();
}
I forgot an important part regarding the login recording test in MTM.
I just tried to play the steps again and got this error:
Playback of the selected sections of the action recording could not be completed The playback failed to find the control with the
given search properties. Additional Details: TechnologyName: 'MSAA'
Name: '' ClassName: 'MozillaWindowClass' ControlType: 'Window'

Trigger option to set specific build parameters?

I'm looking for a way to attach some specific build parameter to a scheduled trigger.
The idea is that we are continuously building debug versions of our products. Our nightly build has to be a release build, though. The build configurations for most of our projects is absolutely the same. It even has a configuration parameter, already. So all I would need is a trigger which allows for specifying an override for a single build parameter. That would cut the build configurations to maintain by half.
Is there a way to achieve this?
Not right now, you can follow this issue.
The approach I use is to create a "Deploy :: Dev D1 :: Run all integration tests" build. I then create a build trigger on each integration service build.
I create a parameter called "env:OctopusEnvironment" for integration service build. Set the value to be empty. I like to use prompt and display:
select display='prompt' label='OctopusEnvironment' data_13='Production' data_12='CI' data_11='Local - Hassan' data_10='Local - Mustafa' description='OctopusEnvironment' data_02='Test T1' data_01='Dev D1' data_04='Local - Taliesin' data_03='Continuous Deployment CI 1' data_06='Local - Paulius' data_05='Local - Ravi' data_08='Local - Venkata' data_07='Local - Marko' data_09='Local - Ivan'
In each integration service build I add this powershell step:
$octopusEnvironment = ($env:OctopusEnvironment).Trim()
Write-Host "Octopus environment = '$octopusEnvironment'"
if ($octopusEnvironment.Length -lt 1) {
Write-Host "Auto detecting octopus environment"
$trigger = '%teamcity.build.triggeredBy%' -split '::'
if ($trigger.Length -gt 2){
$environment = $trigger[1].Trim()
Write-Host "##teamcity[setParameter name='env.OctopusEnvironment' value='$environment']"
}
}
So now I can run the integration test via a trigger and when I run it directly it will prompt me on which environment to run integration test against.
I was stuck with the same problem and voted for the issue mentioned by Evgeny. One solution we thought, as mentioned sergiussergius, was to add a final step in the build-steps sequence to trigger manually the next build-configuration by passing custom-build parameters using the REST API. But in this case, we are loosing the build-chain information.
Using TeamCity 9.x, trying some stuff on the REST API, I could implement a solution who makes it possible to retrieve the triggering (ancestor) build and its parameters from the triggered (child) build.
The first thing we do is getting the current build using the environment variables set by TeamCity:
https://<host>/httpAuth/app/rest/builds/number:<env.BUILD_NUMBER>,buildType:(name:<env.TEAMCITY_BUILDCONF_NAME>,project:<env.TEAMCITY_PROJECT_NAME>)
In the response from the REST API, we have a /build/triggered tag which contains information about the trigger. It looks like this
<triggered type="unknown" details="##triggeredByBuildType='<triggering-build-configuration-internalId>' triggeredByBuild='<triggering-build-number>'" date="20160105T190642+0700"/>
The looks like btxxx for us.
From it, we can access the triggering-build (ancestor) using the following request to the REST API:
https://<host>/httpAuth/app/rest/builds/number:<triggering-build-number>'4,buildType:(internalId:<triggering-build-configuration-internalId>1,project:name:<env.TEAMCITY_PROJECT_NAME>)
from the response, we can get the ancestor-build's parameters values, and set it in the current build using:
echo "##teamcity[setParameter name='env.ENV_AAA' value='aaaaaaaaaa']")
Notes:
this post reference TeamCity version 7.X. I did this using TeamCity version 9.X, and could not try it with a previous version. I don't know if the REST API calls mentioned in my post are similar in the previous versions.
In this solution, the ancestor's build-configuration (the one who trigger the build) and the child's build-configuration (the one triggered) are in the same project. I did not do the test using build-configurations in 2 different projects: I would expect the "trigger" tag to provide information about the ancestor's project. It would be nice if someone could do the test.
I hope this solution may help!
This is not a general solution, but in certain cases (for example if you want to determine whether the build was started by a schedule trigger or some other method), a workaround is to examine the predefined parameter teamcity.build.triggeredBy.
This parameter is set to the same string that is shown on the build's overview page next to the label "Triggered by:". For example, "Schedule Trigger", "Git", or a user's full name. (There is also a teamcity.build.triggeredBy.username parameter, but it is only set in the latter case).
The limitation of this approach is that you cannot, for example, distinguish between two separate schedule triggers defined for the same build configuration. But in that case you could resort to examining the current time as well.
I added request to last build step
curl -i -u "%login%:%pass%" -H "Content-type: text/plain" -X PUT -d "v1" http://tc.server/httpAuth/app/rest/buildTypes/id:%buildConfigurationId%/parameters/env.%SOME_PARAMETER%
http://confluence.jetbrains.com/display/TCD8/REST+API

VS.NET Load Testing - pass site URL via parameter

I'm building VS.NEt 2010 Load Test solution.
Everything works really good except one thing. When I record .webtest script - it grabs the site domain name, like so:
http://test1/page1
http://test1/page2
So the test1 is hardcoded in the script.
What I would like to do is to run same load test again different test environment - the goal is to compare two environment without rewriting the recording.
I see that Run Settings has "Context Parameters" - is this it?
For for a recorded .webtest, this article shows using the context parameters with the {{parameterName}} syntax for form parameters, and can indeed be used for the server name.
From inside a coded test (which inherits from WebTest), you can access it with:
this.Context["KeyName"]

Resources