Trending March 2024 # Vugen(Virtual User Generator) Script Example In Loadrunner # Suggested April 2024 # Top 5 Popular

You are reading the article Vugen(Virtual User Generator) Script Example In Loadrunner updated in March 2024 on the website Moimoishop.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested April 2024 Vugen(Virtual User Generator) Script Example In Loadrunner

What is VUGen?

VUGen (Virtual User Generator) is a key tool in LoadRunner to create testing scripts to emulate real-user behavior on your system. In VUGen, a human is replaced by a virtual user (VUser) and the actions performed by a VUser are recorded in VUser script to emulate the real-user behavior for testing and monitoring.

VUGen is one of the four core components of LoadRunner. It is the first component you interact with when getting started with Performance Testing using HP LoadRunner.

Let’s understand a few salient features related to VUGen

VUScripts: As already described, the purpose of VUGen is to create VUScripts that are used to simulate a real-like virtual-user.

Actions: An action is set of user transactions performed in the System Under Load to achieve a defined task. An action can be compared to a function in other programming languages. Each Vuser script has 3 default functions

Vuser_init(used to login into the application)

Action (used to record the business process)

Vuser_end (used to logout of the application)

VUGen not only records scripts but also replays them (for only 1 VUser) to ensure script is recorded correctly. Once you ensure the script is recorded correctly you incorporate it in a LoadRunner scenario

In this tutorial, you are going to study

The script development process in VUGen

1. Record the Script: Usually, this is the first step of scripting where every user action is recorded into a script.

2. Replay and Verify: Once the script is recorded, reply the script to ensure its working right. Verify any impact through application frontend or database.

3. Enhance the Script: Once recording has been verified, enhance script by adding checkpoints, validating data, adding transactions and rendezvous points.

4. Replay and Verify: As earlier, re-play your script and verify that everything is working as intended.

5. Configure Runtime Settings: Configure and control pacing duration, think time variation, proxy settings and whether you wish to ignore any external resources.

6. Use for Load Scenarios: Formulate load scenarios based on test objectives. Use load distribution and geo-wide agents to make real like scenarios.

Compare recording between QTP and LoadRunner

VUGen disregards UI Objects:

Unlike QTP scripts, LoadRunner scripts are independent of GUI. This is because the code generated does not work based on UI objects, rather, it works on the principal of client’s request to the server and expecting server response back to the client. This is why replaying LoadRunner scripting is always browser independent. The VUser can communicate directly with a server by executing calls to the server API-without relying on client software (SUL) this means there will no impact on scripts if the changes are made to the UI of the System Under Load. This tells; the Performance Testing is completely based on client/server communication (request and response) and not the GUI objects.

We will see in more details how VUGen scripting works below.

Introduction to Web Tours Application

For all hands-on purpose, we will be using the Web Tours Application that comes bundled with LoadRunner.

Once the “server” has been activated, it will open a shell and output on the console.

The console should look like snapshot below, look for your IP address in the shell:

NOTE: if you close this window, the server will stop.

Now you can access the Web Tours Application –

Once launched, it will look like –

Understanding the VUGen Environment

VUGen splash screen will appear as follows

The splash screen will subsequently open HP Virtual User Generator Home page, as shown below:

From the File menu, you can observe various command controls. The purpose of these controls are mentioned below:

New Script and Solution: is used to start creating a new script. Alternatively, you can create a new script from the toolbar button.

We will get acquainted with other controls as we start creating our first script. Let’s continue learning.

Creating Your First VUGen Script

Before you record, make sure the Web Tours App server is running. Remember, you need to keep the server running so do not close it. If the window bothers you, you can minimize it.

Tip: In a real-world problem, one needs to get acquainted with the subject application (SUL) especially if it involves complex business workflows and data stages. You can also interact with HP Web Tours to ensure you can repeat the exact steps when recording.

Before one can start with scripting of any application (SUL), one needs to get acquainted with the application flow. With this tutorial, let’s get acquainted with HP Web Tours which is shipped and automatically installed with HP LoadRunner.

You can use the shortcut (Ctrl + N) to do the same.

Step 2) A window to select the protocol is shown. The list looks slightly different from previous versions

1. Select Single Protocol

2. Web

3. Enter Script Name

Note: You can use Protocol Advisor to determine right protocol your application uses for communication. For HP Web Tours, we already know that it requires “Web – HTTP/HTML” protocol. We will learn at a later stage how to determine the right protocol for your SUL.

Tip: An application may require more than 1 Protocols sometimes to communicate with its server. For such a case, navigate to Multiple Protocols list on the left side of window.

HP Web Tours, however, requires only one protocol when scripting with VUGen.

Tip: You cannot rename your scripts easily, so be creative when giving your scripts a name. If you’ve to rename a script, use Save As feature and give a new name. A good nomenclature could be something like WT01_Signup where WT is a short form of the application name, 01 is a business process sequence, and Sign up refers to the business processes being scripted. Also, note that you cannot use spaces in a script name.

Step 5) a new window opens

1. If we study the above window, the name of the script is mentioned in the title bar of this popup. This will help you make changes to the right script when you are dealing with multiple scripts opened at a time.

3. Record into the action field determines where the code is generated after recording. VUGen scripts facilitate switching to other actions or creates new actions during and after recording.

4. Record: field tells VUGen that the subject application (SUL) is a web application or a desktop client. This option cannot be overridden once recording begins.

5. Application: field tells VUGen, which browser to use for recording. If you are not working with Web – HTTP/HTML protocol, you will select the desktop client with this field.

Tip: Unlike QTP scripts, LoadRunner sample scripts are independent of GUI. This is because the code generated does not work based on UI objects, rather, it works on the principle of client’s request to the server and expecting server response back to the client – usually, in the form of HTML (hence the name of a protocol)

8. Working Directory: This is a temporary directory which VUGen will use while capturing events. A copy of your script will be available at this location as well, just in case if you lose your folder 🙂

9.Recording Options: These settings tell VUGen what type of URLs to capture and what recording mode to use.

Step 6) Once recording starts, VUGen will invoke the HP Web Tours application using the browser selected.

Let’s understand with a LoadRunner scripting example to Sign up a user at Web Tours application and record a basic script.

A floating recording bar will appear which will offer various controls over recording. This tells the time elapsed and a number of events automatically captured. Let’s look at the floating bar closely.

In the snapshot shown above, the SUL has fired 56 events and a total of 0 minutes and 25 seconds of time duration has elapsed since recording began.

You’ll also observe that no events are fired as you type. Ask yourself why. Can you answer?

Recording can be pause

using the pause button. Please note, as long as the recording remains paused, all events being fired by the application will be disregarded. This also means that even if your application is sending requests and/or receiving response form SUL, the script will not be generated as long as you’ve paused the recording.

button from the floating bar to resume recording.

While you are recording in vuser_init section, you’d notice that rendezvous button is not enabled. Switch to Action (or create a new Action) and continue recording. Refer to below snapshot to learn how to switch Action.

You’ll notice that after switching to an Action, the rendezvous

button will be enabled automatically. This is because VUGen does not allow insertion of rendezvous points in vuser_init.

Using Transactions at Record Time

button will be enabled automatically. This is because

Let’s assume you wish to gauge response time when X number of users simultaneously Sign up. To address this objective, let’s read further.

By now you’ve recorded opening of the application in vuser_init action. After you’ve switched to Action, enter the user information required by SUL. Now before you hit “Continue” button, follow below steps:

in floating bar. Enter the name of the transaction, for example, 01_Signup.

Tip: It is a good practice to name your transaction with a prefix like 01_ to help keep them unique.

The floating bar will look like this:

If you do not have multiple transactions opened, you’ll see only one name. If you’ve multiple, however, you’ll 0be able to select from the list.

Insert Comments at Record Time:

Code Generation:

Immediately after VUGen finished “Performing post generation operations” it will start “Performing scan for correlation post generation operation” We will see in more detail what correlation means.

Once post generation operation is finished, you will see Design Studio window. If any candidates for correlation are found, you’ll be able to review them in this window.

The window will look like this:

As highlighted in the above figure, the editor contains easy to understand, readable code. You can have a look on the parameters used while recording.

The left side of VUGen is called Step Navigator that lets you understand the “script” without looking at the granularities of the code. For example, you can read steps as, opening a URL, spend Think Time and submit the form. This encapsulates all the parameters associated with each request.

All done.

Now, congratulate yourself for having your first script successfully generated and saved.

Deciding a Protocol and Protocol Advisor

You might have questioned yourself why did we use Web – HTTP/HTML protocol. How did we decide which protocol should we use? The answer is not that simple.

There is an architectural foundation set of skills you need to have in place as a prerequisite to answering this question. If you are a beginner, you can pair up with someone who has solid client-side architectural and development skills for your SUL. You can speak with the developers of your SUL and find out which interfaces your application leverages. This should lead you on a natural path to the interfaces that you will be using for your virtual user script development and protocol selection.

Refer to snapshot below:

This will open the main window of Protocol Advisor. If you notice, this resembles a bit with the window appearing for recording. Let’s have a look at the window below:

Select the Web Browser since we are using a web-based application.

Specify the URL of the application that will subsequently be invoked. Working directory can be left as such since this is merely a temporary directory for VUGen to use. Ensure you’ve read and write access on this directory.

A floating bar, somewhat similar to the record time floating bar will appear. Have a look at the snapshot:

The process will tell the time elapsed and a number of events fired. However, this information is not necessary. The only benefit of this events counter is, you know your client, SUL, is communicating with the server.

It is a good practice to analyze only one business process at a time since the various business process in a large enterprise application may involve various protocols. For example, a dashboard in some application may have Ajax or Flex, etc. but this will not be present on the login page.

You can see the suggestions from Protocol Advisor. These may or may not be the best choices to pick.

You’ve learned to use Protocol Advisor by now. However, this could be helpful for beginners or for a situation where you need “another opinion” – rely on your architectural sense, programming knowledge, development skills and information received from the development team to decide on the protocol.

Recording Options

Whenever VUGen generates a script, the code generated is based on various configurations that can be found under the “Recording Options” – or you can press Ctrl + F7 to view the Recording Options in LoadRunner.

Let’s have a look at recording options window before we discuss all configurations:

There are various categories of configurations like General, Correlations, Network and Data Format Extension. Let’s understand most significant among these, one by one.

This topic requires detail understanding. Hence this is discussed separately.

Have a look at the snapshot for a glimpse:

You’ll notice that Language dropdown is disabled. A common myth is that the LoadRunner does not generate code in any other language. Another myth is that it requires a license to work in other languages.

Both are false. LoadRunner decides for itself which language to use when generating the script. In almost all cases, you’ll find yourself working with C Language.

For certain Java applications (like Java applets) the code being generated will be in JavaScript Language.

VUGen will generate a script in VBScript Language only for applications developed in Visual Basic classic (MS Visual Studio 2002)

Scripting Options:

You can opt to “Generate fixed think time after end transaction”. This means, no matter how much a user wait, the think time generated (the delay) will be equal to value specified. The value is in seconds.

A maximum number of lines in the action file refers to the maximum number of lines VUGen will generate an action. If the script is larger, VUGen will automatically create a new action. The default is set to 60,000. The maximum value which can be specified is 65,000

You may find this configuration helpful when dealing with a desktop application with Oracle on the backend.

Essentially, this will be used only when you wish to Re-Generate Script.

Have a look at the screen:

This is helpful when you’ve used multi-protocols at the time of recording a script. You can regenerate the script and deselect the protocols you don’t wish and get a new script without having to re-record it.

Have a look at the snapshot below:

This configuration tells VUGen to find candidates for correlation at record time. If you do not wish for Automatic Correlation, then you might wish to turn off this feature.

Have a look at the screenshot below and familiarize yourself with the screen.

This frame offers various settings related to HTTP binding.

Reset context for each action, enabling this option instructs VUGen to reset all HTP contexts between actions to their initial state before recording, providing a clean beginning for the recording session. The option is enabled by default.

You can leave the rest of configurations intact unless required.

This frame should be left intact. If you’re recording a desktop application, then you may have to choose WinINet level data.

You can go to Options (as long as you’re using Socket level data) and select various options like SSL version or other types of Secure Socket Layer. If you’re a beginner level or do not require these options, you can skip. Have a look to get yourself acquainted with the screen.

Now you’re done with most of the Record Time options, let’s move to the next topic and understand the difference between HTML and URL based scripting.

Difference between HTML-based and URL-based Scripting

You may have noticed an option to pick either HTML-based script or URL-based script. Have a look at the snapshot for a flashback.

So what is this option and which one to pick?

The HTML-based script is based on user actions, and the scripts contain functions that correspond directly to the action taken. Let’s understand example of a small piece of code:

Example:

web_link(“Enterprise Systems Performance", "Text=Enterprise Systems Performance," "Snapshot=t4.inf", LAST);

The URL-based script is based on HTTP requests sent to the server as a result of user actions.

Here is an example of code for URL mode for the same actions performed as above (in HTML mode)

Example:

web_url(“Enterprise Systems Performance", "URL=/esp.html", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=/atc?. . . , "Snapshot=t4.inf", "Mode=URL", LAST);

Tip: It’s best to experiment yourself before you move forward. Change the record time settings and record the same script twice i.e. once with HTML mode and once with URL mode – then compare both. Keep the script short so you can understand the difference.

How do we decide on which mode to use?

Let’s understand the pros and cons of both modes so understand which mode is more suitable under certain situations:

Benefits of HTML Recording

Reduces need to capture dynamic values

Action tag values and hidden data are NOT hardcoded

They are retrieved from memory during playback

If they are dynamic, the VUser still run

Script is only as big as the business process–one step per page

Scripts are less scalable

Memory (cache) is searched during playback

requires more memory

requires more CPU power

Benefits of URL Recording

Flexibility

Support for Java Applets and ActiveX objects on the page

Ability to replay on UNIX

Scalability

Scripts are more scalable than HTML scripts because they require fewer resources

Scripts require more correlation (nothing is retrieved from the cache)

Context-sensitive checks won’t work (parser is disabled)*

Scripts are large (all images and frames are recorded as separate steps)

Here is a quick illustration:

HTML Mode URL Mode

Intuitive and easy to understand. Not as intuitive as the HTML scripts.

Scripts are smaller, requests are encapsulated and easy to understand. Scripts are large, containing a call to each image, css, html, etc. thus making it difficult to understand.

Scalable. More scalable and effective for creating a load test.

Use of Re-Generate Script

Let’s suppose you want to record the same script you just recorded, but with different record time settings. In such a case, you can use the regenerate script feature.

Playback a Script and understanding Log

in the toolbar to replay or hit F5.

You can find this button in the toolbar:

You need to ensure the server is running (which is required for application to work properly)

When you replay the script, you’ll notice that unlike QuickTest Professional, it doesn’t open any browser to replay. Remember, this execution will simulate only 1 (single) user load on the SUL. The purpose of this execution is to ensure your script is working.

Tip: You’ll need to verify the impact from the application itself. For example, if you’re creating a record, go to the application and verify manually that your script actually created a record. Your scripts, most likely, will not be tested by yet another Testing or QA team so you need to be very careful with your script and ensure these are thoroughly tested.

You can leave the replay log active since this will be a great help in identifying candidates for correlation and any errors and warning you might come across. Since generating log takes ample resources, it is best-turned off when you’re done with debugging of scripts and using them for scenarios.

Overview of Files Generated During Record & Playback

Let’s close the VUGen and have a look at the files it has created in the script folder.

VUGen creates a series of configuration files, data files and source code files which contain VUser run-time and setup information. The results of each iteration of the script are stored separately. If you’ve executed your script at least once, you will notice a directory by the name result1. This directory is for system use and should be ignored by the tester.

Important files which you need to understand:

VUGen will create one .c (C Language Code file) for each action. Thus, at the last, you’ll have vuser_init.c and vuser_end.c and Action.c – if you’ve more actions created, you will see corresponding files too. For example, myAction.c

The replay log is saved in a file called chúng tôi If you’ve replaced it multiple times, chúng tôi will contain the last execution log whereas, chúng tôi will contain previous to the last run.

You will see a folder named “data”. This folder keeps an image of the events as well as a copy of your code. VUGen makes use of these files when you “ReGenerate” your code.

You're reading Vugen(Virtual User Generator) Script Example In Loadrunner

Cyclomatic Complexity In Software Testing (Example)

What is McCabe’s Cyclomatic Complexity?

Cyclomatic Complexity in Software Testing is a testing metric used for measuring the complexity of a software program. It is a quantitative measure of independent paths in the source code of a software program. Cyclomatic complexity can be calculated by using control flow graphs or with respect to functions, modules, methods or classes within a software program.

Independent path is defined as a path that has at least one edge which has not been traversed before in any other paths.

This metric was developed by Thomas J. McCabe in 1976 and it is based on a control flow representation of the program. Control flow depicts a program as a graph which consists of Nodes and Edges.

In the graph, Nodes represent processing tasks while edges represent control flow between the nodes.

Flow graph notation for a program:

Flow Graph notation for a program defines several nodes connected through the edges. Below are Flow diagrams for statements like if-else, While, until and normal sequence of flow.

How to Calculate Cyclomatic Complexity

Mathematical representation:

Mathematically, it is set of independent paths through the graph diagram. The Code complexity of the program can be defined using the formula –

V(G) = E - N + 2

Where,

E – Number of edges

N – Number of Nodes

V (G) = P + 1

Where P = Number of predicate nodes (node that contains condition)

Example –

i = 0; n=4; while (i<n-1) do j = i + 1; while (j<n) do if A[i]<A[j] then swap(A[i], A[j]); end do; j=j+1; end do;

Flow graph for this program will be

Computing mathematically,

V(G) = 9 – 7 + 2 = 4

V(G) = 3 + 1 = 4 (Condition nodes are 1,2 and 3 nodes)

Basis Set – A set of possible execution path of a program

1, 7

1, 2, 6, 1, 7

1, 2, 3, 4, 5, 2, 6, 1, 7

1, 2, 3, 5, 2, 6, 1, 7

Properties of Cyclomatic complexity:

Following are the properties of Cyclomatic complexity:

V (G) is the maximum number of independent paths in the graph

G will have one path if V (G) = 1

Minimize complexity to 10

How this metric is useful for software testing?

Basis Path testing is one of White box technique and it guarantees to execute atleast one statement during testing. It checks each linearly independent path through the program, which means number test cases, will be equivalent to the cyclomatic complexity of the program.

This metric is useful because of properties of Cyclomatic complexity (M) –

M can be number of test cases to achieve branch coverage (Upper Bound)

M can be number of paths through the graphs. (Lower Bound)

Consider this example –

If (Condition 1) Statement 1 Else Statement 2 If (Condition 2) Statement 3 Else Statement 4

Cyclomatic Complexity for this program will be 8-7+2=3.

As complexity has calculated as 3, three test cases are necessary to the complete path coverage for the above example.

Steps to be followed:

The following steps should be followed for computing Cyclomatic complexity and test cases design.

Step 1 – Construction of graph with nodes and edges from the code

Step 2 – Identification of independent paths

Step 3 – Cyclomatic Complexity Calculation

Step 4 – Design of Test Cases

Once the basic set is formed, TEST CASES should be written to execute all the paths.

More on V (G):

Cyclomatic complexity can be calculated manually if the program is small. Automated tools need to be used if the program is very complex as this involves more flow graphs. Based on complexity number, team can conclude on the actions that need to be taken for measure.

Following table gives overview on the complexity number and corresponding meaning of v (G):

Complexity Number Meaning

1-10

High Testability

Cost and Effort is less

10-20

Medium Testability

Cost and effort is Medium

20-40

Low Testability

Cost and Effort are high

Very high Cost and Effort

Tools for Cyclomatic Complexity calculation:

Many tools are available for determining the complexity of the application. Some complexity calculation tools are used for specific technologies. Complexity can be found by the number of decision points in a program. The decision points are if, for, for-each, while, do, catch, case statements in a source code.

Examples of tools are

OCLint – Static code analyzer for C and Related Languages

Reflector Add In – Code metrics for .NET assemblies

GMetrics – Find metrics in Java related applications

Uses of Cyclomatic Complexity:

Cyclomatic Complexity can prove to be very helpful in

Helps developers and testers to determine independent path executions

Developers can assure that all the paths have been tested atleast once

Helps us to focus more on the uncovered paths

Improve code coverage in Software Engineering

Evaluate the risk associated with the application or program

Using these metrics early in the cycle reduces more risk of the program

Conclusion:

Cyclomatic Complexity is software metric useful for structured or White Box Testing. It is mainly used to evaluate complexity of a program. If the decision points are more, then complexity of the program is more. If program has high complexity number, then probability of error is high with increased time for maintenance and trouble shoot.

Use (Dot Slash) To Execute Script File

Overview

In this tutorial, we will see how to execute a file using the / (dot slash) command in Linux. This is one of the most commonly used commands in Linux and it’s very easy to use. Let us first understand what does the dot slash mean?

What Does Dot Slash Mean In Linux Commands?

The dot slash or the forward slash (/), as you may know, is used to separate directories from files. For example: If I have a directory called “/home/user1/Desktop” then when I type ls -l on that directory, it would show me all the contents of that directory like below −

-

rwxr

-

xr

-

x

1

user1 user1

0

Jun

12

19

:

09

Desktop

If I want to list only the files inside that directory, I can do so by typing ls –l /home/user1/desktop. The above command will give me the same output as shown below −

drwxr

-

xr

-

xs

2

user1 user1

4096

Jun

12

19

:

09

desktop

Why Do We Need ./ To Run a File?

We’re going to use the command line to execute the chúng tôi file. We won’t mention any paths.

$ script

.

sh

-

bash

:

script

.

sh

:

command

not

found

Since we’re in the same directory as chúng tôi Bash was able to find the chúng tôi file. However, since the chúng tôi file doesn’t exist, we must tell Bash where to look for the chúng tôi file by specifying its location.

When using Linux, the. (dot) symbol indicates the current working folder. Now let’s say we want to run our script from within the current working folder.

$

./

script

.

sh

The

program run successfully

.

Note the forward slashes (/). Forward slashes are used to denote directories in Unix/Linux systems. They’re also used to separate filenames from each other. In our case, they’re used to separate the script filename from chúng tôi extension. Without them, we’d end up with a file named “./script.sh” instead.

Now it’s time to answer our previous questions. Why do we want/require to add our current directory to $PATH? Because our current directory isn’t included in $PATH.

System Executables vs. User Executables

The $PATH variable typically contains a path for each directory where programs reside. Let’s take a look at its typical contents −

$ echo $PATH

/

usr

/

local

/

sbin

:

/usr/

local

/

bin

:

/usr/

sbin

:

/usr/

bin

:

/sbin:/

bin

:

/usr/

local

/

games

:

/usr/

games

$PATH is used to specify where the system commands (like ls) are located. On Linux systems, the shell searches for the command in the directories listed in the $PATH environment variable. If the command isn’t found there, then the shell tries to run the command from the current directory.

$ ls

File1

File2

log

If there are multiple paths containing an executable, Linux will choose the first one found in $PATH.

You can also use which to obtain the full path of any program that can be run by typing its name at the shell prompt.

$ which ls

/

bin

/

ls

Search Rule

When searching for executable files in Linux, there is a command called which that helps us remember one important thing −

If the slash (/) character is present in the file name, don’t search for the file in $PATH.

If the slash is NOT in the PATH variable, then search only within the current directory.

We can have scripts with the exact same names of commands, for example, and execute them in the current directory with no conflicts.

For example, let’s say we want to write a shell command called “ls” which lists files in our current directory. We could then type the following into our terminal window −

$

./

ls

This is a sample script for ls.

Because we specify “/” before the filename, Bash will search for the specified filename in the current working directory.

You can also use the system command “ls” to list all files and folders in the current folder.

$ ls

File1

File2

log ls

If we run the command without any arguments, Bash searches for files in the directories listed in the $PATH environment variable.

You can add the current working dir (“.“) to the $PATH environment variable by exporting it, but it’s best to avoid doing so because it may lead to security issues.

Security Issue When Including . in

$

PATH

$ ls

This is a sample script for ls.

If we run ls −l, we want to be sure that we’re really running the ls command, and not some other executable called ls. Someone could put malicious code into an ls executable to delete our file or change its contents. So this is a potential security threat.

We can add “.” to our $PATHS variables so that the system commands `ls` and `grep` will both work. However we may still run into some security issues.

If we type “sl” into our terminal, instead than receiving an “illegal command” or “command not found” response, there may be a malicious program called “sl” in the current working folder that we’re unaware of.

$ sl

This could be a virus.

Windows vs. Linux

By default, the Windows PATH variable holds the current directory. So, when you run a program from the Windows console, it looks for programs in the current directory before looking elsewhere.

Unlike Windows, where the current directory is automatically added to the system’s $PATHS variable, in Linux, the current directory isn’t automatically added to the system’s $PATHS variable. To include the current directory in the system’s environment variables, we must manually add it to the system’S $PATHS variable using the export command.

Conclusion

We learned to use “./” for executing shell commands in the current working dir. Because the current directory isn’t in the $PATHS variable, we must either specify the relative or absolute paths to the files. We then went through the search rule in Linux, which explains how to use grep command to search for We discussed some security risks that might occur if we added “.” to the $PATH environment variable.

Finally, it‘s always better to explicitly specify where we want to run our executable files. It’d be a good idea to check whether the PATH environment variable includes “.” when running multiple user accounts.

Example And Lease Payment In Income Statement

Definition of Lease Payment

Lease payment is the sum paid by the user of the asset (lessee) to the owner of the asset (lessor) for the right to use the asset over a period of time and as per the lease agreement. Lease payment is also called lease rental and is paid for a fixed period of time which is called a lease term.

Start Your Free Investment Banking Course

Download Corporate Valuation, Investment Banking, Accounting, CFA Calculator & others

Explanation

There are so many factors that influence the calculation of lease payment like asset value, depreciation, discount rates, lessee’s credit score, and finance cost. Lease payments are generally done on monthly basis. It is like rent paid to use an asset. A leased asset can be a car, property, computer equipment, software, or any fixed asset.

How to Calculate Lease Payment?

To calculate the lease payment, we need three components, Depreciation, Finance cost, and tax.

Step 1

(net Capitalized Cost – Residual Value) / Lease Term

Net Capitalized cost: The selling price of the asset including the dealer fee, taxes if any, and excluding the down payment and any outstanding loan balances.

Residual Value: The value of the asset at the end of the lease period.

Lease Term: The time period for which the lease agreement is signed.

Step 2

Finance Cost: These are like the Interest charges the lessee would have to pay on the money used against the loan financing. To calculate the finance cost, we will add the residual value to the net capitalized cost and multiply it by the discount rate/Money factor. It is calculated as:

(Net Capitalized Cost + Residual Value) * Money Factor

Money factor: It is the interest rate decided in the lease agreement. It is usually given per annum, we have to divide by 24 to get the monthly rate.

Step 3

Tax: It is the sales tax charged by the local or state government. It is charged on selling price and is calculated as:

(Depreciation Cost + Interest Cost) * Sales Tax Rate

Formula of Lease Payment

The formula of the lease payment is derived by adding the three components discussed above.

Lease Payment = Depreciation Cost + Finance Cost + Sales Tax

Example of Lease Payment

Lessee Ltd took a machine on lease from Lessor Ltd for a lease term of 60 months. The selling price of the machine is $60,000 with the residual value after 60 months $2,000. The rate of interest applicable is 5%. Lessor ltd also had an outstanding loan on the machine for $5,000. The applicable sales tax rate is 2%. Calculate monthly lease payment.

Here is the calculation of monthly lease payment:

Amount ($)

Machine Value 60,000

Residual Value 2,000

O/s Loan 5,000

Interest Rate 5%

Sales Tax Rate 2%

Lease Term 24 (months)

Depreciation Cost is calculated using the formula given below:

First, we have to calculate the net capitalized cost,

Net Capitalized Cost is calculated as

Net Capitalized Cost = Machine Value – O/s Loan

Net Capitalized Cost = 60,000 – 5,000

Net Capitalized Cost = 55,000

Now , Depreciation Cost is calculated as using the formula given below:

Depreciation Cost = (Net Capitalized Cost – Residual Value) / Lease Term

Depreciation Cost = (55,000 – 2,000) / 24

Depreciation Cost = 2,208

Finance Cost is calculated using the formula given below:

(Net Capitalized Cost + Residual Value) * Money Factor

First, we have to calculate Money Factor,

Money Factor = Interest Rate / Lease Term

Money Factor = 5% /24

Money Factor = 0.002083333

Finance Cost is calculated as using the formula given below:

Finance Cost = (55,000 + 2,000) * 0.002083333

Finance Cost = 119

Sales Tax is calculated as

Sales Tax = (Depreciation cost + Finance Cost ) * Tax rate

Sales Tax = (2,208 + 119) * 2%

Sales Tax = 47

Monthly Lease payment is calculated as

Monthly Lease payment = Depreciation Cost +Finance Cost + Sales Tax

Monthly Lease payment =  2,208 + 119 + 47

Monthly Lease payment = $2,374

Lease Payment in Income Statement

There are two types of lease, Operating Lease and Finance lease. The accounting treatment and recording of lease payment in the Income statement depend upon the type of lease.

Operating Lease: A lease is classified as an operating lease if it does not transfer substantially all the risks and rewards incidental to ownership. Lease payment is recognized as an expense in the Income Statement of Lessee in case of operating lease

Finance Lease: A lease that transfers substantially all risks and rewards incidental to its ownership is called a Finance lease.

The asset is transferred in the books of the lessee at a fair value or present value of minimum lease payments, whichever is less.

Depreciation is charged by the lessee in its Income statement over the lease term or useful life, whichever is less.

Lease Rentals constitute principle repayment and Interest, Interest is charged in the Income Statement.

Importance of Lease Payment

It is important to understand the lease payments in order to correctly record them in the books of the lessor and lessee.

Lease payment is one of the major factors to decide the type of lease, operating lease, or finance lease. For example:

A lease is a finance lease where the Present value of Lease Rentals is equal or approximate to the fair value of the asset.

Benefits

Below are some of the benefits of Lease payments:

Lease payments are mostly done on monthly basis. So, there is no major outflow to cash at one time like in the case of purchasing the machinery. So, it helps to maintain the liquidity of the company.

The money saved from leasing the asset instead of buying can be utilized in other areas which need investment.

The risk of an asset becoming obsolete due to a change in technology lies with the owner of the asset.

Lease payments are shown as expenses in the books of the lessee which reduces its income and further reduces the tax liability.

In case, the value of the leased asset gets appreciated, the user of the asset has no right to such appreciated value.

In the case of an operating lease, the asset is not shown in the balance sheet of the company and is considered as a long-term debt, which affects its valuation.

Lease payment being an expense reduces the net income of the company which in turn shrinks the income available for the equity shareholders.

Conclusion Recommended Articles

How Does Rsync Work In Linux With Example?

Introduction to Linux Rsync

Rsync is a utility in the command line which enables users to transfer and synchronize files efficiently between a computer and an external hard drive in the entire connected network. This utility is achieved by comparison of modification times and also the file size. This utility of the synchronization is written in C language, and this application executes as a single-threaded application. Another term you would hear a lot when someone talks about rsync is that this utility is a delta encoding. Delta encoding essentially a way of storage or transmission of data as a difference of the files or, in other terms, sequential data. This utility needs to be set up between the user and the host, and once the sync is set, thus utility will itself determine parts of the local file that needs to be transferred between them to keep the sync. In this topic, we are going to learn about Linux Rsync.

Start Your Free Software Development Course

Syntax

Before we even jump into understanding what scenarios rsync would help or the working principle of rsync, it is beneficial to understand the syntax behind the rsync. Then, while going through the working principle, we can keep the syntax in mind.

OR

The usage of any of the above syntax solely lies in the developer’s level of comfortability and confidence. Therefore, there is no benefit difference in using any syntax over the other. If you notice carefully, the difference only lies in the way the source address is mentioned, and each individual has their level of confidence on which one to be used, and hence the utility in the corresponding ways.

Here, SOURCE is the place where the files or directory will be copied from, and DESTINATION is the place where the files and directories get copied into. Now, these 2 parameters or arguments are the mandatory ones, whereas the ones in square brackets “[]” are optional and can be used as per the requirement of the functionality being developed. Next, we will talk about the majority of the options which are used extensively in the industry nowadays.

How does rsync work in Linux?

In the introduction, we already learned that rsync is a command-line utility that helps in synchronizing Unix clients present in the network. This utility comes in very handy in scenarios like backing up the files in a system to another system which is housed only for backing up the files. Rsync utility also has the capability to run in daemon mode, a mode that allows the application to run in the background rather than run under the active control of a user. Daemon mode out of scope for this article, but as an interesting fact, the syntax is read as: rsync://

From here, we will look at different OPTIONS we talked about in the syntax one by one, and we will try to accompany each OPTION or a combination of OPTIONS with a code snippet and the output that is expected corresponding to it!

OPTION Where will it be used?

-v, –verbose This option is used if the user wants to know what exactly the computer is doing while executing the command.

-q, –quiet If the user doesn’t need the output message, this option can be used for suppressing the outputs.

-a, –archive This option can be used to archive files when synchronization is taking place.

-r, –recursive For recursively syncing the files and directories, this option can be used.

-b, –backup While the synchronization is taking place, if the backup of the files or delta is needed, even if there is a loss in communication, data leakage can be minimized.

-u, –update If the user doesn’t want the files at the destination to not update if the files there are newer than the source, this option can be used to successfully implement the use case.

-l, –links This option is used in scenarios where symbolic links (symlinks) should be copied as symlinks only.

-n, –dry-run This option is used when we would need to do a trial run without actual synchronization. This is done so that we understand the use case we are trying to solve and if the solution implemented actually caters to the problem.

-e, –rsh=COMMAND When this option is used, an alternative remote shell program is used for communication between the remote and local copies.

-z, –compress To minimize the data consumption during synchronization, this option can be used to compress the file being sent.

-h, –human-readable To display the output in a human-readable format for interpretation, this option is used.

–progress When the sync’s progress needs to be shown as an output, this option comes in very handy!

–remove-source-files In some cases, one would like to delete the file at the source so that there is no duplication of the files and space can be kept optimized. This is the option to get that utility!

Examples of Linux Rsync Example #1

LOCAL COPY OR SYNC OF FILES

Code:

mkdir backup ls -l ./backup/ rsync -zvh chúng tôi ./backup/ ls -l ./backup/

Output:

In this scenario, we have utilized the combination of options listed above to have a verbose (-v) output during the rsync execution. In the highlighted version, the output is changed to a more human-readable format (-h). Also, during transfer, the text file was zipped (-z) so that the data transfer can be optimized to the maximum.

Example #2

Code:

ls -l rsync -zvh--remove-source-files chúng tôi ./backup/ ls -l

Output:

In the case of, we see that chúng tôi was present in the working directory in the initial instance. After the synchronization is complete, when we do an ls command, we see that the file has been moved from there to the new location as specified in the command, i.e. Backup.

Conclusion

In this article, we have gone through various options that are possible through the use of rsync in general. In cases of performing rsync on different IPS, only the user and the IP address of systems need to be added extra to complete the utility.

Recommended Articles

We hope that this EDUCBA information on “Linux Rsync” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

5 Best Midjourney Prompt Generator Tools Right Now!

With the abundance of AI tools, creating artwork is no longer a challenge as long as you enter the right prompts that compile all of your inspirations and thoughts into text form. While that may seem like an easy task, sometimes you may hit a roadblock if your initial spark of inspiration may have faded or you’re unsure of where to go next. 

The easiest tool to generate prompts on Midjourney is Promptomania (website). The tool lets you start your prompt with your desired concept that you can add via text or an image URL or both. After you’ve entered the input text, you can add other details to the prompt by selecting a “Base image” that you use to choose further styles and details.

You can find and select your preferred art medium, camera configuration, color palette, dimensionality, resolution and display characteristics, shapes and geometrical styles of subjects, lighting types, additional materials, and other intangibles within the “Add some details” module. If you don’t prefer customizing these values, Promptomania allows you to mimic a certain artist’s style based on your selected base image. 

Additionally, you can further customize the prompt with different Midjourney parameters and image sizes. Once you’ve chosen the desired styles and parameters, you can scroll to the top of the page to view and copy the generated prompt onto Midjourney. 

Related: Midjourney V5: How to Use It

Noonshot’s MJ Prompt (website) tool is a close alternative to Promptomania as it also offers a stack of preset settings and styles that you may need to create an AI art of your choice on Midjourney. You can start by entering your main concept inside the text box at the top and then follow it up by choosing different options and values to style the image in your own way. 

MJ Prompt hosts around 100 different options to help you find a style for the image you want to create like 16-bit, 1800s, cartoon, coral, cyberpunk, futuristic, pastel, pixel art, tropical, and more. You can add one or multiple styles for your prompt and the tool lets you set the accuracy level for each of your selected styles. 

In addition to styles, you have options to set a preferred lighting, camera view, artist’s style, color palette, materials, aspect ratio, depth of field (blur effect), quality (less or more detailed), and stylize (less or more artistic). Furthermore, you can customize your prompt with your own image to get inspiration from and add negative prompts to avoid seeing certain elements inside the creation. The final prompt will then be generated at the top of the page from where you can copy and paste it onto Midjourney. 

If you want a prompt generator that’s not clouded with many options but is more user-friendly, Jrnylist (website) might be perfect for you. You can start by adding a prompt in the text box at the bottom of the screen and then choosing an art style from the tabs at the top – Artistic, Illustrations, and UI & Icons. 

In terms of art, Jrnylist lets you select multiple medium types including B&W, oil painting, mixed media, vector art, and more. You can then combine them with your preferred styles from Nature and Landscape, and Portraits sections. Unlike the prompt builders above, your options are limited when you use Jrnylist as the tool aims to be simplistic and easy to use. 

Besides art, you can get prompts for creating illustrations, t-shirt graphics, UI mockups, and even icons with this tool. The only option to customize your prompt comes in the form of the Modified tool which lets you apply from an existing list of aspect ratios. 

Hugging Face’s Prompt (website) Generator might probably be the most minimal of the offerings listed here. When you load up this tool, you should see two boxes – the one on the left is where you enter a general idea or concept for the image you want to create and the one on the right is where you see all the prompts that are suggested by the tool based on your input. 

You can type in the basic concept for the AI art in English and when you submit it, Hugging Face will show you several versions of your idea inside the “Generated Text” box with different styles and elements in it. You can then copy any of the suggestions from this section onto Midjourney to find what kind of AI art is created using the input prompt. 

You can start by typing your concept inside the Main Idea box and then add secondary objects, negative prompts, and image URLs to structure the AI art around. You can then style your art with a set of tools including custom descriptors, camera view and setup, art medium, film adaptation, artist inspiration, game theme, color tone, lighting, and depth of field. 

(Bonus) PromptHero : Find prompts for the Midjourney images you like

While it may not essentially be a prompt generator, PromptHero (website) is a platform where you can browse through thousands of AI-generated images created on MidJourney with user-submitted prompts. You can use it to gain inspiration from the vast library of images available on the page.

That’s all you need to know about the best Midjourney prompts generator tools out there. 

Update the detailed information about Vugen(Virtual User Generator) Script Example In Loadrunner on the Moimoishop.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!