Skip to content

Instantly share code, notes, and snippets.

@SarahElson
SarahElson / Class1.java
Created July 31, 2024 14:22
How To Setup JUnit Environment For Your First Test
package com.lambdatest.junit;
public class Class1 {
public double conversion(double temparature, String unit){
if(unit.equals("F")){
return (temparature-32)*(5.0/9.0);
}else{
@SarahElson
SarahElson / pom.xml
Created July 18, 2024 07:27
What Is the Single Responsibility Principle (SRP)?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lambdatest</groupId>
<artifactId>Single-Responsibility-Principle-In-Java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
@SarahElson
SarahElson / LambdaTestHomePage.java
Last active July 18, 2024 10:51
What Is the Single Responsibility Principle (SRP)?
package com.lambdatest.mainpagecomponents;
import com.lambdatest.pagecomponents.MyAccountPage;
import com.lambdatest.pagecomponents.NavigationBar;
import com.lambdatest.pagecomponents.SearchProduct;
import com.lambdatest.pagecomponents.SpecialLinkBar;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
@SarahElson
SarahElson / TestClass.java
Created July 18, 2024 07:23
What Is the Single Responsibility Principle (SRP)?
package com.lambdatest.srp;
import com.lambdatest.base.BaseTest;
import com.lambdatest.mainpagecomponents.LambdaTestHomePage;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class TestClass extends BaseTest {
@SarahElson
SarahElson / LoginPage.java
Last active July 18, 2024 10:50
What Is the Single Responsibility Principle (SRP)?
package com.lambdatest.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;
public class LoginPage{
@SarahElson
SarahElson / TestClass.java
Created July 18, 2024 07:07
What Is the Single Responsibility Principle (SRP)?
package com.lambdatest.test;
import com.lambdatest.base.BaseTest;
import com.lambdatest.pages.HomePage;
import com.lambdatest.pages.LoginPage;
import org.testng.annotations.Test;
public class TestCase extends BaseTest {
import time
from selenium.webdriver.common.by import By
from selenium import webdriver
username = "LT_USERNAME"
accessToken = "LT_ACCESS_KEY"
gridUrl = "hub.lambdatest.com/wd/hub"
import random
import time
from selenium.webdriver.common.by import By
from selenium import webdriver
browser = webdriver.Chrome()
browser.maximize_window()
browser.get("https://ecommerce-playground.lambdatest.io/index.php?route=account/register")
time.sleep(5)
@SarahElson
SarahElson / testsuites_test_demo_form.py
Created July 5, 2024 12:56
Python Unit Testing: A Complete Tutorial
import unittest
import HtmlTestRunner
import sys
sys.path.append(sys.path[0] + "/..")
from setup.setup import testSet
from locators.formLocators import formWebAction
set_up = testSet()
@SarahElson
SarahElson / locators_formLocators.py
Created July 5, 2024 12:50
Python Unit Testing: A Complete Tutorial
from selenium.webdriver.common.by import By
class formLocator:
name = "//input[@id='name']"
email = "//input[@id='inputEmail4']"
password = "//input[@id='inputPassword4']"
company = "//input[@id='company']"
website = "//input[@id='websitename']"
country = "//select[@name='country']"
city = "//input[@id='inputCity']"