I have a Selenium script that is taking username and password from a csv file and looping through all the rows to login and logout. I am running this script from JMeter and I am able to see that Jmeter is doing its thing. However, here is what I am not able to understand.
If my CSV file looks like this-
username1, pass1
username2, pass2
username3, pass3
when JMeter meter runs this script with 2 users, it does this-
username1
username1
username2
username2
username3
username3
I was expecting it to be
username1
username2
username3
username1
username2
username3
This may be really simple but I am not able to understand why Jmeter is doing this.
Check your CSV Data Set Config settings
Recycle on EOF? - should be TRUE if you need to read the file again
Sharing Mode should be All threads if all the threads need to share the file.
Related
I need to login into 50 hosts and perform a specific task.
Each host has one of 2 passwords (ex: pass1 and pass2) for a specific user (ex: foo).
I do not know on which host "foo" is set with "pass1" and on which host "foo" is set with "pass2". I have both passwords in a vault file.
Using Ansible, how can I first make a task where I try to login as "foo" with "pass1", then if unsuccessful login with "pass2" and finally setting a fact with the correct vault value (depending on which password worked i.e. "foo" managed to login).
I then want to use that fact to perform additional tasks on that same host.
Test login action using Taurus
execution:
-
concurrency: 5
ramp-up: 5
hold-for: 1m
scenario: Buyer-logs-in
scenarios:
Buyer-logs-in:
variables:
baseurl: http://localhost:3000
default-address: ${baseurl}
data-sources:
- path: './login.csv'
delimeter: ','
variable-names: userName, password
keepalive: true
retrieve-resources: false
requests:
- url: 'http://localhost:3000/login'
label: login
method: POST
body:
user[email]: {userName}
user[password]: {password}
assert:
- contains:
- 200
subject: http-code
- url: 'http://localhost:3000/action'
label: page1
method: GET
assert:
- contains:
- 200
subject: http-code
This is my sample Taurus code to simulate login and measure peformance.
In my app, only one user can login at a time and my csv file has 2 users. The test still works when I set a concurrency of 5 and Taurus says 5 users logged in. How is that possible. When the same user logs in again he will be kicked out of the first browser where he logged in. So with 2 user logins, how does Tuarus simulate 5 users?
With that asked, does taurus really login using the credentials i give in the csv file? Or should I use selenium/Taurus to simulate it?
What really confused me was when I deleted all users in csv file, the test still did not gave me 200 for the login and page1.
TIA
If you don't specify executor Taurus will use jmeter as default, it means that your YAML config will be translated into Apache JMeter test plan
You can see the generated test plan by running bzt your-test.yaml -gui command
data-sources is translated to CSV Data Set Config which looks like:
it means that each thread (virtual user) will pick up the new value from the CSV file each iteration like:
virtual user 1 - iteration 1 - 1st line
virtual user 2 - iteration 1 - 2nd line
virtual user 3 - iteration 1 - 1st line
virtual user 1 - iteration 2 - 2nd line
etc.
I don't think so, you're reading the credentials from the CSV file but not using it anywhere, the correct syntax for JMeter Variables is ${variable_name_here} so you need to set the login request body to:
user[email]: ${userName}
user[password]: ${password}
as long as you properly configure JMeter to behave like a real browser there is no need to use Selenium
You might be getting false positive results because your Response Assertion doesn't do a lot of useful job, JMeter automatically considers HTTP Status Codes below 400 as successful. So instead of checking status code I would rather recommend verifying that the use is logged in, i.e. "Welcome" message is there or API response has some specific text for successful login and/or doesn't contain errors.
I'm trying to automate a procedure and to create the output file that I need. So far everything is going well, but I cannot figure out how to take the number at the end of one row and fill it in for rows after it.
I've tried solutions using awk, sed, etc, but so far, I can't seem to figure this out even with the helps of many googles.
POP-Test-01
10.10.10.10
User: User
Pass: Pass
POP-Test-02
10.10.10.11
User: User
Pass: Pass
POP-Test-03
10.10.10.12
User: User
Pass: Pass
But I want it to take the numerical values from the first line, and append it to the user and pass lines. But for the pass line, I'd like to add it twice.
POP-Test-01
10.10.10.10
User: User01
Pass: Pass0101
POP-Test-02
10.10.10.11
User: User02
Pass: Pass0202
POP-Test-03
10.10.10.12
User: User03
Pass: Pass0303
These are only examples, but the last two digits of the hostname(ex. POP-Test-03) will always be numerical digits.
Edit:
I've had some requests for more details. Sorry about that guys, so here is the skinny. Please note that all values are fake, these come from an input file. I just used the most generic values I could think of.
The input is a text file with only the values in the top example.
So I run a script that deploys instances and the only output I get from the deployment script is the Hostname and the IP address. I know it's not clean, but below is how I'm adding the user and password. But the user and pass are always the same between each batch of servers with only the number of the server being appended to the user and the password(twice). I'm doing this because an application we use requires the input of:
HOSTNAME
IP
User: (username)
Pass: (password)
(empty line)
Normally I have to enter these manually which is time consuming and I was hoping not necessary since I've started it with the commands below in a script I am trying to build to automate the process.
So I start with this:
POP-Test-01
10.10.10.10
And I'm trying to get to this:
POP-Test-01
10.10.10.10
User: User01
Pass: Pass0101
awk '/([0-9]{1,3}[\.]){3}[0-9]{1,3}/{print;print "User\:
Train";next}1' DeploymentDetails2.txt | tee DeploymentDetails2.txt<br/>
awk '/User/{print;print "Pass\: Training";next}1'
DeploymentDetails2.txt | tee DeploymentDetails2.txt<br/>
awk '/Pass/{print;print "\n";next}1' DeploymentDetails2.txt | tee
DeploymentDetails.txt<br/>
This appears to produce what you are looking for:
#!/bin/bash
HOST="POP-Test-"
IP=10
for i in {01..99} ; do
echo ${HOST}${i}
echo "10.0.10.${IP}"
echo "User: User${i}"
echo "Pass: Pass${i}${i}"
echo
let IP++
done
As you did not specify that there was an input file, I took the liberty of generating the ending number in the script, and reusing it in the user and pass lines.
I have read the documentation related expect module on here
I'm trying to add a CentOS7 to 2012 AD Domain controller, here is my playbook,
- name: Attempt to join the server to AS
expect:
command: realm join --user=admin#mydomain.local mydomain.local
responses:
(?i)Password for admin#mydomain.local: abc123
Ansible playbook fails, saying the password is incorrect, is this the correct way of using expect?
Have you try to incapsulate the password in quotes like so?
(?i)Password for admin#mydomain.local: "abc123"
I want to share my answer for question in title, which I can't find quickly.
There many topics how to disable password auth at all:
UsePam yes # it will not be used
ChallengeResponseAuthentication no
PasswordAuthentication no
kbdInteractiveAutentication no
but no topics how to enable for paticular user:
Match User myuser
PasswordAuthentication yes
KbdInteractiveAutentication yes
Also useful command to test sshd config is:
sshd -T -C user=myuser,host=127.1,addr=127.1
Please, note that "127.1" will not work on every system, so you may need paste 127.0.0.1 here.
If it is not about password authentication specifically, you could force usage of pam_access.so and have your /etc/security/access.conf look like so:
+ : myuser : <ip/net here or ALL>
- : ALL : ALL