Skip to main content

Posts

Showing posts from November, 2017

Creating or Updating Users in htpasswd File

The Apache   HTTP Server is free and open-source cross-platform web server. It can be configured to protect either entire website or part of the website. Once the authentication is enabled, user will be prompted to enter credentials to access the web pages. It is two step process, first, we need to setup the user credentials, and second, we need to configure these credentials in Apache. In this article, we will be covering the first part i.e. setting the user credentials. We will be using htpasswd comand line tool to create and manage users. I would suggest to login a root user. Let's say, we will be storing user credentials in this file: /etc/.apache_users 1. Setup credentials for very first user 2. Add new user to existing file ( note: do not use -c option, if already exists, it is rewritten and truncated ) 3. Update password for existing user 4. Remove user from the file In next article , we will cover how to configure these credentials in Apache. P.S. Click...

Sublime Text 3 - Multi Select and Multi Edit

I use Sublime Text 3 text editor for viewing and editing files. Sublime Text offers various features. There is one important and useful feature - You can search and select multiple instances at one and replace them with a different text. For example, if you have text "-test" in multiple places in the document and if you want to replace the text with "-prod" at once for all the selected instances, then here are simple steps: Open the document in Sublime Text Select any string in the document, for my example I am selecting "-test" Now press: MAC: Command + Control + G Windows: Alt + F3 Now you will notice that all the occurrences are selected and highlighted Now hit Delete or Backspace Type different text, for my example I am typing "-prod" You can see that the text is now replaced with new value   P.S. Click here to access my other posts.

Postman - Storing and Retrieving Numeric Values from Environment Variables

If you are using Postman for your API testing and if you want to store and retrieve numeric values from environment variables, then here is a simple trick - use "Number" function. Let me explain the problem and solution. Problem: I want to store numeric value in environment variable, for example - response time, then I want to retrieve the value from this environment variable and use for comparison. Solution: To store response time in environment variable, use setEnvironmentVariable function To retrieve the value from environment variable, use postman.<variable_name> To convert variable value to number for comparison, use Number() function   P.S. Click here to access my other posts.

How to Extract Values from Response Header in JMeter?

JMeter is a powerful tool for API testing. Let's say you are are writing test cases for one of your RESTful service; and you want to extract and validate the value returned as part of response header. It is little bit tricky to extract the value from Response Header in JMeter , but it is possible. For example, your RESTful service returns "ETag" in response header. When you look at the raw response data, the value is displayed something like this: ETag: 2666d92fa9ebf10250acdb235546f045 To exact value of this reaponse header in JMeter: Right click on your HTTP request, then add Post Processor element - Regular Expression Extractor Select Radio button - Main sample only Select Radio burron - Response Headers Type some name in Reference Name section - for example, eTagVariable Type this expression in Reference Expression section - ETag:\s+(.+) IMPORTANT: This expression will select pick the ETag response header parameter and select everything after colon bla...