Quick Tips Archives | Online Productivity Solutions Pvt. Ltd. Mon, 14 Oct 2019 06:25:01 +0000 en-US hourly 1 Using Source Control https://opspl.com/blog/using-source-control/ https://opspl.com/blog/using-source-control/#respond Fri, 13 Apr 2018 12:24:25 +0000 https://opspl.com/?p=6859 In our industry, we are highly dependent on storage devices in order to save our data. With the growing need for technology, we also need more storage. While working in a team, we share our code by making use of ‘Source Control’ to access the code from anywhere at any point of time and keep...

The post Using Source Control appeared first on Online Productivity Solutions Pvt. Ltd..

]]>
In our industry, we are highly dependent on storage devices in order to save our data. With the growing need for technology, we also need more storage. While working in a team, we share our code by making use of ‘Source Control’ to access the code from anywhere at any point of time and keep track of the modified files (versions) by using commits.

An individual team member can make a copy of the project on his/her PC and can work on it locally. Once the code is ready to be moved to the main repository, the source control helps in tracking the modified files (versions).

One of the widely used version control software is git. Each user needs to have a git account with a password and a private key.

We can create separate (multiple) branches on the local system and whatever we modify on the local branch is not reflected on the main (master) branch until we push it. Sometimes, conflicts might occur while merging the various branches, which can be fixed just by keeping the code that is required and deleting the unwanted code manually from the particular file.

Some of the advantages of using Source Control are:

  • Allows comparison of files, identifying the differences, and merging the final change that took place.
  • Keeps track of the versions.
  • Multiple developers can work on a project at the same time.
  • Saves time in identifying the issues.
  • We can also check who has worked on the modified file (using blame command).
  • Cloning of the repository is easy.
  • It also keeps logs of the files previously committed.
  • Making a patch for a small fix.

It is necessary for any organization to maintain a Source Control in order to retain the project data in the future and smooth flow of the projects.

 

Shaunak Kundaiker

The post Using Source Control appeared first on Online Productivity Solutions Pvt. Ltd..

]]>
https://opspl.com/blog/using-source-control/feed/ 0
Guidelines for writing Selenium automation https://opspl.com/blog/guidelines-writing-selenium-automation/ https://opspl.com/blog/guidelines-writing-selenium-automation/#respond Fri, 23 Feb 2018 12:28:40 +0000 https://opspl.com/?p=6702 Automated testing is the best way to increase the effectiveness, efficiency, and coverage of your web application. Automation can be helpful not only to debug the code but also to find the root cause of the defect by identifying the code section that is error-prone. This can be carried out through tests with Selenium WebDriver...

The post Guidelines for writing Selenium automation appeared first on Online Productivity Solutions Pvt. Ltd..

]]>
Automated testing is the best way to increase the effectiveness, efficiency, and coverage of your web application. Automation can be helpful not only to debug the code but also to find the root cause of the defect by identifying the code section that is error-prone. This can be carried out through tests with Selenium WebDriver for web applications and Appium for native and mobile web applications.

Selenium is a testing framework to perform web application testing across various platforms like Windows, Mac, and Linux. Selenium supports only web-based applications that need a browser open. To execute the script on different browsers, we need the driver of that browser.

It supports various programming languages such as Java, PHP, C#, Python, Groovy, Ruby, and Perl for writing the test automation scripts. It offers recording and playback action features to write tests.

Below are the basic requirements for running a Selenium Java script.

Importing Packages

Two important packages that a tester needs to import when starting to code a script are:

  • openqa.selenium.*- This package includes the WebDriver class needed to instantiate a new browser loaded with a specific driver.
  • openqa.selenium.firefox.FirefoxDriver – FirefoxDriver class instantiates a Firefox-specific driver.

As the project would grow, it is evident and logical that we may need to introduce several other packages for more complex and distinct functionalities like database connectivity, manipulating external files, logging, assertions, accessing another class, taking browser screenshots etc.

Instantiating objects and variables

For Selenium automation, the very first line of code comes as:

WebDriver driver = new FirefoxDriver();

To initiate a driver, we create a reference variable for the WebDriver interface and instantiate it using FirefoxDriver class. It means that we are defining a reference variable (driver) whose type is an interface. Any object we assign to it must be an instance of class FireFoxDriver or any other drivers that implement that interface.

A default Firefox profile will be launched which means that no extensions and plugins would be loaded with the Firefox instance and that it runs in the safe mode.

Selenium WebDriver makes direct calls to the browser using each browser’s native support. How these direct calls are made, and the features they support depends on the browser you are using. Selenium standalone server uses this driver to start the browser of your choice. Normally to run webdriver, we just need a browser and a selenium server jar file. Selenium supports to run webdriver on the browsers by adding a .exe path of the driver server for the individual browsers.

Here are the code snippets for Firefox, Chrome and IE:

Firefox

System.setProperty(“webdriver.firefox.bin”,”F:\\Program Files(x86)\\Firefox\\Firefox.exe”);

WebDriver driver = new FirefoxDriver();

driver.navigate().to(“https://www.google.com”);

Chrome

System.setProperty(“webdriver.chrome.driver”,”G:\\Lib\\chromedriver.exe”);

WebDriver driver = new ChromeDriver();

driver.navigate().to(“https://www.google.com”);

Internet Explorer

System.setProperty(“webdriver.ie.driver”,”G:\\Lib\\internetexplorerdriver.exe”);

WebDriver driver = new InternetExplorerDriver();

driver.navigate().to(“https://www.google.com”);

Launching the Web browser

driver.get (baseURL);

To launch a fresh web browser instance the get() method is called on the WebDriver instance. The string character sequence passed as a parameter into the get() method redirects the launched web browser instance to the URL that you specify as its parameter.

Comparison between Expected and Actual Values:

Comparison code simply uses a basic if-else structure to compare the actual condition with the expected one.

if (actualCondition.contentEquals (expectedCondition)) {

System.out.printIn(“Success”);

} else {

System.out.printIn(“Fail”);

}

Terminating a Browser Session:

The “close()” method is used to close the browser window.

driver.close();

The scripts can be saved and re-run at any time. Hope this blog helps you in writing your first of many selenium test scripts.

Muriel Fernandes

Muriel Fernandes

The post Guidelines for writing Selenium automation appeared first on Online Productivity Solutions Pvt. Ltd..

]]>
https://opspl.com/blog/guidelines-writing-selenium-automation/feed/ 0
The Smart Way to Write CSS https://opspl.com/blog/smart-way-write-css/ https://opspl.com/blog/smart-way-write-css/#respond Fri, 19 Jan 2018 11:32:49 +0000 https://opspl.com/?p=6609 CSS is one of the important skills every web designer must have. Understanding CSS is the initial challenge as CSS is not easy. One needs to understand how to use CSS selectors, properties, pseudo-code, etc. While you learn the basic way to write down a CSS code, it is very important to understand the way...

The post The Smart Way to Write CSS appeared first on Online Productivity Solutions Pvt. Ltd..

]]>
CSS is one of the important skills every web designer must have.

Understanding CSS is the initial challenge as CSS is not easy. One needs to understand how to use CSS selectors, properties, pseudo-code, etc. While you learn the basic way to write down a CSS code, it is very important to understand the way to organize it. While basic coding practices focus on keeping the code well organized and nicely indented, a couple of changes in the way of writing the CSS code file can have a huge impact on the output.

Here are a few tips to write quick, clean and non-redundant CSS code:

Writing CSS Reset
Always use a CSS reset file at the start of the code. If you don’t define any element style, then the browser will apply its own CSS style which might create a mismatch in the design as browsers have their own styles. Use of CSS reset will override browser-default-styles, allowing you to write a clean code base. If you don’t know how to write a reset file, then you can also download it, as it is available on the internet.

Organizing styles in blocks
Organizing code into blocks is important as it will not only help you but also your colleagues to understand the flow of your code, instead of spending hours understanding which code is placed where. So, group your code properly, divide it into blocks or sections. There are many ways to organize your code into blocks. The first is where you can create blocks of elements of the design, for example, blocks of images, buttons, links, etc. And the second would be organizing them according to the parts or sections of the design, for example, header, menu, main body, sidebar, footer, etc. Organizing also helps in writing a non-redundant code. Sometimes we might end up repeating some of the CSS properties, so organizing your code into blocks will prevent redundancy.

Organizing CSS with comments
Assume one day you are told to work on an old project of yours, and it’s been a long time you haven’t touched that code and now you don’t remember which style is placed where since unfamiliarity will result in you not remembering the locations of specific styles. CSS files are quite long, having many lines. So it’s always important to comment your code properly, you may save a lot of time that you just would have spent on the code searching for a style. And it will also help your colleagues to understand your code with much ease.

Use CSS shorthand
Using shorthand, we can write a multiple line code on a single line. The code looks neater, cleaner and short if we use shorthand. For example, for use of a border, you can set the border-width, border-style and border-color property of an element by using just one ‘border’ property. It also makes writing easy. However, if you just have to change the colour of the border, then using longhand will be better, instead of setting all 3 properties.

Quick CSS classes
If you use a property over and over in a code, then writing a separate class for that specific property would be beneficial. So you can use that class in your HTML file whenever you would want that style property to be applied instead of defining it again and again.

These are not the only tips to write CSS smartly, there are many more. These are a few basic tips I personally follow to write better CSS.

Vijata Redkar

The post The Smart Way to Write CSS appeared first on Online Productivity Solutions Pvt. Ltd..

]]>
https://opspl.com/blog/smart-way-write-css/feed/ 0