Sending request to WinAppDriver (WebDriver) using Postman - selenium-webdriver

Recently I was attempting to use an xPath query to find a set of elements within my Windows Universal application. I was using WinAppDriver to automate the tests. The specific challenge was that due to the nature of the application and the automation it would take 60-90 seconds to automate my application to the point where I could execute my xPath query. Since I am not terribly familiar with xPath queries I needed to identify the desired query via what can only be described as a trial and error process. The combined time of making a code change, rebuilding the application and then running the app until the point where the xPath query was evaluated meant that it took me a few minutes per iteration and the process was very slow. I decided that it would be much more efficient if I could set a break point in the test code, execute the code to the point where the application under test was in the desired state and then use Postman to execute multiple queries while I figure out the exact query I need to be running.

It is possible to send Appium or Selenium requests to a WebDriver compatible service. This approach is not recommended as an alternative automation technique but can be convenient to debug specific commands.
The steps are outlined below:
Create a new Postman environment to contain your WinAppDriver requests
Create a new request tab within this environment
The URL for WebDriver requests should be of the following form “http://[ip address:port]/session/{{sessionID}}/[command].
The ip address should match the WebDriver address used when launching your WebDriver service. Typically, this is 127.0.0.1 by default
The port is the port specified when connecting to the WebDriver service. By default, this is typically 4723 but it can be specified at run time when you launch the WebDriver service on your local machine.
The session id can be found in the WinAppDriver console window
The screen shot below shows a capture of a WinAppDriver command. The first circled area is the Session ID value that should be used in the query above. The second circled area is the ip address and the port ID value and the third area is the query body that was sent. This query body corresponds to the WinAppDriver command.
The corresponding Postman query would look like the screen shot below.
I set the Content-Type to be “application/json”. Note that the last line in the screen grab above is the response content and contains the session variable again along with the element ID of the discovered element.
The [command] value and any optional query body is specific to the desired command. The best way to figure that out is to run the desired command from within your automation software and refer to the WinAppDriver output to see the command that is getting sent. Typically, I set a breakpoint in the debugger on the line I want to execute and then single step through that command while looking at the WinAppDriver output window. This lets me determine exactly the output corresponding to my command. You can then send multiple command from PostMan while the test application is stopped in the debugger. Do not close the test application until you are done because this will free up the session connection.
This approach lets you quickly try different iterations of the desired command and see if WinAppDriver finds the desired control

Related

Does JMeter scripts actually creates records in database

Let's say I run a recorded script for 'New User Registration' function of a web site to evaluate the response time for entire scenario. When I run the recorded script from JMeter, for each registration script, is there a new user record getting created in the application database ?
Yes, if you record registration and correlate it (meaning you create a valid unique name for every request) you will create a real user in your environment.
JMeter is simulating a real scenario which effect your environment.
That is part of the reason JMeter will be executed in different environment than production (as stage)
Well-behaved JMeter script must represent a real user using a real browser as close as it is possible.
Browsers execute HTTP requests and render the response
JMeter executes the same HTTP requests but doesn't render the response, instead it records performance metrics like response time, connect time, latency, throughput, etc.
HTTP is a stateful protocol therefore given you execute the same request you will get the same response. So if there are no mistakes in your script it either should create a new user or fail due to non-unique username error.
Yes, if your script accurately represents the full set of data flows associated with the business process, "New User Registration," then the end state of that process should be identical to that of the user behavior so modeled.
A record will be created in the database. If not, then your user is not accurate in its behavior

Load testing a Google App Engine Application using JMeter

I've created an application and I'd like to test how well it scales to large numbers of users.
To run my application a user has to go to the homepage, sign in to a Google account, click a button and then upload a video file.
First of all, is this possible to emulate using JMeter? I'm signed into my Google account locally but am not sure whether simulated users will have access to it?
Secondly, I've recorded a session in JMeter doing the actions above and have run the test with 10 simulated users, however, the App Engine dashboard doesn't detect any activity. I've followed the steps mentioned here but obviously with details of my application etc.
Here's a screenshot of the summary report.
Is there anything obvious I might be doing wrong? Am I using JMeter in the correct way to test the application as desired?
Apologies for my JMeter inexperience.
This is not something you will be able to record and replay, my expectation is that your application is protected by OAuth so you will need some token in order to execute your calls.
Not knowing the details of your application implementation it's quite hard to guess what's went wrong, I would recommend
Running your test with 1 user and 1 loop first to ensure that it's doing what it is supposed to be doing by adding View Results Tree listener and inspecting request and response details for each sampler (especially for failed ones).
Once you figure out what's wrong with this particular request - amend JMeter configuration so it would be successful. Repeat until you're happy with the test end-to-end.
Add load only after that and be careful as test might be sensitive to extra users/loops, especially if you're using a single login account (which is not recommended)
References:
How to Handle Correlation in JMeter
How to Run Performance Tests on OAuth Secured Apps with JMeter

methods to get website loading time for each step during execution of selenium scripts?

I'm working on an automation using selenium, but the application on which I'm testing was not always good, I need to get the response for the elements to load on each page so I can clearly get the actual execution time of the script. Is there any way to get such results?
you can try to record the HTTP traffic to create a HTTP Archive (HAR) and analyse this.
this link could be worth a read

Nagios3 configuration for sending simple text message on some port

I am developing an application and decided Nagios3 for performing monitoring stuff. But I am stuck at two points. I am using check_http plug-in for monitoring load on my service api. Now I want to perform below tasks.
I need to set a threshold in check_http for performing some task after crossing that threshold. I tried below command
'check_command check_nrpe_1arg!check_service_api'
but it only tells me the load, not any threshold is set. while below one doesn't work.
'check_command check_service_api!100!200'
I need to send simple text message on some port(my application).
I am new to Nagios, so please help me figuring out the solution except email notification stuff.
There is a check command that you can download called "notify_sms" that integrates with an API server hosted by a company called Esendex. They charge for their service but it works well.

Selenium Grid 2 - API version of /console page

I am writing a status monitoring page for our test environment and would like a list of individual selenium/webdriver nodes which are registered with the Grid server. I can do this by scraping the information on /console but I was wondering if there is an api-like way.
Basically I'm looking to do obtain output similar to that of TestSessionStatusServlet but for all registered nodes.
Mark
I don't think there's currently anything shipping in Grid that provides that. However, you can register your own servlet when you start the hub up. If you subclass org.openqa.grid.web.servlet.RegistryBasedServlet you'll have full access to the Registry and can pull out any info that you need. I've done something very similar so I could audit when a node goes down.

Resources