Skip to content

Instantly share code, notes, and snippets.

@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']"
@SarahElson
SarahElson / setup_setup.py
Created July 5, 2024 12:03
Python Unit Testing: A Complete Tutorial
from selenium import webdriver
from dotenv import load_dotenv
import os
load_dotenv('.env')
LT_USERNAME = os.getenv("grid_username")
LT_ACCESS_KEY = os.getenv("access_key")
desired_caps = {
@SarahElson
SarahElson / lambdatest.conf.js
Created July 2, 2024 18:10
How to Run WebdriverIO Tests: Getting Started Tutorial
exports.config = {
services: [
[
"lambdatest",
{
tunnel: false,
lambdatestOpts: {
logFile: "tunnel.log"
}
}
@SarahElson
SarahElson / BaseTest.java
Created June 14, 2024 16:15
How To Generate Extent Reports In Selenium
package CloudGrid;
import java.net.*;
import java.util.HashMap;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.ITestResult;
@SarahElson
SarahElson / testngMethods.xml
Created June 14, 2024 15:23
How To Generate Extent Reports In Selenium
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Extent Report in Parallel by Methods">
<test name="Parallel Tests by Methods" parallel="methods" thread-count="3">
<classes>
<class name="ParallelExecution.InputFormTests" />
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
@SarahElson
SarahElson / testngClasses.xml
Created June 14, 2024 15:18
How To Generate Extent Reports In Selenium
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Extent Report in Parallel by Classes">
<test name = "Parallel Tests by Classes" parallel = "classes" thread-count="3">
<classes>
<class name="ParallelExecution.InputFormTests"/>
<class name="ParallelExecution.AlertTests" />
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
@SarahElson
SarahElson / TestExtentReportBasic.java
Created June 14, 2024 14:32
How To Generate Extent Reports In Selenium
package LocalGrid;
import org.testng.Assert;
import org.testng.SkipException;
import org.testng.annotations.Test;
public class TestExtentReportBasic extends BaseTest{
@SarahElson
SarahElson / BaseTest.java
Created June 14, 2024 14:16
How To Generate Extent Reports In Selenium
package LocalGrid;
import org.testng.ITestResult;
import org.testng.annotations.*;
import com.aventstack.extentreports.*;
import com.aventstack.extentreports.reporter.ExtentSparkReporter;
@SarahElson
SarahElson / testng.xml
Created June 14, 2024 12:56
How To Generate Extent Reports In Selenium
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Extent Report Tests">
<test name="Tests">
<classes>
<class name="CloudGrid.InputFormTests" />
<class name="CloudGrid.AlertTests"></class>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->