How to perform local testing with LambdaTest


21 Oct
21Oct

Talking about the website testing, we often find ourselves stuck on the software that only asks for URLs directly and then allows us to test our website. This creates a problem for many of the users especially freelancers, students and learners. If a person is learning to develop a website, as a next step, he will try to test it on various browsers to assure himself that whatever he developed was up to W3C standards and is rendering gracefully on every browser. But since we find so many tools demanding a published website, maybe a user is left with no choice but to first publish and then test (which is a really bad way to go chronologically). Publishing a website costs extra money and so does saving the web pages on the server. There is a better option though.

What if, we could test our website locally on our machine and then rectify all the errors and as the last step, publish it for the world? This is called local testing and this post will guide you through testing our website locally. We will be using a cross-browser testing tool LambdaTest because I find it simple, feasible and easy to use. You can use any such tool for your learnings. But before jumping on the exercise, let’s quickly run over the local testing and its advantages.

What is meant by local testing?

Local testing refers to the process of testing the website which is not yet published but is on the local system. Local testing leverages the resources from an online tool as a server on the cloud to run their websites as if the user is testing a published website. A user can think of his own system as a staging area and move ahead for testing the website. Using an online cross-browser testing tool that supports local testing can help the user test their website on hundreds of browsers and multiple operating systems including the mobile ones. In layman terms, local testing is cross-browser testing but for unpublished websites sitting on your local system. Other parameters remain the same.

How To Perform Local Testing Using LambdaTest?

In the following section, I will be testing a very simple two-page website on an online cloud-based cross-browser testing platform LambdaTest.

The following is the code for the homepage.html
<<!DOCTYPE html>

<html lang="en" dir="ltr">

 <head>

 <meta charset="utf-8">

 <title>Register</title>

 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

 </head>

 <body>


<center>

<form style="width:400px; margin-top:50px" action="success.html">

 <div class="form-group">

 <label for="exampleInputEmail1">Email address</label>

 <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">

 </div>

 <div class="form-group">

 <label for="exampleInputPassword1">Password</label>

 <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">

 </div>

 <button type="submit" class="btn btn-primary">Submit</button>

</form>

</center>

</body>

</html>

The following is the code for the registeredpage.html

<<!DOCTYPE html>

<html lang="en" dir="ltr">

 <head>

 <meta charset="utf-8">

 <title></title>

 </head>

 <body>

 <center>

 <h2>Login Successful</h2>

 </center>

 </body>

</html>


Now that we have our website ready on the local system, we just need to create a tunnel for local testing.

The tunnel is a feature in LambdaTest that helps in testing the website which is available locally and is not published or to test the private server URLs. LambdaTest tunnel takes advantage from the LambdaTest cloud servers and the user gets to benefit by testing the website on more than 2000+ browsers with the combination of OS, resolution and browser version he wants. The tunnel feature provided by LambdaTest is very safe and secured by SSH mechanism. Hence, the user need not worry about the data he is trusting on LambdaTest.

To create the SSH connection between the local system and LambdaTest system, the user needs to download the binaries for the same. Download LambdaTest Tunnel Binaries For Windows and install it on the system.

Visit LambdaTest for the binaries of Mac and Linux.

This file is supported for the below-listed windows:

Windows 10

Windows 8.1

Windows 8

Windows 7

Windows XP

After installing, jump to the LambdaTest platform and navigate to the Real-Time testing tab.

On the upper right corner, an option will appear as Configure Tunnel. Press that button to open up a small panel.

Copy the string by pressing the copy button as shown in the above image. Let the radio button pressed for “Internal Website” since we are moving ahead for local website testing.

Move over the shell of your system i.e. Command Prompt or Powershell on windows.

Change the current working directory from default to the one in which you extracted the zip file.

Paste the line of code that you copied above into the shell to execute the binary file.

Use your login username in place of {user’s login email} and key in place of {user’s access key}.

Note: If you are getting issues in executing the command such as “LT command not found” replace the LT word to .\LT and keep the rest as it is.

Accept all the permissions that prompt up once the command is executed.

The message of “Secure Connection Established” ensures that the tunnel is all set and we are good to go for testing part.


Move again to the real-time testing panel from where we configured the tunnel on LambdaTest. This time, the tunnel option will be enabled and the options to choose a tunnel will show up.

Since I want to use the tunnel, I will choose the LAPTOP-XYZ option (it will differ from your system).

Next, select the specifications on which you would want to run the web pages.

Enter the URL which you would like to run. Here, you need to be a little sure about the URL you are using. It would depend on the server you are running your web pages on. If you are using apache server then maybe localhost.com/page_name would do. So, be sure beforehand by running the URL on the local machine and use the same URL here.

In my demonstrations, I am using Django server and Django runs on localhost:8000 URL so I will be entering the same into the URL section.

Press Start to start the cross-browser testing on your local website using LambdaTest.

And as you can see, the tests are running on Microsoft Edge version 83 using Windows 10.


Local testing allows us to test our web pages on the local machine even though the website has never been published. This has multiple advantages as the user need not go through the process of publishing the website and then testing it for cross-browser compatibility issues. Since the testing (local or global) requires a browser matrix of hundreds of browsers, it is better to choose a good tool for this.

LambdaTest provides the local testing feature with what they call as the “tunnel” feature. Creating a tunnel in LambdaTest means connecting the local machine to the LambdaTest cloud servers to run the tests. This way the user would feel that he is testing a published website. LambdaTest offers support for 2000+ browsers on its system and multiple efficient testing features such as real-time testing, screenshot testing etc. LambdaTest is economically feasible and among the cross-browser testing tools, works faster and provides a wider range of browsers and other specifications. All these features can be leveraged for local webpage testing too. Give it a try by signing up to the free service plan on LambdaTest.

Comments
* The email will not be published on the website.
I BUILT MY SITE FOR FREE USING