diff --git a/API/Activities/Activity1-readyapi-project.xml b/API/Activities/Activity1-readyapi-project.xml
new file mode 100644
index 0000000000..da81057a18
--- /dev/null
+++ b/API/Activities/Activity1-readyapi-project.xml
@@ -0,0 +1,34 @@
+
+https://petstore.swagger.ioapplication/jsonapplication/json200user:Responsehttps://petstore.swagger.ioNo AuthorizationNo Authorizationusername{username}QUERY{username}password{password}QUERY{password}application/json200log:Responsehttps://petstore.swagger.ioNo AuthorizationNo AuthorizationusernamepasswordusernameusernameTEMPLATEusernameapplication/json404tes:Faultapplication/json200tes:Responsehttps://petstore.swagger.ioNo AuthorizationNo AuthorizationusernameusernameusernameTEMPLATEusernameapplication/json200tes:Responseapplication/jsonhttps://petstore.swagger.ioNo AuthorizationNo Authorizationusernameapplication/json200log:Responsehttps://petstore.swagger.ioNo AuthorizationNo AuthorizationSEQUENTIALhttps://petstore.swagger.io{
+ "id": 0,
+ "username": "testuser",
+ "firstName": "string",
+ "lastName": "string",
+ "email": "string",
+ "password": "testuser",
+ "phone": "string",
+ "userStatus": 0
+}https://petstore.swagger.io/v2/user200No AuthorizationNo Authorizationhttps://petstore.swagger.iohttps://petstore.swagger.io/v2/user/login200No AuthorizationNo Authorizationusernamepasswordhttps://petstore.swagger.iohttps://petstore.swagger.io/v2/user/testuser200No AuthorizationNo Authorizationusernamehttps://petstore.swagger.iohttps://petstore.swagger.io/v2/user/logout200No AuthorizationNo Authorizationhttps://petstore.swagger.iohttps://petstore.swagger.io/v2/user/testuser200No AuthorizationNo Authorizationusername// Sample event script to add custom HTTP header to all outgoing REST, SOAP and HTTP(S) calls
+// This code is often used for adding custom authentication to ReadyAPI functional tests
+
+// If hardcoding the token, uncomment and change line 5
+// token = '4567'
+
+// If your token is parameterized in Project level custom property, uncomment line 8
+// token = request.parent.testCase.testSuite.project.getProperty('auth_token').getValue()
+
+// To modify all outgoing calls, remove comments from lines 11 to 16
+// headers = request.requestHeaders
+// if (headers.containsKey('auth_token2') == false) {
+// headers.put('auth_token2', token)
+// request.requestHeaders = headers
+// }// Save all test step results into files
+// Change the directory path in line 5 to a location where you want to store details
+// then uncomment lines 5 to 10
+
+// filePath = 'C:\\tempOutputDirectory\\'
+// fos = new java.io.FileOutputStream(filePath + testStepResult.testStep.label + '.txt', true)
+// pw = new java.io.PrintWriter(fos)
+// testStepResult.writeTo(pw)
+// pw.close()
+// fos.close()
\ No newline at end of file
diff --git a/API/Activities/Activity2-readyapi-project.xml b/API/Activities/Activity2-readyapi-project.xml
new file mode 100644
index 0000000000..4017be34da
--- /dev/null
+++ b/API/Activities/Activity2-readyapi-project.xml
@@ -0,0 +1,25 @@
+
+https://petstore.swagger.iostatussoldQUERYsoldapplication/json200Responsehttps://petstore.swagger.ioNo AuthorizationNo AuthorizationstatusSEQUENTIALhttps://petstore.swagger.iohttps://petstore.swagger.io/v2/pet/findByStatus200$[0]['status']soldfalsefalsefalse$[*]['id']truefalsefalsefalseNo AuthorizationNo Authorizationstatus// Sample event script to add custom HTTP header to all outgoing REST, SOAP and HTTP(S) calls
+// This code is often used for adding custom authentication to ReadyAPI functional tests
+
+// If hardcoding the token, uncomment and change line 5
+// token = '4567'
+
+// If your token is parameterized in Project level custom property, uncomment line 8
+// token = request.parent.testCase.testSuite.project.getProperty('auth_token').getValue()
+
+// To modify all outgoing calls, remove comments from lines 11 to 16
+// headers = request.requestHeaders
+// if (headers.containsKey('auth_token2') == false) {
+// headers.put('auth_token2', token)
+// request.requestHeaders = headers
+// }// Save all test step results into files
+// Change the directory path in line 5 to a location where you want to store details
+// then uncomment lines 5 to 10
+
+// filePath = 'C:\\tempOutputDirectory\\'
+// fos = new java.io.FileOutputStream(filePath + testStepResult.testStep.label + '.txt', true)
+// pw = new java.io.PrintWriter(fos)
+// testStepResult.writeTo(pw)
+// pw.close()
+// fos.close()
\ No newline at end of file
diff --git a/API/Activities/Activity3-readyapi-project.xml b/API/Activities/Activity3-readyapi-project.xml
new file mode 100644
index 0000000000..1f28728cef
--- /dev/null
+++ b/API/Activities/Activity3-readyapi-project.xml
@@ -0,0 +1,262 @@
+
+http://www.dneonline.com/calculator.asmx?wsdl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Adds two integers. This is a test WebService. ©DNE Online
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]>http://schemas.xmlsoap.org/wsdl/http://www.dneonline.com/calculator.asmxUTF-8http://www.dneonline.com/calculator.asmx\r
+ \r
+ \r
+ \r
+ ?\r
+ ?\r
+ \r
+ \r
+]]>No AuthorizationNo AuthorizationUTF-8http://www.dneonline.com/calculator.asmx\r
+ \r
+ \r
+ \r
+ ?\r
+ ?\r
+ \r
+ \r
+]]>No AuthorizationNo AuthorizationUTF-8http://www.dneonline.com/calculator.asmx\r
+ \r
+ \r
+ \r
+ ?\r
+ ?\r
+ \r
+ \r
+]]>No AuthorizationNo AuthorizationUTF-8http://www.dneonline.com/calculator.asmx\r
+ \r
+ \r
+ \r
+ ?\r
+ ?\r
+ \r
+ \r
+]]>No AuthorizationNo AuthorizationSEQUENTIALCalculatorSoap12AddUTF-8http://www.dneonline.com/calculator.asmx\r
+ \r
+ \r
+ \r
+ 3\r
+ 4\r
+ \r
+ \r
+]]>200declare namespace ns1='http://tempuri.org/';
+declare namespace soap='http://www.w3.org/2003/05/soap-envelope';
+
+//ns1:AddResult7falsefalsefalseNo AuthorizationNo Authorization// Sample event script to add custom HTTP header to all outgoing REST, SOAP and HTTP(S) calls
+// This code is often used for adding custom authentication to ReadyAPI functional tests
+
+// If hardcoding the token, uncomment and change line 5
+// token = '4567'
+
+// If your token is parameterized in Project level custom property, uncomment line 8
+// token = request.parent.testCase.testSuite.project.getProperty('auth_token').getValue()
+
+// To modify all outgoing calls, remove comments from lines 11 to 16
+// headers = request.requestHeaders
+// if (headers.containsKey('auth_token2') == false) {
+// headers.put('auth_token2', token)
+// request.requestHeaders = headers
+// }// Save all test step results into files
+// Change the directory path in line 5 to a location where you want to store details
+// then uncomment lines 5 to 10
+
+// filePath = 'C:\\tempOutputDirectory\\'
+// fos = new java.io.FileOutputStream(filePath + testStepResult.testStep.label + '.txt', true)
+// pw = new java.io.PrintWriter(fos)
+// testStepResult.writeTo(pw)
+// pw.close()
+// fos.close()
\ No newline at end of file
diff --git a/API/Activities/Activity4-readyapi-project.xml b/API/Activities/Activity4-readyapi-project.xml
new file mode 100644
index 0000000000..c1a1216469
--- /dev/null
+++ b/API/Activities/Activity4-readyapi-project.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+ http://ipwhois.app
+
+
+
+
+
+
+
+
+ IP
+ IP
+ TEMPLATE
+ IP
+
+
+
+
+
+ application/json; charset=utf-8
+ 200
+
+ json:Response
+
+
+
+ http://ipwhois.app
+
+
+
+
+ IP
+
+
+
+
+
+
+
+ SEQUENTIAL
+
+
+
+
+
+
+
+ C:/Users/HP/Desktop/file.txt.txt
+ |
+ false
+ UTF-8
+ false
+
+
+ true
+ true
+ address
+ true
+ false
+
+
+
+
+
+
+
+
+
+ http://ipwhois.app
+
+ http://ipwhois.app/json/
+
+
+
+ 200
+
+
+
+ No Authorization
+ No Authorization
+
+
+
+
+
+
+ IP
+
+
+
+
+
+
+
+ Data Source
+ Request 1
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Sample event script to add custom HTTP header to all outgoing REST, SOAP and HTTP(S) calls
+// This code is often used for adding custom authentication to ReadyAPI functional tests
+
+// If hardcoding the token, uncomment and change line 5
+// token = '4567'
+
+// If your token is parameterized in Project level custom property, uncomment line 8
+// token = request.parent.testCase.testSuite.project.getProperty('auth_token').getValue()
+
+// To modify all outgoing calls, remove comments from lines 11 to 16
+// headers = request.requestHeaders
+// if (headers.containsKey('auth_token2') == false) {
+// headers.put('auth_token2', token)
+// request.requestHeaders = headers
+// }
+
+
+ // Save all test step results into files
+// Change the directory path in line 5 to a location where you want to store details
+// then uncomment lines 5 to 10
+
+// filePath = 'C:\\tempOutputDirectory\\'
+// fos = new java.io.FileOutputStream(filePath + testStepResult.testStep.label + '.txt', true)
+// pw = new java.io.PrintWriter(fos)
+// testStepResult.writeTo(pw)
+// pw.close()
+// fos.close()
+
+
+
+
diff --git a/API/Activities/Activity5-readyapi-project.xml b/API/Activities/Activity5-readyapi-project.xml
new file mode 100644
index 0000000000..e1f4a57422
--- /dev/null
+++ b/API/Activities/Activity5-readyapi-project.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+ http://ipwhois.app
+
+
+
+
+
+
+
+
+ IP
+ IP
+ TEMPLATE
+ IP
+
+
+
+
+
+ application/json; charset=utf-8
+ 200
+
+ ns:Response
+
+
+
+ http://ipwhois.app
+
+
+
+
+ IP
+
+
+
+
+
+
+
+ SEQUENTIAL
+
+
+
+
+
+
+
+ C:/Users/HP/Downloads/FST_excel.xlsx
+
+ | A2 |
+ false
+ false
+
+
+ true
+ true
+ IP
+ true
+ false
+
+
+
+
+
+
+
+
+
+ http://ipwhois.app
+
+ http://ipwhois.app/json/164.172.55.44
+
+
+
+ 200
+
+
+
+ No Authorization
+ No Authorization
+
+
+
+
+
+
+ IP
+
+
+
+
+
+
+
+ Data Source
+ Request 1
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Sample event script to add custom HTTP header to all outgoing REST, SOAP and HTTP(S) calls
+// This code is often used for adding custom authentication to ReadyAPI functional tests
+
+// If hardcoding the token, uncomment and change line 5
+// token = '4567'
+
+// If your token is parameterized in Project level custom property, uncomment line 8
+// token = request.parent.testCase.testSuite.project.getProperty('auth_token').getValue()
+
+// To modify all outgoing calls, remove comments from lines 11 to 16
+// headers = request.requestHeaders
+// if (headers.containsKey('auth_token2') == false) {
+// headers.put('auth_token2', token)
+// request.requestHeaders = headers
+// }
+
+
+ // Save all test step results into files
+// Change the directory path in line 5 to a location where you want to store details
+// then uncomment lines 5 to 10
+
+// filePath = 'C:\\tempOutputDirectory\\'
+// fos = new java.io.FileOutputStream(filePath + testStepResult.testStep.label + '.txt', true)
+// pw = new java.io.PrintWriter(fos)
+// testStepResult.writeTo(pw)
+// pw.close()
+// fos.close()
+
+
+
+
diff --git a/API/Activities/Activity6-readyapi-project.xml b/API/Activities/Activity6-readyapi-project.xml
new file mode 100644
index 0000000000..e1f4a57422
--- /dev/null
+++ b/API/Activities/Activity6-readyapi-project.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+ http://ipwhois.app
+
+
+
+
+
+
+
+
+ IP
+ IP
+ TEMPLATE
+ IP
+
+
+
+
+
+ application/json; charset=utf-8
+ 200
+
+ ns:Response
+
+
+
+ http://ipwhois.app
+
+
+
+
+ IP
+
+
+
+
+
+
+
+ SEQUENTIAL
+
+
+
+
+
+
+
+ C:/Users/HP/Downloads/FST_excel.xlsx
+
+ A2 |
+ false
+ false
+
+
+ true
+ true
+ IP
+ true
+ false
+
+
+
+
+
+
+
+
+
+ http://ipwhois.app
+
+ http://ipwhois.app/json/164.172.55.44
+
+
+
+ 200
+
+
+
+ No Authorization
+ No Authorization
+
+
+
+
+
+
+ IP
+
+
+
+
+
+
+
+ Data Source
+ Request 1
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Sample event script to add custom HTTP header to all outgoing REST, SOAP and HTTP(S) calls
+// This code is often used for adding custom authentication to ReadyAPI functional tests
+
+// If hardcoding the token, uncomment and change line 5
+// token = '4567'
+
+// If your token is parameterized in Project level custom property, uncomment line 8
+// token = request.parent.testCase.testSuite.project.getProperty('auth_token').getValue()
+
+// To modify all outgoing calls, remove comments from lines 11 to 16
+// headers = request.requestHeaders
+// if (headers.containsKey('auth_token2') == false) {
+// headers.put('auth_token2', token)
+// request.requestHeaders = headers
+// }
+
+
+ // Save all test step results into files
+// Change the directory path in line 5 to a location where you want to store details
+// then uncomment lines 5 to 10
+
+// filePath = 'C:\\tempOutputDirectory\\'
+// fos = new java.io.FileOutputStream(filePath + testStepResult.testStep.label + '.txt', true)
+// pw = new java.io.PrintWriter(fos)
+// testStepResult.writeTo(pw)
+// pw.close()
+// fos.close()
+
+
+
+
diff --git a/API/Project/FTSproject.java b/API/Project/FTSproject.java
new file mode 100644
index 0000000000..b625c00f20
--- /dev/null
+++ b/API/Project/FTSproject.java
@@ -0,0 +1,106 @@
+package project;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.equalTo;
+import org.testng.Reporter;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import io.restassured.builder.RequestSpecBuilder;
+import io.restassured.builder.ResponseSpecBuilder;
+import io.restassured.response.Response;
+import io.restassured.specification.RequestSpecification;
+import io.restassured.specification.ResponseSpecification;
+import static org.hamcrest.Matchers.*;
+
+
+public class FTSproject {
+
+ // Declare request specification
+ RequestSpecification requestSpec;
+ // Declare response specification
+ ResponseSpecification responseSpec;
+
+ //Holds SSH public Key
+ String SSH = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOnYvfzpYl++dDvghOOtK4JvxqUVaXsMwgxjDM5ZcSWq azuread\\\\samudradas@IBM-BJPKC64";
+
+ // Holds generated key id
+ int keyId;
+
+ @BeforeClass
+ public void setUp() {
+ // Create request specification
+ requestSpec = new RequestSpecBuilder()
+ // Set content type
+ .addHeader("Authorization", "Bearer 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")
+ // Set base URL
+ .setBaseUri("https://api.github.com")
+ // Build request specification
+ .build();
+ }
+
+ // ---------------- POST ----------------
+ @Test(priority = 1)
+ public void addSSHKey() {
+
+ String requestBody = "{\n" +
+ " \"title\": \"TestAPIKey\",\n" +
+ " \"key\": \"" + SSH + "\"\n" +
+ "}";
+
+ Response response =
+ given()
+ .spec(requestSpec)
+ .body(requestBody)
+ .when()
+ .post("/user/keys")
+ .then()
+ .statusCode(201)
+ .body("id", notNullValue())
+ .extract()
+ .response();
+
+ keyId = response.path("id");
+ System.out.println(keyId);
+
+ Reporter.log("Created SSH Key ID: " + keyId, true);
+ }
+
+ // ---------------- GET ----------------
+ @Test(priority = 2)
+ public void getSSHKeyById() {
+
+ Response response =
+ given()
+ .spec(requestSpec)
+ .pathParam("keyId", keyId)
+ .when()
+ .get("/user/keys/{keyId}")
+ .then()
+ .statusCode(200)
+ .body("id", equalTo(keyId))
+ .body("title", equalTo("TestAPIKey"))
+ .extract()
+ .response();
+
+ Reporter.log("GET Response: " + response.asPrettyString(), true);
+ }
+
+ // ---------------- DELETE ----------------
+ @Test(priority = 3)
+ public void deleteSSHKey() {
+
+ Response response =
+ given()
+ .spec(requestSpec)
+ .pathParam("keyId", keyId)
+ .when()
+ .delete("/user/keys/{keyId}")
+ .then()
+ .statusCode(204)
+ .extract()
+ .response();
+
+ Reporter.log("Deleted SSH Key ID: " + keyId, true);
+ }
+
+}
diff --git a/Appium/Activities/Activity3.java b/Appium/Activities/Activity3.java
new file mode 100644
index 0000000000..8af7607ea4
--- /dev/null
+++ b/Appium/Activities/Activity3.java
@@ -0,0 +1,112 @@
+package Activities;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+public class Activity3 {
+ // Driver Declaration
+ AndroidDriver driver;
+
+ // Set up method
+ @BeforeClass
+ public void setUp() throws MalformedURLException, URISyntaxException {
+ // Desired Capabilities
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("android");
+ options.setAutomationName("UiAutomator2");
+ options.setApp("path/to/calculator.apk");
+ options.noReset();
+
+ // Server Address
+ URL serverURL = new URI("http://localhost:4723").toURL();
+
+ // Driver Initialization
+ driver = new AndroidDriver(serverURL, options);
+ }
+
+ // Test method
+ @Test
+ public void additionTest() {
+ // Perform the calculation
+ driver.findElement(AppiumBy.id("digit_5")).click();
+ driver.findElement(AppiumBy.accessibilityId("plus")).click();
+ driver.findElement(AppiumBy.id("digit_9")).click();
+ driver.findElement(AppiumBy.accessibilityId("equals")).click();
+
+ // Find the result
+ String result = driver.findElement(AppiumBy.id("result_final")).getText();
+
+ // Assertion
+ Assert.assertEquals(result, "14");
+ }
+
+ // Test method
+ @Test
+ public void subtractTest() {
+ // Perform the calculation
+ driver.findElement(AppiumBy.id("digit_1")).click();
+ driver.findElement(AppiumBy.id("digit_0")).click();
+ driver.findElement(AppiumBy.accessibilityId("minus")).click();
+ driver.findElement(AppiumBy.id("digit_5")).click();
+ driver.findElement(AppiumBy.accessibilityId("equals")).click();
+
+ // Find the result
+ String result = driver.findElement(AppiumBy.id("result_final")).getText();
+
+ // Assertion
+ Assert.assertEquals(result, "5");
+ }
+
+ // Test method
+ @Test
+ public void multiplyTest() {
+ // Perform the calculation
+ driver.findElement(AppiumBy.id("digit_5")).click();
+ driver.findElement(AppiumBy.accessibilityId("multiply")).click();
+ driver.findElement(AppiumBy.id("digit_1")).click();
+ driver.findElement(AppiumBy.id("digit_0")).click();
+ driver.findElement(AppiumBy.id("digit_0")).click();
+ driver.findElement(AppiumBy.accessibilityId("equals")).click();
+
+ // Find the result
+ String result = driver.findElement(AppiumBy.id("result_final")).getText();
+
+ // Assertion
+ Assert.assertEquals(result, "500");
+ }
+
+ // Test method
+ @Test
+ public void divideTest() {
+ // Perform the calculation
+ driver.findElement(AppiumBy.id("digit_5")).click();
+ driver.findElement(AppiumBy.id("digit_0")).click();
+ driver.findElement(AppiumBy.accessibilityId("divide")).click();
+ driver.findElement(AppiumBy.id("digit_2")).click();
+ driver.findElement(AppiumBy.accessibilityId("equals")).click();
+
+ // Find the result
+ String result = driver.findElement(AppiumBy.id("result_final")).getText();
+
+ // Assertion
+ Assert.assertEquals(result, "25");
+ }
+
+ // Tear down method
+ @AfterClass
+ public void tearDown() {
+ // Close the app
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Appium/Activities/Activity4.java b/Appium/Activities/Activity4.java
new file mode 100644
index 0000000000..52128c8d0d
--- /dev/null
+++ b/Appium/Activities/Activity4.java
@@ -0,0 +1,82 @@
+package Activities;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.time.Duration;
+
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+public class Activity4 {
+ // Driver Declaration
+ AndroidDriver driver;
+ WebDriverWait wait;
+
+ // Set up method
+ @BeforeClass
+ public void setUp() throws MalformedURLException, URISyntaxException {
+ // Desired Capabilities
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("android");
+ options.setAutomationName("UiAutomator2");
+ options.setAppPackage("com.google.android.contacts");
+ options.setAppActivity("com.android.contacts.activities.PeopleActivity");
+ options.noReset();
+
+ // Server Address
+ URL serverURL = new URI("http://localhost:4723").toURL();
+
+ // Driver Initialization
+ driver = new AndroidDriver(serverURL, options);
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ }
+
+ // Test method
+ @Test
+ public void contactsTest() {
+ // Find and click the add button
+ driver.findElement(AppiumBy.accessibilityId("Create new contact")).click();
+
+ // Wait for elements to load
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.xpath("//android.widget.EditText[@text='First name']")
+ ));
+
+ // Enter the details
+ driver.findElement(AppiumBy.xpath(
+ "//android.widget.EditText[@text='First name']"
+ )).sendKeys("Aaditya");
+ driver.findElement(AppiumBy.xpath(
+ "//android.widget.EditText[@text='Last name']"
+ )).sendKeys("Varma");
+ driver.findElement(AppiumBy.xpath(
+ "//android.widget.EditText[@text='Phone']"
+ )).sendKeys("999148292");
+ // Click Save
+ driver.findElement(AppiumBy.id("editor_menu_save_button")).click();
+
+ // Wait for contact to save
+ wait.until(ExpectedConditions.elementToBeClickable(AppiumBy.id("large_title")));
+
+ // Assertion
+ String contactName = driver.findElement(AppiumBy.id("large_title")).getText();
+ Assert.assertEquals(contactName, "Aaditya Varma");
+ }
+
+ // Tear down method
+ @AfterClass
+ public void tearDown() {
+ // Close the app
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Appium/Activities/Activity5.java b/Appium/Activities/Activity5.java
new file mode 100644
index 0000000000..a7f7573869
--- /dev/null
+++ b/Appium/Activities/Activity5.java
@@ -0,0 +1,79 @@
+package Activities;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.time.Duration;
+
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+import io.appium.java_client.android.nativekey.AndroidKey;
+import io.appium.java_client.android.nativekey.KeyEvent;
+
+public class Activity5 {
+ // Driver Declaration
+ AndroidDriver driver;
+ WebDriverWait wait;
+
+ // Set up method
+ @BeforeClass
+ public void setUp() throws MalformedURLException {
+ // Desired Capabilities
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("android");
+ options.setAutomationName("UiAutomator2");
+ options.setAppPackage("com.google.android.apps.messaging");
+ options.setAppActivity(".ui.ConversationListActivity");
+ options.noReset();
+
+ // Server Address
+ URL serverURL = new URL("http://localhost:4723/");
+
+ // Driver Initialization
+ driver = new AndroidDriver(serverURL, options);
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ }
+
+ // Test method
+ @Test
+ public void smsTest() {
+ // Find and click the add button
+ driver.findElement(AppiumBy.accessibilityId("Start new conversation")).click();
+
+ // Wait for elements to load
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("recipient_text_view")
+ ));
+
+ // Find the element to add recipient
+ driver.findElement(AppiumBy.id("recipient_text_view")).sendKeys("18282832912");
+ // Press ENTER
+ driver.pressKey(new KeyEvent(AndroidKey.ENTER));
+
+ // Wait for textbox to appear
+ wait.until(ExpectedConditions.elementToBeClickable(AppiumBy.id("compose_message_text")));
+
+ // Enter text to send
+ driver.findElement(AppiumBy.id("compose_message_text")).sendKeys("Hello from Appium");
+ // Press Send
+ driver.findElement(AppiumBy.accessibilityId("Send SMS")).click();
+
+ // Assertion
+ String messageTextSent = driver.findElement(AppiumBy.id("message_text")).getText();
+ Assert.assertEquals(messageTextSent, "Hello from Appium");
+ }
+
+ // Tear down method
+ @AfterClass
+ public void tearDown() {
+ // Close the app
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Appium/Activities/Activity7.java b/Appium/Activities/Activity7.java
new file mode 100644
index 0000000000..966f7663d9
--- /dev/null
+++ b/Appium/Activities/Activity7.java
@@ -0,0 +1,83 @@
+package Activities;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.time.Duration;
+import java.util.List;
+
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+public class Activity7 {
+ // Driver Declaration
+ AndroidDriver driver;
+ WebDriverWait wait;
+
+ // Set up method
+ @BeforeClass
+ public void setUp() throws MalformedURLException, URISyntaxException {
+ // Desired Capabilities
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("android");
+ options.setAutomationName("UiAutomator2");
+ options.setAppPackage("com.android.chrome");
+ options.setAppActivity("com.google.android.apps.chrome.Main");
+ options.noReset();
+
+ // Server Address
+ URL serverURL = new URI("http://localhost:4723").toURL();
+
+ // Driver Initialization
+ driver = new AndroidDriver(serverURL, options);
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+
+ // Open the page in Chrome
+ driver.get("https://training-support.net/webelements/lazy-loading");
+ }
+
+ // Test method
+ @Test
+ public void uiScrollableTest() {
+ // Wait for page to load
+ wait.until(ExpectedConditions.visibilityOfElementLocated(AppiumBy.className("android.widget.Image")));
+ // UiScrollable object string
+ String UiScrollable = "UiScrollable(UiSelector().scrollable(true))";
+
+ // Find all the image elements on the page
+ List imageElements = driver.findElements(AppiumBy.className("android.widget.Image"));
+ // Print the number of images
+ System.out.println("Before scroll: " + imageElements.size());
+
+ // Scroll to required element
+ String imageText = driver.findElement(AppiumBy
+ .androidUIAutomator(UiScrollable + ".scrollForward(25).getChildByText(className(\"android.widget.Image\"), \"Helen\")"))
+ .getText();
+ System.out.println("Found " + imageText + "!");
+
+ // Get image elements after scroll
+ imageElements = driver.findElements(AppiumBy.className("android.widget.Image"));
+ // Print the number of images after scroll
+ System.out.println("After scroll: " + imageElements.size());
+
+ // Assertions
+ Assert.assertEquals(imageElements.size(), 3);
+ }
+
+ // Tear down method
+ @AfterClass
+ public void tearDown() {
+ // Close the app
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Appium/Activities/Activity_1.java b/Appium/Activities/Activity_1.java
new file mode 100644
index 0000000000..fee2b8a934
--- /dev/null
+++ b/Appium/Activities/Activity_1.java
@@ -0,0 +1,67 @@
+package Activities;
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+public class Activity_1 {
+ // Driver Declaration
+ AndroidDriver driver;
+ WebDriverWait wait;
+
+ // Set up method
+ @BeforeClass
+ public void setUp() throws MalformedURLException, URISyntaxException {
+
+ File appFile = new File("src/test/resources/Calculator.apk");
+ // Desired Capabilities
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("android");
+ options.setAutomationName("UiAutomator2");
+ options.setApp(appFile.getAbsolutePath());
+ options.noReset();
+
+ // Server Address
+ URL serverURL = new URI("http://localhost:4723").toURL();
+
+ // Driver Initialization
+ driver = new AndroidDriver(serverURL, options);
+ }
+
+ // Test method
+ @Test
+ public void multiplyTest() {
+ // Perform the calculation
+ driver.findElement(AppiumBy.accessibilityId("clear")).click();
+ driver.findElement(AppiumBy.id("digit_5")).click();
+ driver.findElement(AppiumBy.accessibilityId("multiply")).click();
+ driver.findElement(AppiumBy.id("digit_8")).click();
+ driver.findElement(AppiumBy.accessibilityId("equals")).click();
+
+ // Find the result
+ String result = driver.findElement(AppiumBy.id("result_final")).getText();
+
+ // Assertion
+ Assert.assertEquals(result, "40");
+
+ }
+
+
+ // Tear down method
+ @AfterClass
+ public void tearDown() {
+ // Close the app
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Appium/Activities/Activity_2.java b/Appium/Activities/Activity_2.java
new file mode 100644
index 0000000000..379898786e
--- /dev/null
+++ b/Appium/Activities/Activity_2.java
@@ -0,0 +1,69 @@
+package Activities;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+public class Activity_2 {
+ // Driver Declaration
+ AndroidDriver driver;
+
+ // Set up method
+ @BeforeClass
+ public void setUp() throws MalformedURLException, URISyntaxException {
+ // Desired Capabilities
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("android");
+ options.setAutomationName("UiAutomator2");
+ options.setAppPackage("com.android.chrome");
+ options.setAppActivity("com.google.android.apps.chrome.Main");
+ options.noReset();
+
+ // Set the Appium server URL
+ URL serverURL = new URI("http://localhost:4723").toURL();
+
+ // Driver Initialization
+ driver = new AndroidDriver(serverURL, options);
+
+ // Open the page in Chrome
+ driver.get("https://training-support.net");
+ }
+
+ // Test method
+ @Test
+ public void chromeTest() {
+ // Find heading on the page
+ String pageHeading = driver.findElement(AppiumBy.xpath(
+ "//android.widget.TextView[@text='Training Support']"
+ )).getText();
+
+ // Print to console
+ System.out.println("Heading: " + pageHeading);
+
+ // Find and click the About Us link
+ driver.findElement(AppiumBy.accessibilityId("About Us")).click();
+
+ // Find heading of new page and print to console
+ String aboutPageHeading = driver.findElement(AppiumBy.xpath(
+ "//android.widget.TextView[@text='About Us']"
+ )).getText();
+ System.out.println(aboutPageHeading);
+ }
+
+
+ // Tear down method
+ @AfterClass
+ public void tearDown() {
+ // Close the app
+ driver.quit();
+ }
+}
diff --git a/Appium/Activities/Activity_6.java b/Appium/Activities/Activity_6.java
new file mode 100644
index 0000000000..4646a48766
--- /dev/null
+++ b/Appium/Activities/Activity_6.java
@@ -0,0 +1,106 @@
+package Activities;
+
+import static org.testng.Assert.assertTrue;
+
+import java.net.URI;
+import java.net.URL;
+import java.time.Duration;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+public class Activity_6 {
+
+ private AndroidDriver driver;
+ private WebDriverWait wait;
+
+ @BeforeClass
+ public void setUp() throws Exception {
+
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("Android");
+ options.setAutomationName("UiAutomator2");
+ options.setAppPackage("com.android.chrome");
+ options.setAppActivity("com.google.android.apps.chrome.Main");
+
+ // REQUIRED for Chrome 134+
+ options.setCapability("chromedriverAutodownload", true);
+
+ options.noReset();
+
+ URL serverURL = new URI("http://localhost:4723").toURL();
+ driver = new AndroidDriver(serverURL, options);
+
+ wait = new WebDriverWait(driver, Duration.ofSeconds(20));
+
+ driver.get("https://training-support.net/webelements/sliders");
+
+ // Switch to WEBVIEW safely
+ for (String context : driver.getContextHandles()) {
+ if (context.contains("WEBVIEW")) {
+ driver.context(context);
+ break;
+ }
+ }
+ }
+
+ @Test
+ public void volume75Test() {
+
+ WebElement slider = wait.until(
+ ExpectedConditions.elementToBeClickable(
+ By.cssSelector("input[type='range']")
+ )
+ );
+
+ slider.sendKeys(Keys.HOME);
+ slider.sendKeys("75");
+
+ WebElement value = wait.until(
+ ExpectedConditions.visibilityOfElementLocated(
+ By.id("rangeValue")
+ )
+ );
+
+ System.out.println(value.getText());
+ assertTrue(value.getText().contains("75"));
+ }
+
+ @Test
+ public void volume25Test() {
+
+ WebElement slider = wait.until(
+ ExpectedConditions.elementToBeClickable(
+ By.cssSelector("input[type='range']")
+ )
+ );
+
+ slider.sendKeys(Keys.HOME);
+ slider.sendKeys("25");
+
+ WebElement value = wait.until(
+ ExpectedConditions.visibilityOfElementLocated(
+ By.id("rangeValue")
+ )
+ );
+
+ System.out.println(value.getText());
+ assertTrue(value.getText().contains("25"));
+ }
+
+ @AfterClass
+ public void tearDown() {
+ if (driver != null) {
+ driver.quit();
+ }
+ }
+}
diff --git a/Appium/Project/ActionBase.java b/Appium/Project/ActionBase.java
new file mode 100644
index 0000000000..16ff66d914
--- /dev/null
+++ b/Appium/Project/ActionBase.java
@@ -0,0 +1,28 @@
+package Activities;
+import static java.time.Duration.ofMillis;
+import static org.openqa.selenium.interactions.PointerInput.MouseButton.LEFT;
+import static org.openqa.selenium.interactions.PointerInput.Origin.viewport;
+
+import java.util.Arrays;
+
+import org.openqa.selenium.Point;
+import org.openqa.selenium.interactions.PointerInput;
+import org.openqa.selenium.interactions.PointerInput.Kind;
+import org.openqa.selenium.interactions.Sequence;
+
+import io.appium.java_client.AppiumDriver;
+
+public class ActionBase {
+
+ private final static PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
+
+ public static void doSwipe(AppiumDriver driver, Point start, Point end, int duration) {
+ Sequence swipe = new Sequence(finger, 1)
+ .addAction(finger.createPointerMove(ofMillis(0), viewport(), start.getX(), start.getY()))
+ .addAction(finger.createPointerDown(LEFT.asArg()))
+ .addAction(finger.createPointerMove(ofMillis(duration), viewport(), end.getX(), end.getY()))
+ .addAction(finger.createPointerUp(LEFT.asArg()));
+ driver.perform(Arrays.asList(swipe));
+ }
+
+}
diff --git a/Appium/Project/Slider.java b/Appium/Project/Slider.java
new file mode 100644
index 0000000000..96efd53938
--- /dev/null
+++ b/Appium/Project/Slider.java
@@ -0,0 +1,41 @@
+package project;
+
+import io.appium.java_client.android.AndroidDriver;
+import org.openqa.selenium.interactions.PointerInput;
+import org.openqa.selenium.interactions.Sequence;
+
+import java.time.Duration;
+import java.util.Collections;
+
+public class Slider {
+
+ public static void swipeByCoordinates(
+ AndroidDriver driver,
+ int startX, int startY,
+ int endX, int endY,
+ int durationMs) {
+
+ PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
+ Sequence swipe = new Sequence(finger, 1);
+
+ swipe.addAction(finger.createPointerMove(
+ Duration.ZERO,
+ PointerInput.Origin.viewport(),
+ startX,
+ startY));
+
+ swipe.addAction(finger.createPointerDown(
+ PointerInput.MouseButton.LEFT.asArg()));
+
+ swipe.addAction(finger.createPointerMove(
+ Duration.ofMillis(durationMs),
+ PointerInput.Origin.viewport(),
+ endX,
+ endY));
+
+ swipe.addAction(finger.createPointerUp(
+ PointerInput.MouseButton.LEFT.asArg()));
+
+ driver.perform(Collections.singletonList(swipe));
+ }
+}
diff --git a/Appium/Project/chrome.java b/Appium/Project/chrome.java
new file mode 100644
index 0000000000..7256e9cbe7
--- /dev/null
+++ b/Appium/Project/chrome.java
@@ -0,0 +1,245 @@
+package project;
+
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.net.URI;
+import java.net.URL;
+import java.time.Duration;
+import java.util.List;
+
+public class chrome {
+
+ AndroidDriver driver;
+ WebDriverWait wait;
+
+ // =====================================================
+ // SETUP
+ // =====================================================
+ @BeforeClass
+ public void setUp() throws Exception {
+
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("Android");
+ options.setAutomationName("UiAutomator2");
+ options.setAppPackage("com.android.chrome");
+ options.setAppActivity("com.google.android.apps.chrome.Main");
+ options.noReset();
+
+ URL serverURL = new URI("http://localhost:4723").toURL();
+ driver = new AndroidDriver(serverURL, options);
+
+
+ wait = new WebDriverWait(driver, Duration.ofSeconds(20));
+
+ }
+
+
+ @Test(priority = 1)
+ public void scrollIntoViewTest() {
+
+ // Always start from home page (test independence)
+ driver.get("https://training-support.net/webelements");
+
+ String UiScrollable = "UiScrollable(UiSelector().scrollable(true))";
+ driver.findElement(AppiumBy.androidUIAutomator(
+ UiScrollable + ".flingForward()"
+ ));
+
+ driver.findElement(
+ AppiumBy.xpath("//android.widget.TextView[@text=\"To-Do List\"]")
+ ).click();
+
+ driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"todo-input\")"))
+ .sendKeys("Add tasks to list");
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"todo-add\")")
+ ).click();
+
+ driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"todo-input\")"))
+ .sendKeys("Get Number of Tasks");
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"todo-add\")")
+ ).click();
+
+ driver.findElement(AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"todo-input\")"))
+ .sendKeys("Clear The List");
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"todo-add\")")
+ ).click();
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.CheckBox\").instance(2)")
+ ).click();
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.CheckBox\").instance(3)")
+ ).click();
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().className(\"android.widget.CheckBox\").instance(4)")
+ ).click();
+
+ int taskCount = driver.findElements(
+ AppiumBy.className("android.widget.CheckBox")
+ ).size();
+
+ Assert.assertEquals(taskCount, 5, "Task count mismatch");
+
+
+ }
+
+
+ @Test(priority = 2)
+ public void loginWithValidCredentials() {
+
+ // Always start from home page (test independence)
+ driver.get("https://training-support.net/webelements");
+
+ driver.context("NATIVE_APP");
+
+ // Scroll until Login Form card is visible
+ driver.findElement(AppiumBy.androidUIAutomator(
+ "new UiScrollable(new UiSelector().scrollable(true))" +
+ ".scrollIntoView(new UiSelector().text(\"Login Form\"))"
+ ));
+
+ // Click Login Form card
+ driver.findElement(
+ AppiumBy.xpath("//android.widget.TextView[@text=\"Login Form\"]")
+ ).click();
+
+ // Enter valid credentials
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"username\")")
+ ).sendKeys("admin");
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"password\")")
+ ).sendKeys("password");
+
+ // Submit login
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().text(\"Submit\")")
+ ).click();
+
+ // Assertion: successful login message
+ Assert.assertTrue(
+ driver.findElement(
+ AppiumBy.xpath("//android.widget.TextView[contains(@text,'Welcome')]")
+ ).isDisplayed(),
+ "Valid login success message not displayed"
+ );
+ }
+
+
+ @Test(priority = 3)
+ public void loginWithInvalidCredentials() {
+
+ // Always start from home page (test independence)
+ driver.get("https://training-support.net/webelements");
+
+ driver.context("NATIVE_APP");
+
+ // Scroll until Login Form card is visible
+ driver.findElement(AppiumBy.androidUIAutomator(
+ "new UiScrollable(new UiSelector().scrollable(true))" +
+ ".scrollIntoView(new UiSelector().text(\"Login Form\"))"
+ ));
+
+ // Click Login Form card
+ driver.findElement(
+ AppiumBy.xpath("//android.widget.TextView[@text=\"Login Form\"]")
+ ).click();
+
+ // Enter INVALID credentials
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"username\")")
+ ).sendKeys("wronguser");
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"password\")")
+ ).sendKeys("wrongpassword");
+
+ // Submit login
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().text(\"Submit\")")
+ ).click();
+
+ // Assertion: invalid login message
+ Assert.assertTrue(
+ driver.findElement(
+ AppiumBy.xpath("//android.widget.TextView[contains(@text,'Invalid')]")
+ ).isDisplayed(),
+ "Invalid login error message not displayed"
+ );
+ }
+
+ @Test(priority = 4)
+ public void popupLoginWithValidCredentials() {
+
+ // Always start from home page (test independence)
+ driver.get("https://training-support.net/webelements");
+
+ driver.context("NATIVE_APP");
+
+ // Scroll until Popups card is visible
+ driver.findElement(AppiumBy.androidUIAutomator(
+ "new UiScrollable(new UiSelector().scrollable(true))" +
+ ".scrollIntoView(new UiSelector().text(\"Selects\"))"
+ ));
+
+ // Click Popups card
+ driver.findElement(
+ AppiumBy.xpath("//android.widget.TextView[@text=\"Popups\"]")
+ ).click();
+
+ // Click button to open login popup
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().text(\"Open Login Popup\")")
+ ).click();
+
+ // Enter credentials inside popup
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"username\")")
+ ).sendKeys("admin");
+
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().resourceId(\"password\")")
+ ).sendKeys("password");
+
+ // Submit popup login
+ driver.findElement(
+ AppiumBy.androidUIAutomator("new UiSelector().text(\"Submit\")")
+ ).click();
+
+ // Assertion: successful popup login message
+ Assert.assertTrue(
+ driver.findElement(
+ AppiumBy.xpath("//android.widget.TextView[contains(@text,'Welcome')]")
+ ).isDisplayed(),
+ "Popup login success message not displayed"
+ );
+ }
+
+
+ @AfterClass
+ public void tearDown() {
+ if (driver != null) {
+ driver.quit();
+ }
+ }
+}
diff --git a/Appium/Project/nativeApp.java b/Appium/Project/nativeApp.java
new file mode 100644
index 0000000000..839449dfdb
--- /dev/null
+++ b/Appium/Project/nativeApp.java
@@ -0,0 +1,252 @@
+package project;
+
+import io.appium.java_client.AppiumBy;
+import io.appium.java_client.android.AndroidDriver;
+import io.appium.java_client.android.options.UiAutomator2Options;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.interactions.PointerInput;
+import org.openqa.selenium.interactions.Sequence;
+import org.openqa.selenium.interactions.Pause;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.time.Duration;
+import java.util.Collections;
+
+public class nativeApp {
+
+ AndroidDriver driver;
+ WebDriverWait wait;
+
+ // Slider coordinates (based on your device)
+ private static final int SLIDER_START_X = 311;
+ private static final int SLIDER_END_X = 1000;
+ private static final int SLIDER_Y = 1294;
+
+ @BeforeClass
+ public void setUp() throws Exception {
+
+ File appFile = new File("src/test/resources/ts-todo-list-v1.apk");
+
+ UiAutomator2Options options = new UiAutomator2Options();
+ options.setPlatformName("android");
+ options.setAutomationName("UiAutomator2");
+ options.setApp(appFile.getAbsolutePath());
+ options.noReset();
+
+ URL serverURL = new URI("http://localhost:4723").toURL();
+ driver = new AndroidDriver(serverURL, options);
+
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ }
+
+ // ==========================================================
+ // TEST 1: Add tasks (NO completion)
+ // ==========================================================
+ @Test(priority = 1)
+ public void SetToDoAndVerifyTasks() {
+
+ addTask("Completed Activity 1", "High", false);
+ addTask("Completed Activity 2", "Medium", false);
+ addTask("Completed Activity 3", "Low", false);
+
+ assertTaskPresent("Completed Activity 1");
+ assertTaskPresent("Completed Activity 2");
+ assertTaskPresent("Completed Activity 3");
+ }
+
+ // ==========================================================
+ // TEST 2: Edit first task and set deadline
+ // ==========================================================
+ @Test(priority = 2, dependsOnMethods = "SetToDoAndVerifyTasks")
+ public void editFirstTaskAndSetDeadline() {
+
+ By firstTask = AppiumBy.xpath(
+ "(//android.widget.TextView[contains(@text,'Completed')])[1]");
+
+ longPressElement(firstTask);
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.xpath("//android.widget.TextView[@resource-id='android:id/title' and @text='Edit To-Do Task']")))
+ .click();
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("com.app.todolist:id/tv_todo_list_deadline"))).click();
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.xpath("//android.widget.ImageButton[@content-desc='Next month']")))
+ .click();
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.xpath("//android.view.View[@content-desc=\"10 February 2026\"]")))
+ .click();
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("com.app.todolist:id/bt_deadline_ok"))).click();
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("com.app.todolist:id/bt_new_task_ok"))).click();
+
+ String deadlineText = wait.until(
+ ExpectedConditions.visibilityOfElementLocated(
+ AppiumBy.id("com.app.todolist:id/tv_exlv_task_deadline")))
+ .getText();
+
+ Assert.assertFalse(deadlineText.isBlank(),
+ "Deadline was NOT set for the task");
+ }
+
+ // ==========================================================
+ // TEST 3: Complete tasks with different progress
+ // ==========================================================
+ @Test(priority = 3, dependsOnMethods = "editFirstTaskAndSetDeadline")
+ public void completeTasksWithDifferentProgress() {
+
+ // Task 1 → 100%
+ slideTaskByIndex(1, SLIDER_END_X);
+
+ // Task 2 → 100%
+ slideTaskByIndex(2, SLIDER_END_X);
+
+ // Task 3 → 50%
+ int fiftyPercentX = SLIDER_START_X + ((SLIDER_END_X - SLIDER_START_X) / 2);
+ slideTaskByIndex(3, fiftyPercentX);
+
+ // ✅ ASSERT: only TWO tasks are completed
+ assertCompletedTaskCount(2);
+ }
+
+ // ==========================================================
+ // ADD TASK (slider optional)
+ // ==========================================================
+ private void addTask(String taskName, String priority, boolean moveSlider) {
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("fab_new_task"))).click();
+
+ wait.until(ExpectedConditions.visibilityOfElementLocated(
+ AppiumBy.id("com.app.todolist:id/et_new_task_name")))
+ .sendKeys(taskName);
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("com.app.todolist:id/tv_new_task_priority"))).click();
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.xpath("//android.widget.TextView[@text='" + priority + "']")))
+ .click();
+
+ if (moveSlider) {
+ Slider.swipeByCoordinates(
+ driver,
+ SLIDER_START_X, SLIDER_Y,
+ SLIDER_END_X, SLIDER_Y,
+ 600
+ );
+ }
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("com.app.todolist:id/bt_new_task_ok"))).click();
+ }
+
+ // ==========================================================
+ // SLIDE TASK BY INDEX
+ // ==========================================================
+ private void slideTaskByIndex(int index, int endX) {
+
+ By task = AppiumBy.xpath(
+ "(//android.widget.TextView[contains(@text,'Completed')])[" + index + "]");
+
+ longPressElement(task);
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.xpath("//android.widget.TextView[@resource-id='android:id/title' and @text='Edit To-Do Task']")))
+ .click();
+
+ Slider.swipeByCoordinates(
+ driver,
+ SLIDER_START_X, SLIDER_Y,
+ endX, SLIDER_Y,
+ 600
+ );
+
+ wait.until(ExpectedConditions.elementToBeClickable(
+ AppiumBy.id("com.app.todolist:id/bt_new_task_ok"))).click();
+ }
+
+ // ==========================================================
+ // ASSERT TASK EXISTS
+ // ==========================================================
+ private void assertTaskPresent(String taskName) {
+
+ By taskLocator = AppiumBy.xpath(
+ "//android.widget.TextView[@text='" + taskName + "']");
+
+ Assert.assertTrue(
+ driver.findElements(taskLocator).size() > 0,
+ "Task NOT found in list: " + taskName
+ );
+ }
+
+ // ==========================================================
+ // ASSERT COMPLETED TASK COUNT
+ // ==========================================================
+ private void assertCompletedTaskCount(int expectedCount) {
+
+ By completedTasks = AppiumBy.xpath(
+ "//android.widget.TextView[contains(@text,'Completed')]");
+
+ int actualCount = driver.findElements(completedTasks).size();
+
+ Assert.assertEquals(
+ actualCount,
+ expectedCount,
+ "Mismatch in completed task count"
+ );
+ }
+
+ // ==========================================================
+ // LONG PRESS HELPER
+ // ==========================================================
+ private void longPressElement(By locator) {
+
+ var element = wait.until(
+ ExpectedConditions.visibilityOfElementLocated(locator));
+
+ int centerX = element.getLocation().getX() + element.getSize().getWidth() / 2;
+ int centerY = element.getLocation().getY() + element.getSize().getHeight() / 2;
+
+ PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
+ Sequence longPress = new Sequence(finger, 1);
+
+ longPress.addAction(finger.createPointerMove(
+ Duration.ZERO,
+ PointerInput.Origin.viewport(),
+ centerX,
+ centerY));
+
+ longPress.addAction(finger.createPointerDown(
+ PointerInput.MouseButton.LEFT.asArg()));
+
+ longPress.addAction(new Pause(finger, Duration.ofSeconds(1)));
+
+ longPress.addAction(finger.createPointerUp(
+ PointerInput.MouseButton.LEFT.asArg()));
+
+ driver.perform(Collections.singletonList(longPress));
+ }
+
+ @AfterClass
+ public void tearDown() {
+ if (driver != null) {
+ driver.quit();
+ }
+ }
+}
diff --git a/Cucumber/Activities/ActivitiesRunner.java b/Cucumber/Activities/ActivitiesRunner.java
new file mode 100644
index 0000000000..59dc3024a3
--- /dev/null
+++ b/Cucumber/Activities/ActivitiesRunner.java
@@ -0,0 +1,21 @@
+package testRunner;
+
+
+import org.junit.platform.suite.api.Suite;
+import org.junit.platform.suite.api.IncludeEngines;
+import org.junit.platform.suite.api.ConfigurationParameter;
+import org.junit.platform.suite.api.SelectClasspathResource;
+
+import io.cucumber.junit.platform.engine.Constants;
+
+@Suite
+@IncludeEngines("cucumber")
+@SelectClasspathResource("Features")
+@ConfigurationParameter(
+ key = Constants.GLUE_PROPERTY_NAME, value = "stepDefinitions"
+)
+@ConfigurationParameter(
+ key = Constants.FILTER_TAGS_PROPERTY_NAME, value = "@activity2"
+)
+
+public class ActivitiesRunner {}
\ No newline at end of file
diff --git a/Cucumber/Activities/Activity1.feature b/Cucumber/Activities/Activity1.feature
new file mode 100644
index 0000000000..1e1365e1a2
--- /dev/null
+++ b/Cucumber/Activities/Activity1.feature
@@ -0,0 +1,7 @@
+@activity1
+Feature: Basic Syntax
+
+ Scenario: Opening a webpage using Selenium
+ Given user is on the TS homepage
+ When the user clicks on the About Us link
+ Then they are redirected to another page
diff --git a/Cucumber/Activities/Activity2.feature b/Cucumber/Activities/Activity2.feature
new file mode 100644
index 0000000000..205e391c6b
--- /dev/null
+++ b/Cucumber/Activities/Activity2.feature
@@ -0,0 +1,8 @@
+@activity2
+Feature: Activity to test the login feature
+
+ Scenario: Successful login
+ Given the user is on the login page
+ When the user enters username and password
+ And clicks the submit button
+ Then get the confirmation message and verify it
\ No newline at end of file
diff --git a/Cucumber/Activities/Activity3.feature b/Cucumber/Activities/Activity3.feature
new file mode 100644
index 0000000000..4a4a440730
--- /dev/null
+++ b/Cucumber/Activities/Activity3.feature
@@ -0,0 +1,44 @@
+@activity3
+Feature: Testing with Tags
+
+ @SimpleAlert @SmokeTest
+ Scenario: Test for Simple Alert
+ Given User is on the page
+ When User clicks the Simple Alert button
+ Then Alert opens
+ And Read the text from it and print it
+ And Close the alert
+ And Read the result text
+
+ @ConfirmAlert
+ Scenario: Test for Confirm Alert
+ Given User is on the page
+ When User clicks the Confirmation Alert button
+ Then Alert opens
+ And Read the text from it and print it
+ And Close the alert with Cancel
+ And Read the result text
+
+ @PromptAlert
+ Scenario: Test for Prompt Alert
+ Given User is on the page
+ When User clicks the Prompt Alert button
+ Then Alert opens
+ And Read the text from it and print it
+ And Write a custom message in it
+ And Close the alert
+ And Read the result text
+
+ # An alternate approach using Scenario outline
+ Scenario Outline:
+ Given User is on the page
+ When User clicks the Alert button
+ Then Alert opens
+ And Read the text from it and print it
+ And Close the alert
+ And Read the result text
+ Examples:
+ | Type |
+ | Simple |
+ | Confirmation |
+ | Prompt |
\ No newline at end of file
diff --git a/Cucumber/Activities/Activity4.feature b/Cucumber/Activities/Activity4.feature
new file mode 100644
index 0000000000..7e5eb7fc1d
--- /dev/null
+++ b/Cucumber/Activities/Activity4.feature
@@ -0,0 +1,8 @@
+@activity4
+Feature: Data driven test without Examples
+
+ Scenario: Testing with correct data from inputs
+ Given the user is on the login page
+ When the user enters "admin" and "password"
+ And clicks the submit button
+ Then get the confirmation text and verify message as "Welcome Back, Admin!"
\ No newline at end of file
diff --git a/Cucumber/Activities/Activity5.feature b/Cucumber/Activities/Activity5.feature
new file mode 100644
index 0000000000..68a5731077
--- /dev/null
+++ b/Cucumber/Activities/Activity5.feature
@@ -0,0 +1,13 @@
+@activity5
+Feature: Data driven test with Examples
+
+ Scenario Outline: Testing with Data from Scenario
+ Given the user is on the login page
+ When the user enters "" and ""
+ And clicks the submit button
+ Then get the confirmation text and verify message as "Invalid credentials"
+
+ Examples:
+ | Usernames | Passwords |
+ | admin | password123 |
+ | admin | wrongPassword |
\ No newline at end of file
diff --git a/Cucumber/Activities/Activity6.feature b/Cucumber/Activities/Activity6.feature
new file mode 100644
index 0000000000..5855ecd2c7
--- /dev/null
+++ b/Cucumber/Activities/Activity6.feature
@@ -0,0 +1,10 @@
+@activity6
+Feature: To test input with Datatables
+
+Scenario: Adding items to a to-do list
+ Given user is on the To-Do list page
+ When user adds the following tasks
+ | task1 |
+ | task2 |
+ | task3 |
+ Then they can see the task added to the list
\ No newline at end of file
diff --git a/Cucumber/Activities/ActivityTestRunner.java b/Cucumber/Activities/ActivityTestRunner.java
new file mode 100644
index 0000000000..f89fb461f3
--- /dev/null
+++ b/Cucumber/Activities/ActivityTestRunner.java
@@ -0,0 +1,20 @@
+package testRunner;
+
+import org.junit.platform.suite.api.Suite;
+import org.junit.platform.suite.api.IncludeEngines;
+import org.junit.platform.suite.api.ConfigurationParameter;
+import org.junit.platform.suite.api.SelectClasspathResource;
+
+import io.cucumber.junit.platform.engine.Constants;
+
+@Suite
+@IncludeEngines("cucumber")
+@SelectClasspathResource("Features")
+@ConfigurationParameter(
+ key = Constants.GLUE_PROPERTY_NAME, value = "stepDefinitions"
+)
+@ConfigurationParameter(
+ key = Constants.FILTER_TAGS_PROPERTY_NAME, value = "@activity3"
+)
+
+public class ActivityTestRunner {}
\ No newline at end of file
diff --git a/Cucumber/Activities/AlertTestSteps.java b/Cucumber/Activities/AlertTestSteps.java
new file mode 100644
index 0000000000..0e463cbb41
--- /dev/null
+++ b/Cucumber/Activities/AlertTestSteps.java
@@ -0,0 +1,66 @@
+package stepDefinitions;
+
+
+import org.openqa.selenium.Alert;
+import org.openqa.selenium.By;
+
+import io.cucumber.java.en.And;
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+
+public class AlertTestSteps extends BaseClass {
+ Alert alert;
+
+ @Given("User is on the page")
+ public void openPage() {
+ // Open browser
+ driver.get("https://training-support.net/webelements/alerts");
+ }
+
+ @When("User clicks the Simple Alert button")
+ public void openSimpleAlert() {
+ driver.findElement(By.id("simple")).click();
+ }
+
+ @When("User clicks the Confirmation Alert button")
+ public void openConfirmAlert() {
+ driver.findElement(By.id("confirmation")).click();
+ }
+
+ @When("User clicks the Prompt Alert button")
+ public void openPromptAlert() {
+ driver.findElement(By.id("prompt")).click();
+ }
+
+ @Then("Alert opens")
+ public void switchFocus() {
+ alert = driver.switchTo().alert();
+ }
+
+ @And("Read the text from it and print it")
+ public void readAlert() {
+ System.out.println("Alert says: " + alert.getText());
+ }
+
+ @And("Write a custom message in it")
+ public void writeToPrompt() {
+ alert.sendKeys("Custom Message");
+ }
+
+ @And("Close the alert")
+ public void closeAlert() {
+ alert.accept();
+ }
+
+ @And("Close the alert with Cancel")
+ public void closeAlertWithCAncel() {
+ alert.dismiss();
+ }
+
+ @And("Read the result text")
+ public void readResultText() {
+ String message = driver.findElement(By.id("result")).getText();
+ System.out.println("Action performed: " + message);
+ }
+}
\ No newline at end of file
diff --git a/Cucumber/Activities/BaseClass.java b/Cucumber/Activities/BaseClass.java
new file mode 100644
index 0000000000..8fd8b605f7
--- /dev/null
+++ b/Cucumber/Activities/BaseClass.java
@@ -0,0 +1,24 @@
+package stepDefinitions;
+
+import java.time.Duration;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class BaseClass {
+
+ protected static WebDriver driver;
+ protected static WebDriverWait wait;
+
+ protected void initDriver(WebDriver webDriver) {
+ driver = webDriver;
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ driver.manage().window().maximize();
+ }
+
+ protected void quitDriver() {
+ if (driver != null) {
+ driver.quit();
+ driver = null;
+ }
+ }
+}
diff --git a/Cucumber/Activities/Fixtures.java b/Cucumber/Activities/Fixtures.java
new file mode 100644
index 0000000000..7df1a4a825
--- /dev/null
+++ b/Cucumber/Activities/Fixtures.java
@@ -0,0 +1,23 @@
+package stepDefinitions;
+
+import java.time.Duration;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class Fixtures extends BaseClass {
+ @BeforeAll
+ public static void setUp() {
+ // Initialize Firefox Driver
+ driver = new FirefoxDriver();
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ }
+
+ @AfterAll
+ public static void tearDown() {
+ // Close the browser
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Cucumber/Activities/Hooks.java b/Cucumber/Activities/Hooks.java
new file mode 100644
index 0000000000..00c7559c9c
--- /dev/null
+++ b/Cucumber/Activities/Hooks.java
@@ -0,0 +1,19 @@
+package hooks;
+
+import io.cucumber.java.After;
+import io.cucumber.java.Before;
+import org.openqa.selenium.chrome.ChromeDriver;
+import stepDefinitions.BaseClass;
+
+public class Hooks extends BaseClass {
+
+ @Before
+ public void setUp() {
+ initDriver(new ChromeDriver());
+ }
+
+ @After
+ public void tearDown() {
+ quitDriver();
+ }
+}
diff --git a/Cucumber/Activities/LoginSteps.java b/Cucumber/Activities/LoginSteps.java
new file mode 100644
index 0000000000..ff2c12a214
--- /dev/null
+++ b/Cucumber/Activities/LoginSteps.java
@@ -0,0 +1,44 @@
+package stepDefinitions;
+
+import org.junit.jupiter.api.Assertions;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import io.cucumber.java.en.And;
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+
+public class LoginSteps extends BaseClass {
+ @Given("the user is on the login page")
+ public void openPage() {
+ // Open the login page
+ driver.get("https://training-support.net/webelements/login-form");
+ // Assert page title
+ Assertions.assertEquals("Selenium: Login Form", driver.getTitle());
+ }
+
+ @When("the user enters username and password")
+ public void enterCredentials() {
+ // Find username field and enter username
+ driver.findElement(By.id("username")).sendKeys("admin");
+ // Find password field and enter password
+ driver.findElement(By.id("password")).sendKeys("password");
+ }
+
+ @And("clicks the submit button")
+ public void clickSubmit() {
+ // Find the submit button and click it
+ driver.findElement(By.xpath("//button[text()='Submit']")).click();
+ }
+
+ @Then("get the confirmation message and verify it")
+ public void confirmMessage() {
+ // Find the confirmation message
+ wait.until(ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("h2.mt-5"), "Welcome"));
+ String message = driver.findElement(By.cssSelector("h2.mt-5")).getText();
+ // Assert message
+ Assertions.assertEquals("Welcome Back, Admin!", message);
+ }
+}
\ No newline at end of file
diff --git a/Cucumber/Activities/TestRunner.java b/Cucumber/Activities/TestRunner.java
new file mode 100644
index 0000000000..0d4824e20a
--- /dev/null
+++ b/Cucumber/Activities/TestRunner.java
@@ -0,0 +1,20 @@
+package testRunner;
+
+import org.junit.platform.suite.api.ConfigurationParameter;
+import org.junit.platform.suite.api.IncludeEngines;
+import org.junit.platform.suite.api.SelectClasspathResource;
+import org.junit.platform.suite.api.Suite;
+
+import io.cucumber.junit.platform.engine.Constants;
+
+@Suite
+@IncludeEngines("cucumber")
+@SelectClasspathResource("features")
+@ConfigurationParameter(
+ key = Constants.GLUE_PROPERTY_NAME,
+ value = "stepDefinitions,hooks")
+@ConfigurationParameter(
+ key = Constants.FILTER_TAGS_PROPERTY_NAME,
+ value = "@activity1")
+public class TestRunner {
+}
diff --git a/Java/Activities/Car.java b/Java/Activities/Car.java
new file mode 100644
index 0000000000..c5bded73b4
--- /dev/null
+++ b/Java/Activities/Car.java
@@ -0,0 +1,33 @@
+package activity;
+
+public class Car {
+ String color;
+ String transmission;
+ int make;
+ int tyres;
+ int doors;
+
+ // Constructor
+ public Car() {
+ this.tyres = 4;
+ this.doors = 4;
+ }
+
+ public void displayCharacteristics() {
+ System.out.println("Color: " + color);
+ System.out.println("Transmission: " + transmission);
+ System.out.println("Make: " + make);
+ System.out.println("Number of tyres: " + tyres);
+ System.out.println("Number of doors: " + doors);
+ }
+
+ // Method for accelerating
+ public void accelarate() {
+ System.out.println("Car is moving forward.");
+ }
+
+ // Method for braking
+ public void brake() {
+ System.out.println("Car has stopped.");
+ }
+}
diff --git a/Java/Activities/activity1.java b/Java/Activities/activity1.java
new file mode 100644
index 0000000000..1e08545cc0
--- /dev/null
+++ b/Java/Activities/activity1.java
@@ -0,0 +1,19 @@
+package activity;
+
+public class activity1 {
+ public static void main(String[] args) {
+
+ // Create an object of the Car class
+ Car carName = new Car();
+
+ // Initialize values
+ carName.make = 2014;
+ carName.color = "Black";
+ carName.transmission = "Manual";
+
+ // Call methods
+ carName.displayCharacteristics();
+ carName.accelarate();
+ carName.brake();
+ }
+}
diff --git a/Java/Activities/activity10.java b/Java/Activities/activity10.java
new file mode 100644
index 0000000000..5ad11ed7ab
--- /dev/null
+++ b/Java/Activities/activity10.java
@@ -0,0 +1,35 @@
+package activity;
+
+import java.util.HashSet;
+
+public class activity10 {
+ public static void main(String[] args) {
+ HashSet hs = new HashSet();
+ // Adding element to HashSet
+ hs.add("M");
+ hs.add("B");
+ hs.add("C");
+ hs.add("A");
+ hs.add("M");
+ hs.add("Z");
+
+ //Print HashSet
+ System.out.println("Original HashSet: " + hs);
+ //Print size of HashSet
+ System.out.println("Size of HashSet: " + hs.size());
+
+ //Remove element
+ System.out.println("Removing A from HashSet: " + hs.remove("A"));
+ //Remove element that is not present
+ if(hs.remove("Z")) {
+ System.out.println("Z removed from the Set");
+ } else {
+ System.out.println("Z is not present in the Set");
+ }
+
+ //Search for element
+ System.out.println("Checking if M is present: " + hs.contains("M"));
+ //Print updated HashSet
+ System.out.println("Updated HashSet: " + hs);
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity11.java b/Java/Activities/activity11.java
new file mode 100644
index 0000000000..c9298135b9
--- /dev/null
+++ b/Java/Activities/activity11.java
@@ -0,0 +1,32 @@
+package activity;
+
+import java.util.HashMap;
+
+public class activity11 {
+ public static void main(String[] args) {
+ HashMap hash_map = new HashMap();
+ hash_map.put(1, "Red");
+ hash_map.put(2, "Green");
+ hash_map.put(3, "Blue");
+ hash_map.put(4, "White");
+ hash_map.put(5, "Black");
+
+ // Print the Map
+ System.out.println("The Original map: " + hash_map);
+
+ // Remove one colour
+ hash_map.remove(4);
+ // Map after removing a colour
+ System.out.println("After removing White: " + hash_map);
+
+ // Check if green exists
+ if(hash_map.containsValue("Green")) {
+ System.out.println("Green exists in the Map");
+ } else {
+ System.out.println("Green does not exist in the Map");
+ }
+
+ // Print the size of the Map
+ System.out.println("Number of pairs in the Map is: " + hash_map.size());
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity12.java b/Java/Activities/activity12.java
new file mode 100644
index 0000000000..567609f8e1
--- /dev/null
+++ b/Java/Activities/activity12.java
@@ -0,0 +1,22 @@
+package activity;
+
+//package examples;
+
+interface Addable {
+ int add(int a, int b);
+}
+
+public class activity12 {
+ public static void main(String[] args) {
+
+ // Lambda expression without return keyword.
+ Addable ad1 = (a, b) -> (a + b);
+ System.out.println(ad1.add(10, 20));
+
+ // Lambda expression with return keyword.
+ Addable ad2 = (int a, int b) -> {
+ return (a + b);
+ };
+ System.out.println(ad2.add(100, 200));
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity13.java b/Java/Activities/activity13.java
new file mode 100644
index 0000000000..d92ecce684
--- /dev/null
+++ b/Java/Activities/activity13.java
@@ -0,0 +1,26 @@
+package activity;
+
+import java.util.*;
+
+public class activity13 {
+
+ public static void main(String[] args) {
+ Scanner scan = new Scanner(System.in);
+ ArrayList list = new ArrayList();
+ Random indexGen = new Random();
+
+ System.out.print("Enter integers please ");
+ System.out.println("(EOF or non-integer to terminate): ");
+
+ while(scan.hasNextInt()) {
+ list.add(scan.nextInt());
+ }
+
+ Integer nums[] = list.toArray(new Integer[0]);
+ int index = indexGen.nextInt(nums.length);
+ System.out.println("Index value generated: " + index);
+ System.out.println("Value in array at generated index: " + nums[index]);
+
+ scan.close();
+ }
+}
diff --git a/Java/Activities/activity14.java b/Java/Activities/activity14.java
new file mode 100644
index 0000000000..6467d19843
--- /dev/null
+++ b/Java/Activities/activity14.java
@@ -0,0 +1,38 @@
+package activity;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+import org.apache.commons.io.FileUtils;
+
+public class activity14 {
+ public static void main(String[] args) throws IOException {
+ try {
+ File file = new File("src/main/resources/newfile.txt");
+ boolean fStatus = file.createNewFile();
+ if(fStatus) {
+ System.out.println("File created successfully!");
+ FileUtils.writeStringToFile(file, "Some text in a file", Charset.defaultCharset());
+ } else {
+ System.out.println("File already exists at this path.");
+ }
+
+ // Read file
+ System.out.println("Data in file: " + FileUtils.readFileToString(file, "UTF8"));
+
+ // Create directory
+ File destDir = new File("src/main/resources/destDir");
+ // Copy file to directory
+ FileUtils.copyFileToDirectory(file, destDir);
+
+ // Get file from new directory
+ File newFile = FileUtils.getFile(destDir, "newfile.txt");
+ // Read data from file
+ String newFileData = FileUtils.readFileToString(newFile, "UTF8");
+ // Print it
+ System.out.println("Data in new file: " + newFileData);
+ } catch(IOException errMessage) {
+ System.out.println(errMessage);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity2.java b/Java/Activities/activity2.java
new file mode 100644
index 0000000000..266457bc27
--- /dev/null
+++ b/Java/Activities/activity2.java
@@ -0,0 +1,28 @@
+package activity;
+
+public class activity2 {
+ public static void main(String[] args) {
+
+ // Create an array with 6 numbers
+ int[] numbers = {10, 77, 10, 54, -11, 10};
+
+ // Variable to store the sum of all 10's
+ int sum = 0;
+
+ for (int i = 0; i < numbers.length; i++) {
+
+ // Check if the current number is 10
+ if (numbers[i] == 10) {
+ // Add 10 to the sum
+ sum = sum + 10;
+ }
+ }
+
+ // Check if the sum is exactly 30
+ boolean isThirty = (sum == 30);
+
+ // Print the results
+ System.out.println("Total of all 10's: " + sum);
+ System.out.println("Is the total exactly 30? " + isThirty);
+ }
+}
diff --git a/Java/Activities/activity3.java b/Java/Activities/activity3.java
new file mode 100644
index 0000000000..32abb0316d
--- /dev/null
+++ b/Java/Activities/activity3.java
@@ -0,0 +1,34 @@
+package activity;
+
+public class activity3 {
+ public static void main(String[] args) {
+
+ // Age in seconds
+ double ageInSeconds = 1000000000.0;
+
+ // One Earth year in seconds
+ double earthYearSeconds = 31557600.0;
+
+ // Calculate age on Earth
+ double ageOnEarth = ageInSeconds / earthYearSeconds;
+
+ // Calculate age on other planets (using their orbital period in Earth years)
+ double ageOnMercury = ageOnEarth / 0.2408467;
+ double ageOnVenus = ageOnEarth / 0.61519726;
+ double ageOnMars = ageOnEarth / 1.8808158;
+ double ageOnJupiter = ageOnEarth / 11.862615;
+ double ageOnSaturn = ageOnEarth / 29.447498;
+ double ageOnUranus = ageOnEarth / 84.016846;
+ double ageOnNeptune = ageOnEarth / 164.79132;
+
+ // Print results rounded to 2 decimal places
+ System.out.printf("Age on Earth: %.2f years%n", ageOnEarth);
+ System.out.printf("Age on Mercury: %.2f years%n", ageOnMercury);
+ System.out.printf("Age on Venus: %.2f years%n", ageOnVenus);
+ System.out.printf("Age on Mars: %.2f years%n", ageOnMars);
+ System.out.printf("Age on Jupiter: %.2f years%n", ageOnJupiter);
+ System.out.printf("Age on Saturn: %.2f years%n", ageOnSaturn);
+ System.out.printf("Age on Uranus: %.2f years%n", ageOnUranus);
+ System.out.printf("Age on Neptune: %.2f years%n", ageOnNeptune);
+ }
+}
diff --git a/Java/Activities/activity4.java b/Java/Activities/activity4.java
new file mode 100644
index 0000000000..20ccc46991
--- /dev/null
+++ b/Java/Activities/activity4.java
@@ -0,0 +1,37 @@
+package activity;
+
+public class activity4 {
+ public static void main(String[] args) {
+
+ int[] numbers = {5, 2, 9, 1, 5, 6};
+
+ // Insertion Sort
+ for (int i = 1; i < 2; i++) {
+
+ int key = numbers[i];
+ int j = i - 1;
+
+ // Move left to find correct position using FOR + IF/ELSE
+ for (; j >= 0; j--) {
+
+ if (numbers[j] > key) {
+ // Shift element to the right
+ numbers[j + 1] = numbers[j];
+ }
+ else {
+ // Correct position found → stop early
+ break;
+ }
+ }
+
+ // Insert the key into correct position
+ numbers[j+1] = key;
+ }
+
+ // Print sorted array
+ System.out.println("Sorted array:");
+ for (int i = 0; i < numbers.length; i++) {
+ System.out.print(numbers[i] + " ");
+ }
+ }
+}
diff --git a/Java/Activities/activity5.java b/Java/Activities/activity5.java
new file mode 100644
index 0000000000..76e796dd97
--- /dev/null
+++ b/Java/Activities/activity5.java
@@ -0,0 +1,38 @@
+package activity;
+
+//Abstract class
+abstract class Book {
+ String title;
+ //Abstract method
+ abstract void setTitle(String s);
+
+ //Concrete method
+ String getTitle() {
+ return title;
+ }
+}
+
+
+
+class MyBook extends Book {
+ //Define abstract method
+ public void setTitle(String s) {
+ title = s;
+ }
+}
+
+
+public class activity5 {
+
+ public static void main(String []args) {
+ //Initialize title of the book
+ String title = "Hover Car Racer";
+ //Create object for MyBook
+ Book newNovel = new MyBook();
+ //Set title
+ newNovel.setTitle(title);
+
+ //Print result
+ System.out.println("The title is: " + newNovel.getTitle());
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity6.java b/Java/Activities/activity6.java
new file mode 100644
index 0000000000..ee43ba90ca
--- /dev/null
+++ b/Java/Activities/activity6.java
@@ -0,0 +1,65 @@
+package activity;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+class Plane {
+ private List passengers;
+ private int maxPassengers;
+ private Date lastTimeTookOf;
+ private Date lastTimeLanded;
+
+ public Plane(int maxPassengers) {
+ this.maxPassengers = maxPassengers;
+ this.passengers = new ArrayList<>();
+ }
+
+ public void onboard(String passengerName) {
+ if(passengers.size() <= maxPassengers) {
+ this.passengers.add(passengerName);
+ } else {
+ System.out.println("Plane is full");
+ }
+ }
+
+ public Date takeOff() {
+ this.lastTimeTookOf = new Date();
+ return lastTimeTookOf;
+ }
+
+ public void land() {
+ this.lastTimeLanded = new Date();
+ this.passengers.clear();
+ }
+
+ public Date getLastTimeLanded() {
+ return lastTimeLanded;
+ }
+
+ public List getPassengers() {
+ return passengers;
+ }
+}
+
+public class activity6 {
+
+ public static void main(String[] args) throws InterruptedException {
+ //There is a plane with max 10 passengers
+ Plane plane = new Plane(10);
+ //Add passengers on the list
+ plane.onboard("John");
+ plane.onboard("Steve");
+ plane.onboard("Anna");
+ //Plane takes off
+ System.out.println("Plane took off at: " + plane.takeOff());
+ //Print list of people on board
+ System.out.println("People on the plane: " + plane.getPassengers());
+ //Flying.....
+ Thread.sleep(5000);
+ //Plane has landed
+ plane.land();
+ //Plane lands
+ System.out.println("Plane landed at: " + plane.getLastTimeLanded());
+ System.out.println("People on the plane after landing: " + plane.getPassengers());
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity7.java b/Java/Activities/activity7.java
new file mode 100644
index 0000000000..6f37b76a20
--- /dev/null
+++ b/Java/Activities/activity7.java
@@ -0,0 +1,72 @@
+package activity;
+interface BicycleParts {
+ public int tyres = 2;
+ public int maxSpeed = 25;
+}
+
+interface BicycleOperations {
+ public void applyBrake(int decrement);
+ public void speedUp(int increment);
+}
+
+//Base class
+class Bicycle implements BicycleParts, BicycleOperations {
+
+ public int gears;
+ public int currentSpeed;
+
+ //the Bicycle class has one constructor
+ public Bicycle(int gears, int currentSpeed) {
+ this.gears = gears;
+ this.currentSpeed = currentSpeed;
+ }
+
+ //Bicycle class has three methods
+ public void applyBrake(int decrement) {
+ currentSpeed -= decrement;
+ System.out.println("Current speed: " + currentSpeed);
+ }
+
+ public void speedUp(int increment) {
+ currentSpeed += increment;
+ System.out.println("Current speed: " + currentSpeed);
+ }
+
+ //Method to print info of Bicycle
+ public String bicycleDesc() {
+ return("No of gears are "+ gears + "\nSpeed of bicycle is " + maxSpeed);
+ }
+}
+
+//Derived class
+class MountainBike extends Bicycle {
+
+ //The MountainBike subclass adds one more field
+ public int seatHeight;
+
+ //The MountainBike subclass has one constructor
+ public MountainBike(int gears, int currentSpeed, int startHeight) {
+ //Invoking base-class(Bicycle) constructor
+ super(gears, currentSpeed);
+ seatHeight = startHeight;
+ }
+
+ // the MountainBike subclass adds one more method
+ public void setHeight(int newValue) {
+ seatHeight = newValue;
+ }
+
+ public String bicycleDesc() {
+ return (super.bicycleDesc()+ "\nSeat height is " + seatHeight);
+ }
+}
+
+//Driver class
+public class activity7 {
+ public static void main(String args[]) {
+ MountainBike mb = new MountainBike(3, 0, 25);
+ System.out.println(mb.bicycleDesc());
+ mb.speedUp(20);
+ mb.applyBrake(5);
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity8.java b/Java/Activities/activity8.java
new file mode 100644
index 0000000000..a86cf0b0c0
--- /dev/null
+++ b/Java/Activities/activity8.java
@@ -0,0 +1,36 @@
+package activity;
+
+class CustomException extends Exception {
+ private String message = null;
+
+ public CustomException(String message) {
+ this.message = message;
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+}
+
+public class activity8 {
+ public static void main(String[] a){
+ try {
+ // Method call with correct input
+ activity8.exceptionTest("Will print to console");
+ // Method call with incorrect input
+ activity8.exceptionTest(null); // Exception is thrown here
+ activity8.exceptionTest("Won't execute");
+ } catch(CustomException mae) {
+ System.out.println("Inside catch block: " + mae.getMessage());
+ }
+ }
+
+ static void exceptionTest(String str) throws CustomException {
+ if(str == null) {
+ throw new CustomException("String value is null");
+ } else {
+ System.out.println(str);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Java/Activities/activity9.java b/Java/Activities/activity9.java
new file mode 100644
index 0000000000..17994ce570
--- /dev/null
+++ b/Java/Activities/activity9.java
@@ -0,0 +1,31 @@
+package activity;
+
+
+import java.util.ArrayList;
+
+public class activity9 {
+ public static void main(String[] args) {
+ //declaring Arraylist of String objects
+ ArrayList myList = new ArrayList();
+ //Adding objects to Array List at default index
+ myList.add("Apple");
+ myList.add("Mango");
+ myList.add("Orange");
+ //Adding object at specific index
+ myList.add(3, "Chicku");
+ myList.add(1, "Papaya");
+
+ System.out.println("Print All the Objects:");
+ for(String s:myList){
+ System.out.println(s);
+ }
+
+ System.out.println("3rd element in the list is: " + myList.get(2));
+ System.out.println("Is Chicku is in list: " + myList.contains("Chicku"));
+ System.out.println("Size of ArrayList: " + myList.size());
+
+ myList.remove("Papaya");
+
+ System.out.println("New Size of ArrayList: " + myList.size());
+ }
+}
\ No newline at end of file
diff --git a/Python/Activities/activity1.py b/Python/Activities/activity1.py
new file mode 100644
index 0000000000..b86fb14719
--- /dev/null
+++ b/Python/Activities/activity1.py
@@ -0,0 +1,4 @@
+name = input( "What is your name: " )
+age = int( input( "How old are you: " ) )
+year = str( ( 2024 - age ) + 100 )
+print( name + " will be 100 years old in the year " + year )
\ No newline at end of file
diff --git a/Python/Activities/activity10.py b/Python/Activities/activity10.py
new file mode 100644
index 0000000000..cdb6c40376
--- /dev/null
+++ b/Python/Activities/activity10.py
@@ -0,0 +1,9 @@
+# Given tuple
+num_tuple = (10, 20, 33, 46, 55)
+print("Given list is ", num_tuple)
+
+# Print elements that are divisible by 5
+print("Elements that are divisible by 5:")
+for num in num_tuple:
+ if (num % 5 == 0):
+ print(num)
\ No newline at end of file
diff --git a/Python/Activities/activity11.py b/Python/Activities/activity11.py
new file mode 100644
index 0000000000..a8cb6e9d33
--- /dev/null
+++ b/Python/Activities/activity11.py
@@ -0,0 +1,14 @@
+fruit_shop = {
+ "apple": 10,
+ "banana": 15,
+ "orange": 8,
+ "peaches": 15
+}
+
+key_to_check = input("What are you looking for? ").lower()
+
+if key_to_check in fruit_shop:
+ price = fruit_shop[key_to_check]
+ print(f"Yes, {key_to_check} is available and its price is {price} rupees.")
+else:
+ print("No, this is not available")
\ No newline at end of file
diff --git a/Python/Activities/activity12.py b/Python/Activities/activity12.py
new file mode 100644
index 0000000000..be999c8652
--- /dev/null
+++ b/Python/Activities/activity12.py
@@ -0,0 +1,13 @@
+# Define function to calculate sum
+def calculateSum(num):
+ if num:
+ # Recursive function call
+ return num + calculateSum(num-1)
+ else:
+ return 0
+
+# Call calculateSum() function
+res = calculateSum(10)
+
+# Print result
+print(res)
\ No newline at end of file
diff --git a/Python/Activities/activity13.py b/Python/Activities/activity13.py
new file mode 100644
index 0000000000..8b98edbc6e
--- /dev/null
+++ b/Python/Activities/activity13.py
@@ -0,0 +1,15 @@
+# Custom function to calculate sum
+def calculate_sum(numbers):
+ sum = 0
+ for number in numbers:
+ sum += number
+ return sum
+
+# Define the list of numbers
+numList = [10, 40, 60, 90]
+
+# Call the sum() function with numList as argument
+result = calculate_sum(numList)
+
+# Print result with message
+print("The sum of all the elements is: " + str(result))
\ No newline at end of file
diff --git a/Python/Activities/activity14.py b/Python/Activities/activity14.py
new file mode 100644
index 0000000000..0c824d80dc
--- /dev/null
+++ b/Python/Activities/activity14.py
@@ -0,0 +1,14 @@
+def fibonacci(number):
+ if number <= 1:
+ return number
+ else:
+ return(fibonacci(number-1) + fibonacci(number-2))
+
+nterms = int(input("Enter a number: "))
+
+if nterms <= 0:
+ print("Please enter a positive number")
+else:
+ print("Fibonacci Sequence: ")
+ for i in range(nterms):
+ print(fibonacci(i))
\ No newline at end of file
diff --git a/Python/Activities/activity15.py b/Python/Activities/activity15.py
new file mode 100644
index 0000000000..b9431ec769
--- /dev/null
+++ b/Python/Activities/activity15.py
@@ -0,0 +1,4 @@
+try:
+ print(x)
+except NameError:
+ print("x hasn't been defined yet.")
\ No newline at end of file
diff --git a/Python/Activities/activity16.py b/Python/Activities/activity16.py
new file mode 100644
index 0000000000..a4b0f60fa9
--- /dev/null
+++ b/Python/Activities/activity16.py
@@ -0,0 +1,22 @@
+class Car:
+ 'This class represents a car'
+
+ def __init__(self, manufacturer, model, make, transmission, color):
+ self.manufacturer = manufacturer
+ self.model = model
+ self.make = make
+ self.transmission = transmission
+ self.color = color
+
+ def accelerate(self):
+ print(self.manufacturer + " " + self.model + " has started moving")
+
+ def stop(self):
+ print(self.manufacturer + " " + self.model + " has stopped moving")
+
+car1 = Car("Toyota", "Corolla", "2015", "Manual", "White")
+car2 = Car("Maruti", "800", "2013", "Manual", "Red")
+car3 = Car("Suzuki", "Swift", "2017", "Automatic", "Black")
+
+car1.accelerate()
+car1.stop()
\ No newline at end of file
diff --git a/Python/Activities/activity17.py b/Python/Activities/activity17.py
new file mode 100644
index 0000000000..79a316f1f1
--- /dev/null
+++ b/Python/Activities/activity17.py
@@ -0,0 +1,21 @@
+# Import pandas
+import pandas
+
+# Create a Dictionary that will hold our data
+data = {
+ "Usernames": ["admin", "Charles", "Deku"],
+ "Passwords": ["password", "Charl13", "AllMight"]
+}
+
+# Create a DataFrame using that data
+dataframe = pandas.DataFrame(data)
+
+# Print the DataFrame
+print(dataframe)
+
+"""
+ Write the DataFrame to a CSV file
+ To avoid writing the index numbers to the file as well
+ the index property is set to false
+"""
+dataframe.to_csv("sample.csv", index=False)
\ No newline at end of file
diff --git a/Python/Activities/activity18.py b/Python/Activities/activity18.py
new file mode 100644
index 0000000000..714aebcced
--- /dev/null
+++ b/Python/Activities/activity18.py
@@ -0,0 +1,28 @@
+# Import pandas
+import pandas
+
+# Read the CSV file and store it into a DataFrame
+dataframe = pandas.read_csv("sample.csv")
+
+# Print the full data
+print("Full Data: ")
+print(dataframe)
+
+# Print the values in the Usernames column only
+print("===============")
+print("Usernames:")
+print(dataframe["Usernames"])
+
+# Print the username and password of the second row
+print("===============")
+print("Username: ", dataframe["Usernames"][1], " | ", "Password: ", dataframe["Passwords"][1])
+
+#Sort the Usernames column in ascending order
+print("====================================")
+print("Data sorted in ascending Usernames:")
+print(dataframe.sort_values('Usernames'))
+
+#Sort the Passwords column in descending order
+print("====================================")
+print("Data sorted in descending Passwords:")
+print(dataframe.sort_values('Passwords', ascending=False))
\ No newline at end of file
diff --git a/Python/Activities/activity19.py b/Python/Activities/activity19.py
new file mode 100644
index 0000000000..4126aa0006
--- /dev/null
+++ b/Python/Activities/activity19.py
@@ -0,0 +1,24 @@
+# Import pandas
+import pandas
+from pandas import ExcelWriter
+
+# Create a dictionary that will be used to create the DataFrame
+data = {
+ 'FirstName':["Satvik", "Avinash", "Lahri"],
+ 'LastName':["Shah", "Kati", "Rath"],
+ 'Email':["satshah@example.com", "avinashK@example.com", "lahri.rath@example.com"],
+ 'PhoneNumber':["4537829158", "4892184058", "4528727830"]
+}
+
+# Create the DataFrame that will be written to the excel file
+dataframe = pandas.DataFrame(data)
+
+# Print the dataframe
+print(dataframe)
+
+# Write the dataframe to a Excel file
+writer = ExcelWriter('sample.xlsx')
+dataframe.to_excel(writer, 'Sheet1', index = False)
+
+# Commit data to the Excel file
+writer.close()
\ No newline at end of file
diff --git a/Python/Activities/activity2.py b/Python/Activities/activity2.py
new file mode 100644
index 0000000000..f6d4e274bd
--- /dev/null
+++ b/Python/Activities/activity2.py
@@ -0,0 +1,5 @@
+number = int(input("Enter a number: "))
+if number % 2 > 0:
+ print("You picked an odd number.")
+else:
+ print("You picked an even number.")
\ No newline at end of file
diff --git a/Python/Activities/activity20.py b/Python/Activities/activity20.py
new file mode 100644
index 0000000000..6ac1495405
--- /dev/null
+++ b/Python/Activities/activity20.py
@@ -0,0 +1,22 @@
+# Import pandas
+import pandas
+
+# Read data from Excel sheet
+dataframe = pandas.read_excel('sample.xlsx')
+
+# Print the dataframe
+print(dataframe)
+
+# Print the number of rows and columns
+print("====================================")
+print("Number of rows and columns:", dataframe.shape)
+
+# Print the data in the emails column only
+print("====================================")
+print("Emails:")
+print(dataframe['Email'])
+
+# Sort the data based on FirstName in ascending order and print the data
+print("====================================")
+print("Sorted data:")
+print(dataframe.sort_values('FirstName'))
\ No newline at end of file
diff --git a/Python/Activities/activity21_test.py b/Python/Activities/activity21_test.py
new file mode 100644
index 0000000000..da2e9c90b5
--- /dev/null
+++ b/Python/Activities/activity21_test.py
@@ -0,0 +1,55 @@
+import pytest
+
+# Additon test
+def test_addition():
+
+ # Initialize two numbers
+ num1 = 10
+ num2 = 15
+
+ # Add them
+ sum = num1 + num2
+
+ # Assertion
+ assert sum == 25
+
+# Subtraction test
+def test_subtraction():
+
+ # Initialize two numbers
+ num1 = 50
+ num2 = 35
+
+ # Subtract them
+ diff = num1 - num2
+
+ # Assertion
+ assert diff == 15
+
+# Multiplication test
+@pytest.mark.activity
+def test_multiplication():
+
+ # Initialize two numbers
+ num1 = 5
+ num2 = 20
+
+ # Multiply them
+ prod = num1 * num2
+
+ # Assertion
+ assert prod == 100
+
+# Division test
+@pytest.mark.activity
+def test_division():
+
+ # Initialize two numbers
+ num1 = 100
+ num2 = 5
+
+ # Divide them
+ quot = num1 / num2
+
+ # Assertion
+ assert quot == 20
\ No newline at end of file
diff --git a/Python/Activities/activity23_test.py b/Python/Activities/activity23_test.py
new file mode 100644
index 0000000000..f462232cce
--- /dev/null
+++ b/Python/Activities/activity23_test.py
@@ -0,0 +1,15 @@
+import pytest
+
+# Write test method
+
+def test_sum(num_list):
+
+ # Initialize sum
+ sum = 0
+
+ # Add number in the list
+ for n in num_list:
+ sum += n
+
+ # Assertion
+ assert sum == 55
\ No newline at end of file
diff --git a/Python/Activities/activity24_test.py b/Python/Activities/activity24_test.py
new file mode 100644
index 0000000000..64384ef9ed
--- /dev/null
+++ b/Python/Activities/activity24_test.py
@@ -0,0 +1,20 @@
+import pytest
+
+# Define a fixture for the wallet amount
+@pytest.fixture
+def wallet_amount():
+ amount = 0
+ return amount
+
+# Set up the paremeterized test method
+@pytest.mark.parametrize("earned, spent, expected", [ (30, 10, 20), (20, 2, 18), ])
+def test_transactions(wallet_amount, earned, spent, expected):
+
+ # Add money to your wallet
+ wallet_amount += earned
+
+ # Subtract amount from wallet
+ wallet_amount -= spent
+
+ # Assertion
+ assert wallet_amount == expected
\ No newline at end of file
diff --git a/Python/Activities/activity3.py b/Python/Activities/activity3.py
new file mode 100644
index 0000000000..56d6ce7c5b
--- /dev/null
+++ b/Python/Activities/activity3.py
@@ -0,0 +1,28 @@
+# Get the users names
+user1 = input("What is Player 1's name? ")
+user2 = input("What is Player 2's name? ")
+
+# Get the users choices
+user1_answer = input(user1 + ", do you want to choose rock, paper or scissors? ").lower()
+user2_answer = input(user2 + ", do you want to choose rock, paper or scissors? ").lower()
+
+# Run the algorithm to see who wins
+if user1_answer == user2_answer:
+ print("It's a tie!")
+elif user1_answer == 'rock':
+ if user2_answer == 'scissors':
+ print(user1+ " wins")
+ else:
+ print(user2+ " wins")
+elif user1_answer == 'scissors':
+ if user2_answer == 'paper':
+ print(user1+ " wins")
+ else:
+ print(user2+ " wins")
+elif user1_answer == 'paper':
+ if user2_answer == 'rock':
+ print(user1+ " wins")
+ else:
+ print(user2+ " wins")
+else:
+ print("Invalid input! You have not entered rock, paper or scissors, try again.")
\ No newline at end of file
diff --git a/Python/Activities/activity4.py b/Python/Activities/activity4.py
new file mode 100644
index 0000000000..398f5790c1
--- /dev/null
+++ b/Python/Activities/activity4.py
@@ -0,0 +1,46 @@
+# Get the names of the users
+user1 = input("What is Player 1's name? ")
+user2 = input("What is Player 2's name? ")
+
+# While looping endlessly
+while True:
+ # Ask User1's choice
+ user1_answer = input(user1 + ", do you want to choose rock, paper or scissors? ").lower()
+
+ # Ask User2's choice
+ user2_answer = input(user2 + ", do you want to choose rock, paper or scissors? ").lower()
+
+ # Run the algorithm to see who wins
+ if user1_answer == user2_answer:
+ print("It's a tie!")
+ elif user1_answer == 'rock':
+ if user2_answer == 'scissors':
+ print("Rock wins!")
+ else:
+ print("Paper wins!")
+ elif user1_answer == 'scissors':
+ if user2_answer == 'paper':
+ print("Scissors win!")
+ else:
+ print("Rock wins!")
+ elif user1_answer == 'paper':
+ if user2_answer == 'rock':
+ print("Paper wins!")
+ else:
+ print("Scissors win!")
+ else:
+ print("Invalid input! You have not entered rock, paper or scissors, try again.")
+
+ # Ask them if they want to play again
+ repeat = input("Do you want to play another round? Yes/No: ").lower()
+
+ # If they say yes, don't do anything
+ if(repeat == "yes"):
+ pass
+ # If they say no, exit the game
+ elif(repeat == "no"):
+ raise SystemExit
+ # If they say anything else, exit with an error message.
+ else:
+ print("You entered an invalid option. Exiting now.")
+ raise SystemExit
\ No newline at end of file
diff --git a/Python/Activities/activity5.py b/Python/Activities/activity5.py
new file mode 100644
index 0000000000..129d3838f4
--- /dev/null
+++ b/Python/Activities/activity5.py
@@ -0,0 +1,5 @@
+number = int(input("Input a number: "))
+
+# use for loop to iterate 10 times
+for i in range(1,11):
+ print(number, ' x ', i, ' = ', number*i)
\ No newline at end of file
diff --git a/Python/Activities/activity6.py b/Python/Activities/activity6.py
new file mode 100644
index 0000000000..d3e8c8a499
--- /dev/null
+++ b/Python/Activities/activity6.py
@@ -0,0 +1,2 @@
+for i in range(1,10):
+ print(str(i)*i)
\ No newline at end of file
diff --git a/Python/Activities/activity7.py b/Python/Activities/activity7.py
new file mode 100644
index 0000000000..aeac2f8827
--- /dev/null
+++ b/Python/Activities/activity7.py
@@ -0,0 +1,7 @@
+numbers = input("Enter a sequence of comma separated values: ").split(",")
+
+sum = 0
+for number in numbers:
+ sum += int(number)
+
+print(sum)
\ No newline at end of file
diff --git a/Python/Activities/activity8.py b/Python/Activities/activity8.py
new file mode 100644
index 0000000000..0506675dac
--- /dev/null
+++ b/Python/Activities/activity8.py
@@ -0,0 +1,15 @@
+# Given list of numbers
+numList = input("Enter a sequence of comma separated values: ").split(",")
+#numList = [10, 20, 30, 40, 10]
+print("Given list is ", numList)
+
+# Get first element in list
+firstElement = numList[0]
+# Get last element in list
+lastElement = numList[-1]
+
+# Check if first and last element are equal
+if (firstElement == lastElement):
+ print(True)
+else:
+ print(False)
\ No newline at end of file
diff --git a/Python/Activities/activity9.py b/Python/Activities/activity9.py
new file mode 100644
index 0000000000..06c42c9cd5
--- /dev/null
+++ b/Python/Activities/activity9.py
@@ -0,0 +1,35 @@
+# Given lists
+listOne = [10, 20, 23, 11, 17]
+listTwo = [13, 43, 24, 36, 12]
+
+# Print the lists
+print("First List ", listOne)
+print("Second List ", listTwo)
+
+# Declare a third list that will contain the result
+thirdList = []
+fourthList= []
+
+# Iterate through first list to get odd elements
+for num in listOne:
+ if (num % 2 != 0):
+ thirdList.append(num)
+
+# Iterate through first list to get even elements
+for num in listTwo:
+ if (num % 2 == 0):
+ thirdList.append(num)
+
+for num in listOne:
+ if (num % 2 == 0):
+ fourthList.append(num)
+
+# Iterate through first list to get even elements
+for num in listTwo:
+ if (num % 2 != 0):
+ fourthList.append(num)
+
+# Print result
+print("result List is:")
+print(thirdList)
+print(fourthList)
\ No newline at end of file
diff --git a/Rest_Assured/Activity1.java b/Rest_Assured/Activity1.java
new file mode 100644
index 0000000000..d6c1532915
--- /dev/null
+++ b/Rest_Assured/Activity1.java
@@ -0,0 +1,56 @@
+package Activity;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.equalTo;
+import java.util.HashMap;
+import java.util.Map;
+import org.testng.annotations.Test;
+import io.restassured.response.Response;
+
+public class Activity1 {
+ @Test(priority = 1)
+ public void addNewPet() {
+ Map reqBody = new HashMap<>();
+ reqBody.put("id", 77232);
+ reqBody.put("name", "Riley");
+ reqBody.put("status", "alive");
+
+ Response response = given()
+ .baseUri("https://petstore.swagger.io/v2/pet") // Set base URI
+ .header("Content-Type", "application/json") // Set headers
+ .body(reqBody) // Add request body
+ .when().post(); // Send POST request
+
+ // Assertion
+ response.then().body("id", equalTo(98765));
+ response.then().body("name", equalTo("billy"));
+ response.then().body("status", equalTo("hove"));
+ }
+
+ @Test(priority = 2)
+ public void getPetInfo() {
+ Response response = given()
+ .baseUri("https://petstore.swagger.io/v2/pet") // Set base URI
+ .header("Content-Type", "application/json") // Set headers
+ .when().pathParam("petId", 77232) // Set path parameter
+ .get("/{petId}"); // Send GET request
+
+ // Assertion
+ response.then().body("id", equalTo(98765));
+ response.then().body("name", equalTo("Riley"));
+ response.then().body("status", equalTo("alive"));
+ }
+
+ @Test(priority = 3)
+ public void deletePet() {
+ Response response = given()
+ .baseUri("https://petstore.swagger.io/v2/pet") // Set base URI
+ .header("Content-Type", "application/json") // Set headers
+ .when().pathParam("petId", 98765) // Set path parameter
+ .delete("/{petId}"); // Send DELETE request
+
+ // Assertion
+ response.then().body("code", equalTo(200));
+ response.then().body("message", equalTo("77232"));
+ }
+}
\ No newline at end of file
diff --git a/Rest_Assured/Activity2.java b/Rest_Assured/Activity2.java
new file mode 100644
index 0000000000..cf04b6d348
--- /dev/null
+++ b/Rest_Assured/Activity2.java
@@ -0,0 +1,71 @@
+package Activity;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.equalTo;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.testng.annotations.Test;
+
+import io.restassured.response.Response;
+
+public class Activity2 {
+
+ private static final String BASE_URI = "https://petstore.swagger.io/v2";
+
+ @Test(priority = 1)
+ public void addNewUserFromFile() {
+ Response response = given()
+ .baseUri(BASE_URI)
+ .header("Content-Type", "application/json")
+ .body(new File("src/test/resources/userInfo.json"))
+ .when()
+ .post("/user");
+
+ response.then()
+ .statusCode(200)
+ .body("code", equalTo(200))
+ .body("message", equalTo("6059"));
+ }
+
+ @Test(priority = 2)
+ public void getUserInfo() throws IOException {
+ File outputJSON = new File("src/test/java/Activity/userGETResponse.json");
+
+ Response response = given()
+ .baseUri(BASE_URI)
+ .pathParam("username", "samudra")
+ .when()
+ .get("/user/{username}");
+
+ // Write response to file
+ FileWriter writer = new FileWriter(outputJSON);
+ writer.write(response.getBody().asPrettyString());
+ writer.close();
+
+ response.then()
+ .statusCode(200)
+ .body("id", equalTo(9876))
+ .body("username", equalTo("DineshMurugesan"))
+ .body("firstName", equalTo("Dinesh"))
+ .body("lastName", equalTo("Murugesan"))
+ .body("email", equalTo("DineshMuru@mail.com"))
+ .body("phone", equalTo("9876543210"));
+ }
+
+ @Test(priority = 3)
+ public void deleteUser() {
+ Response response = given()
+ .baseUri(BASE_URI)
+ .pathParam("username", "DineshMurugesan")
+ .when()
+ .delete("/user/{username}");
+
+ response.then()
+ .statusCode(200)
+ .body("code", equalTo(200))
+ .body("message", equalTo("DineshMurugesan"));
+ }
+}
diff --git a/Rest_Assured/Activity3.java b/Rest_Assured/Activity3.java
new file mode 100644
index 0000000000..d6179b9889
--- /dev/null
+++ b/Rest_Assured/Activity3.java
@@ -0,0 +1,93 @@
+package Activity;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.equalTo;
+import java.util.HashMap;
+import java.util.Map;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import io.restassured.builder.RequestSpecBuilder;
+import io.restassured.builder.ResponseSpecBuilder;
+import io.restassured.specification.RequestSpecification;
+import io.restassured.specification.ResponseSpecification;
+
+public class Activity3 {
+ // Declare request specification
+ RequestSpecification requestSpec;
+ // Declare response specification
+ ResponseSpecification responseSpec;
+
+ @BeforeClass
+ public void setUp() {
+ // Create request specification
+ requestSpec = new RequestSpecBuilder()
+ // Set content type
+ .addHeader("Content-Type", "application/json")
+ // Set base URL
+ .setBaseUri("https://petstore.swagger.io/v2/pet")
+ // Build request specification
+ .build();
+
+ responseSpec = new ResponseSpecBuilder()
+ // Check status code in response
+ .expectStatusCode(200)
+ // Check response content type
+ .expectContentType("application/json")
+ // Check if response contains name property
+ .expectBody("status", equalTo("alive"))
+ // Build response specification
+ .build();
+ }
+
+ @DataProvider(name = "petInfo")
+ public Object[][] petInfoProvider() {
+ // Setting parameters to pass to test case
+ Object[][] testData = new Object[][] {
+ { 98765, "billy", "hove" },
+ { 98766, "bobby", "brown" }
+ };
+ return testData;
+ }
+
+ @Test(priority=1, dataProvider = "petInfo")
+ // Test case using a DataProvider
+ public void addPets(int petId, String petName, String petStatus) {
+ Map reqBody = new HashMap<>();
+ reqBody.put("id", petId);
+ reqBody.put("name", petName);
+ reqBody.put("status", petStatus);
+
+ given().spec(requestSpec) // Use requestSpec
+ .body(reqBody) // Send request body
+ .when()
+ .post() // Send POST request
+ .then().spec(responseSpec) // Assertions using responseSpec
+ .body("name", equalTo(petName)); // Additional Assertion
+ }
+
+ // Test case using a DataProvider
+ @Test( priority=2, dataProvider = "petInfo")
+ public void getPets(int petId, String petName, String petStatus) {
+ given().spec(requestSpec) // Use requestSpec
+ .pathParam("petId", petId) // Add path parameter
+ .log().all() // Log for request details
+ .when()
+ .get("/{petId}") // Send GET request
+ .then().spec(responseSpec) // Assertions using responseSpec
+ .body("name", equalTo(petName)) // Additional Assertion
+ .log().all(); // Log for request details
+ }
+
+ // Test case using a DataProvider
+ @Test(priority=3, dataProvider = "petInfo")
+ public void deletePets(int petId, String petName, String petStatus) {
+ given().spec(requestSpec) // Use requestSpec
+ .pathParam("petId", petId) // Add path parameter
+ .when()
+ .delete("/{petId}") // Send GET request
+ .then()
+ .body("code", equalTo(200))
+ .body("message", equalTo(""+petId)); // Assertions using responseSpec
+ }
+}
\ No newline at end of file
diff --git a/Rest_Assured/userGETResponse.json b/Rest_Assured/userGETResponse.json
new file mode 100644
index 0000000000..e51c14f908
--- /dev/null
+++ b/Rest_Assured/userGETResponse.json
@@ -0,0 +1,10 @@
+{
+ "id": 9876,
+ "username": "DineshMurugesan",
+ "firstName": "Dinesh",
+ "lastName": "Murugesan",
+ "email": "DineshMuru@mail.com",
+ "password": "password123",
+ "phone": "9876543210",
+ "userStatus": 1
+}
\ No newline at end of file
diff --git a/SQL/Activities/activity1.sql.txt b/SQL/Activities/activity1.sql.txt
new file mode 100644
index 0000000000..10e5b18cca
--- /dev/null
+++ b/SQL/Activities/activity1.sql.txt
@@ -0,0 +1,7 @@
+-- Create salesman table
+CREATE TABLE salesman (
+ salesman_id int PRIMARY KEY,
+ salesman_name varchar2(32),
+ salesman_city varchar2(32),
+ commission int
+);
\ No newline at end of file
diff --git a/SQL/Activities/activity10.sql.txt b/SQL/Activities/activity10.sql.txt
new file mode 100644
index 0000000000..5b7b56bd57
--- /dev/null
+++ b/SQL/Activities/activity10.sql.txt
@@ -0,0 +1,16 @@
+-- Write a query to find all the orders issued against the salesman who may works for customer whose id is 3007.
+SELECT * FROM orders
+WHERE salesman_id=(SELECT DISTINCT salesman_id FROM orders WHERE customer_id=3007);
+
+-- Write a query to find all orders attributed to a salesman in New York.
+SELECT * FROM orders
+WHERE salesman_id IN (SELECT salesman_id FROM salesman WHERE salesman_city='New York');
+
+-- Write a query to count the customers with grades above New York's average.
+SELECT grade, COUNT(*) FROM customers
+GROUP BY grade HAVING grade>(SELECT AVG(grade) FROM customers WHERE city='New York');
+
+-- Write a query to extract the data from the orders table for those salesman who earned the maximum commission
+SELECT order_no, purchase_amount, order_date, salesman_id FROM orders
+WHERE salesman_id IN( SELECT salesman_id FROM salesman
+WHERE commission=( SELECT MAX(commission) FROM salesman));
\ No newline at end of file
diff --git a/SQL/Activities/activity11.sql.txt b/SQL/Activities/activity11.sql.txt
new file mode 100644
index 0000000000..6b42ae47e2
--- /dev/null
+++ b/SQL/Activities/activity11.sql.txt
@@ -0,0 +1,17 @@
+-- Write a query that produces the name and number of each salesman and each customer with more than one current order. Put the results in alphabetical order
+SELECT customer_id, customer_name FROM customers a
+WHERE 1<(SELECT COUNT(*) FROM orders b WHERE a.customer_id = b.customer_id)
+UNION
+SELECT salesman_id, salesman_name FROM salesman a
+WHERE 1<(SELECT COUNT(*) FROM orders b WHERE a.salesman_id = b.salesman_id)
+ORDER BY customer_name;
+
+-- Write a query to make a report of which salesman produce the largest and smallest orders on each date.
+SELECT a.salesman_id, a.salesman_name, o.order_no, 'highest on', o.order_date, o.purchase_amount FROM salesman a, orders o
+WHERE a.salesman_id=o.salesman_id
+AND o.purchase_amount=(SELECT MAX(purchase_amount) FROM orders c WHERE c.order_date = o.order_date)
+UNION
+SELECT a.salesman_id, a.salesman_name, o.order_no, 'lowest on', o.order_date, o.purchase_amount FROM salesman a, orders o
+WHERE a.salesman_id=o.salesman_id
+AND o.purchase_amount=(SELECT MIN(purchase_amount) FROM orders c WHERE c.order_date = o.order_date)
+ORDER BY order_date;
\ No newline at end of file
diff --git a/SQL/Activities/activity2.sql.txt b/SQL/Activities/activity2.sql.txt
new file mode 100644
index 0000000000..26814ea9e7
--- /dev/null
+++ b/SQL/Activities/activity2.sql.txt
@@ -0,0 +1,14 @@
+-- Insert one row
+INSERT INTO salesman VALUES(5001, 'James Hoog', 'New York', 15);
+INSERT INTO salesman VALUES(5002, 'Nail Knite', 'Paris', 13);
+
+-- Insert multiple rows at once
+INSERT ALL
+ INTO salesman VALUES(5005, 'Pit Alex', 'London', 11)
+ INTO salesman VALUES(5006, 'McLyon', 'Paris', 14)
+ INTO salesman VALUES(5007, 'Paul Adam', 'Rome', 13)
+ INTO salesman VALUES(5003, 'Lauson Hen', 'San Jose', 12)
+SELECT 1 FROM DUAL;
+
+-- View data from all columns
+SELECT * FROM salesman;
\ No newline at end of file
diff --git a/SQL/Activities/activity3.sql.txt b/SQL/Activities/activity3.sql.txt
new file mode 100644
index 0000000000..454f153316
--- /dev/null
+++ b/SQL/Activities/activity3.sql.txt
@@ -0,0 +1,8 @@
+-- Show data from the salesman_id and city columns
+SELECT salesman_id, salesman_city FROM salesman;
+
+-- Show data of salesman from Paris
+SELECT * FROM salesman WHERE salesman_city='Paris';
+
+-- Show salesman_id and commission of Paul Adam
+SELECT salesman_id, commission FROM salesman WHERE salesman_name='Paul Adam';
\ No newline at end of file
diff --git a/SQL/Activities/activity4.sql.txt b/SQL/Activities/activity4.sql.txt
new file mode 100644
index 0000000000..80699fdc6b
--- /dev/null
+++ b/SQL/Activities/activity4.sql.txt
@@ -0,0 +1,8 @@
+-- Add the grade column
+ALTER TABLE salesman ADD grade int;
+
+-- Update the values in the grade column
+UPDATE salesman SET grade=100;
+
+-- Display data
+SELECT * FROM salesman;
\ No newline at end of file
diff --git a/SQL/Activities/activity5.sql.txt b/SQL/Activities/activity5.sql.txt
new file mode 100644
index 0000000000..45ea43867a
--- /dev/null
+++ b/SQL/Activities/activity5.sql.txt
@@ -0,0 +1,11 @@
+-- Update the grade score of salesmen from Rome to 200.
+UPDATE salesman SET grade=200 WHERE salesman_city='Rome';
+
+-- Update the grade score of James Hoog to 300.
+UPDATE salesman SET grade=300 WHERE salesman_name='James Hoog';
+
+-- Update the name McLyon to Pierre.
+UPDATE salesman SET salesman_name='Pierre' WHERE salesman_name='McLyon';
+
+-- Display modified data
+SELECT * FROM salesman;
\ No newline at end of file
diff --git a/SQL/Activities/activity6.sql.txt b/SQL/Activities/activity6.sql.txt
new file mode 100644
index 0000000000..f1b8b5885e
--- /dev/null
+++ b/SQL/Activities/activity6.sql.txt
@@ -0,0 +1,14 @@
+-- Get all salesman ids without any repeated values
+select distinct salesman_id from orders;
+
+-- Display the order number ordered by date in ascending order
+select order_no, order_date from orders order by order_date;
+
+-- Display the order number ordered by purchase amount in descending order
+select order_no, purchase_amount from orders order by purchase_amount DESC;
+
+-- Display the full data of orders that have purchase amount less than 500.
+select * from orders where purchase_amount < 500;
+
+-- Display the full data of orders that have purchase amount between 1000 and 2000.
+select * from orders where purchase_amount between 1000 and 2000;
\ No newline at end of file
diff --git a/SQL/Activities/activity8.sql.txt b/SQL/Activities/activity8.sql.txt
new file mode 100644
index 0000000000..d78c2acc7e
--- /dev/null
+++ b/SQL/Activities/activity8.sql.txt
@@ -0,0 +1,11 @@
+-- Write an SQL statement to find the highest purchase amount ordered by the each customer with their ID and highest purchase amount.
+SELECT customer_id, MAX(purchase_amount) AS "Max Amount" FROM orders GROUP BY customer_id;
+
+-- Write an SQL statement to find the highest purchase amount on '2012-08-17' for each salesman with their ID.
+SELECT salesman_id, order_date, MAX(purchase_amount) AS "Max Amount" FROM orders
+WHERE order_date=To_DATE('2012/08/17', 'YYYY/MM/DD') GROUP BY salesman_id, order_date;
+
+-- Write an SQL statement to find the highest purchase amount with their ID and order date, for only those customers who have a higher purchase amount within the list 2030, 3450, 5760, and 6000.
+SELECT customer_id, order_date, MAX(purchase_amount) AS "Max Amount" FROM orders
+GROUP BY customer_id, order_date
+HAVING MAX(purchase_amount) IN(2030, 3450, 5760, 6000);
\ No newline at end of file
diff --git a/SQL/Activities/activity9.sql.txt b/SQL/Activities/activity9.sql.txt
new file mode 100644
index 0000000000..f6558fd2cf
--- /dev/null
+++ b/SQL/Activities/activity9.sql.txt
@@ -0,0 +1,9 @@
+-- Write an SQL statement to find the list of customers who appointed a salesman for their jobs who gets a commission of more than 12%
+SELECT a.customer_name AS "Customer Name", a.city, b.salesman_name AS "Salesman", b.commission FROM customers a
+INNER JOIN salesman b ON a.salesman_id=b.salesman_id
+WHERE b.commission>12;
+
+-- Write an SQL statement to find the following details of an order - order number, order date, purchase amount of order, which customer gives the order and which salesman works for that customer and commission rate they get for the order.
+SELECT a.order_no, a.order_date, a.purchase_amount, b.customer_name AS "Customer Name", b.grade, c.salesman_name AS "Salesman", c.commission FROM orders a
+INNER JOIN customers b ON a.customer_id=b.customer_id
+INNER JOIN salesman c ON a.salesman_id=c.salesman_id;
\ No newline at end of file
diff --git a/Selenium/Project/Activity1.java b/Selenium/Project/Activity1.java
new file mode 100644
index 0000000000..d3d4308a32
--- /dev/null
+++ b/Selenium/Project/Activity1.java
@@ -0,0 +1,24 @@
+package example;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+
+public class Activity1 {
+ public static void main(String[] args) {
+ // Initialize the Firefox Driver
+ WebDriver driver = new FirefoxDriver();
+
+ // Open the page
+ driver.get("https://training-support.net");
+
+ // Verify the page title
+ System.out.println("Page title is: " + driver.getTitle());
+ // Find the About Us link and click it
+ driver.findElement(By.linkText("About Us")).click();
+ // Print the page title of the About Us page
+ System.out.println("New page title is: " + driver.getTitle());
+
+ // Close the browser
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Selenium/Project/Activity2.java b/Selenium/Project/Activity2.java
new file mode 100644
index 0000000000..074b6da20d
--- /dev/null
+++ b/Selenium/Project/Activity2.java
@@ -0,0 +1,31 @@
+package example;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+
+public class Activity2 {
+ public static void main(String[] args) {
+ // Initialize the Firefox driver
+ WebDriver driver = new FirefoxDriver();
+
+ // Open the page
+ driver.get("https://training-support.net/webelements/login-form");
+ // Print the title of the page
+ System.out.println("Page title: " + driver.getTitle());
+
+ // Find the username field and enter the username
+ driver.findElement(By.id("username")).sendKeys("admin");
+ // Find the password field and enter the password
+ driver.findElement(By.id("password")).sendKeys("password");
+ // Find the login button and click it
+ driver.findElement(By.xpath("//button[text()='Submit']")).click();
+
+ // Print the confirmation message
+ String message = driver.findElement(By.tagName("h1")).getText();
+ System.out.println(message);
+
+ // Close the browser
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/Selenium/Project/activity_1.py b/Selenium/Project/activity_1.py
new file mode 100644
index 0000000000..3c9ea0650e
--- /dev/null
+++ b/Selenium/Project/activity_1.py
@@ -0,0 +1,17 @@
+# Import webdriver from selenium
+from selenium import webdriver
+from selenium.webdriver.common.by import By
+
+# Start the Driver
+with webdriver.Firefox() as driver:
+ # Navigate to the URL
+ driver.get("https://training-support.net/")
+
+ # Print the title of the page
+ print("Page title is: ", driver.title)
+
+ # Find the "About Us" button on the page using ID and click it
+ driver.find_element(By.LINK_TEXT, "About Us").click()
+
+ # Print the title of the new page
+ print("New page title is: ", driver.title)
\ No newline at end of file
diff --git a/Selenium/Project/activity_2.py b/Selenium/Project/activity_2.py
new file mode 100644
index 0000000000..af67b5fbd8
--- /dev/null
+++ b/Selenium/Project/activity_2.py
@@ -0,0 +1,29 @@
+# Import webdriver from selenium
+from selenium import webdriver
+from selenium.webdriver.common.by import By
+
+# Start the Driver
+with webdriver.Firefox() as driver:
+ # Navigate to the URL
+ driver.get("https://training-support.net/webelements/login-form")
+ # Print the title of the page
+ print("Page title is: ", driver.title)
+
+ # Find the username field
+ username = driver.find_element(By.ID, "username")
+ # Find the password field
+ password = driver.find_element(By.ID, "password")
+
+ # Enter the given credentials
+ # Enter username
+ username.send_keys("admin")
+ # Enter password
+ password.send_keys("password")
+
+ # Find the login button
+ login = driver.find_element(By.XPATH, "//button[text()='Submit']")
+ login.click()
+
+ # Print the login message
+ message = driver.find_element(By.CSS_SELECTOR, "h1.text-center")
+ print("Login message: ", message.text)
\ No newline at end of file
diff --git a/TestNG/Activities/Activity_1.java b/TestNG/Activities/Activity_1.java
new file mode 100644
index 0000000000..d219af99c9
--- /dev/null
+++ b/TestNG/Activities/Activity_1.java
@@ -0,0 +1,45 @@
+package activity;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class Activity_1 {
+ WebDriver driver;
+
+ // Setup function
+ @BeforeClass
+ public void setUp() {
+ // Initialize Firefox driver
+ driver = new FirefoxDriver();
+ // Open the page
+ driver.get("https://training-support.net");
+ }
+
+ // Test function
+ @Test(priority = 1)
+ public void homePageTest() {
+ // Assert page title
+ Assert.assertEquals(driver.getTitle(), "Training Support");
+
+ // Find and click the About page link
+ driver.findElement(By.linkText("About Us")).click();
+ }
+
+ @Test(priority = 2)
+ public void aboutPageTest() {
+ // Assert page title
+ Assert.assertEquals(driver.getTitle(), "About Training Support");
+ }
+
+ // Teardown function
+ @AfterClass
+ public void tearDown() {
+ // Close the browser
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/TestNG/Activities/Activity_10.java b/TestNG/Activities/Activity_10.java
new file mode 100644
index 0000000000..0434334f22
--- /dev/null
+++ b/TestNG/Activities/Activity_10.java
@@ -0,0 +1,107 @@
+package activity;
+
+import static org.testng.Assert.assertEquals;
+import java.io.FileInputStream;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class Activity_10 {
+ WebDriver driver;
+ WebDriverWait wait;
+
+ @BeforeClass
+ public void beforeClass() {
+ driver = new FirefoxDriver();
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+
+ // Open browser
+ driver.get("https://training-support.net/webelements/simple-form");
+ }
+
+ public static List> readExcel(String filePath) {
+ List> data = new ArrayList>();
+ try {
+ FileInputStream file = new FileInputStream(filePath);
+
+ // Create Workbook instance holding reference to Excel file
+ XSSFWorkbook workbook = new XSSFWorkbook(file);
+
+ // Get first sheet from the workbook
+ XSSFSheet sheet = workbook.getSheetAt(0);
+
+ // Iterate through each rows one by one
+ for (Row cells : sheet) {
+ // Temp variable
+ List rowData = new ArrayList();
+ for (Cell cell : cells) {
+ // Store row data
+ rowData.add(cell.getStringCellValue());
+ }
+ // Store row data in List
+ data.add(rowData);
+ }
+ file.close();
+ workbook.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return data;
+ }
+
+ @DataProvider(name = "Events")
+ public static Object[][] signUpInfo() {
+ String filePath = "src/test/resources/sample.xlsx";
+ List> data = readExcel(filePath);
+ return new Object[][] {
+ { data.get(1) },
+ { data.get(2) },
+ { data.get(3) }
+ };
+ }
+
+ @Test(dataProvider = "Events")
+ public void registerTest(List rows) throws InterruptedException {
+ // Find the input fields and enter text
+ WebElement fullName = driver.findElement(By.id("full-name"));
+ fullName.sendKeys(rows.get(0));
+
+ // Enter the email
+ driver.findElement(By.id("email")).sendKeys(rows.get(1));
+
+ // Enter the Date of the event
+ driver.findElement(By.name("event-date")).sendKeys(rows.get(2).replaceAll("\"", ""));
+
+ // Enter additional details
+ driver.findElement(By.id("additional-details")).sendKeys(rows.get(3));
+
+ // Click Submit
+ driver.findElement(By.xpath("//button[text()='Submit']")).click();
+
+ // Confirm booking
+ String message = driver.findElement(By.id("action-confirmation")).getText();
+ assertEquals(message, "Your event has been scheduled!");
+
+ // Refresh the page
+ driver.navigate().refresh();
+ }
+
+ @AfterClass
+ public void tearDown() {
+ // Close the browser
+ driver.quit();
+ }
+}
diff --git a/TestNG/Activities/Activity_2.java b/TestNG/Activities/Activity_2.java
new file mode 100644
index 0000000000..00eafbcdf8
--- /dev/null
+++ b/TestNG/Activities/Activity_2.java
@@ -0,0 +1,59 @@
+package activity;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class Activity_2 {
+ WebDriver driver;
+
+ @BeforeTest
+ public void beforeMethod() {
+ // Create a new instance of the Firefox driver
+ driver = new FirefoxDriver();
+
+ // Open the browser
+ driver.get("https://training-support.net/webelements/target-practice");
+ }
+
+ @Test
+ public void testCase1() {
+ // This test case will pass
+ String title = driver.getTitle();
+ System.out.println("Title is: " + title);
+ Assert.assertEquals(title, "Selenium: Target Practice");
+ }
+
+ @Test
+ public void testCase2() {
+ // This test case will Fail
+ WebElement blackButton = driver.findElement(By.cssSelector("button.black"));
+ Assert.assertTrue(blackButton.isDisplayed());
+ Assert.assertEquals(blackButton.getText(), "black");
+ }
+
+ @Test(enabled = false)
+ public void testCase3() {
+ // This test will be skipped and not counted
+ String subHeading = driver.findElement(By.className("sub")).getText();
+ Assert.assertTrue(subHeading.contains("Practice"));
+ }
+
+ @Test
+ public void testCase4() {
+ // This test will be skipped and will be be shown as skipped
+ throw new SkipException("Skipping test case");
+ }
+
+ @AfterTest
+ public void afterMethod() {
+ // Close the browser
+ driver.close();
+ }
+}
diff --git a/TestNG/Activities/Activity_3.java b/TestNG/Activities/Activity_3.java
new file mode 100644
index 0000000000..1d009479fb
--- /dev/null
+++ b/TestNG/Activities/Activity_3.java
@@ -0,0 +1,46 @@
+package activity;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class Activity_3 {
+ WebDriver driver;
+
+ @BeforeClass
+ public void beforeClass() {
+ driver = new FirefoxDriver();
+
+ // Open browser
+ driver.get("https://training-support.net/webelements/login-form");
+ }
+
+ @Test
+ public void loginTest() {
+ // Find the username and password fields
+ WebElement username = driver.findElement(By.id("username"));
+ WebElement password = driver.findElement(By.id("password"));
+
+ // Enter credentials
+ username.sendKeys("admin");
+ password.sendKeys("password");
+
+ // Click login
+ driver.findElement(By.xpath("//button[text()='Submit']")).click();
+
+ // Read login message
+ String loginMessage = driver.findElement(By.cssSelector("h2.text-center")).getText();
+ Assert.assertEquals("Welcome Back, Admin!", loginMessage);
+ }
+
+ @AfterClass
+ public void afterClass() {
+ // Close browser
+ driver.close();
+ }
+}
diff --git a/TestNG/Activities/Activity_5.java b/TestNG/Activities/Activity_5.java
new file mode 100644
index 0000000000..97e69923de
--- /dev/null
+++ b/TestNG/Activities/Activity_5.java
@@ -0,0 +1,65 @@
+package activity;
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.Color;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class Activity_5 {
+ WebDriver driver;
+
+ // Include alwaysRun property on the @BeforeClass to make sure the page always
+ // opens
+ @BeforeClass(alwaysRun = true)
+ public void setUp() {
+ // Create a new instance of the Firefox driver
+ driver = new FirefoxDriver();
+
+ // Open the browser
+ driver.get("https://training-support.net/webelements/target-practice");
+ }
+
+ @Test(groups = { "HeaderTests", "ButtonTests" })
+ public void pageTitleTest() {
+ String title = driver.getTitle();
+ System.out.println("Title is: " + title);
+ Assert.assertEquals(title, "Selenium: Target Practice");
+ }
+
+ @Test(dependsOnMethods = { "pageTitleTest" }, groups = { "HeaderTests" })
+ public void HeaderTest1() {
+ WebElement header3 = driver.findElement(By.xpath("//h3[contains(@class, 'orange')]"));
+ Assert.assertEquals(header3.getText(), "Heading #3");
+ }
+
+ @Test(dependsOnMethods = { "pageTitleTest" }, groups = { "HeaderTests" })
+ public void HeaderTest2() {
+ Color header5Color = Color.fromString(driver.findElement(By.cssSelector("h5.text-purple-600")).getCssValue("color"));
+ Assert.assertEquals(header5Color.asHex(), "#9333ea");
+ }
+
+ @Test(dependsOnMethods = { "pageTitleTest" }, groups = { "ButtonTests" })
+ public void ButtonTest1() {
+ WebElement button1 = driver.findElement(By.xpath("//button[contains(@class, 'emerald')]"));
+ Assert.assertEquals(button1.getText(), "Emerald");
+ }
+
+ @Test(dependsOnMethods = { "pageTitleTest" }, groups = { "ButtonTests" })
+ public void ButtonTest2() {
+ Color button2Color = Color.fromString(driver.findElement(By.xpath("//button[contains(@class, 'purple')]")).getCssValue("color"));
+ Assert.assertEquals(button2Color.asHex(), "#581c87");
+ }
+
+ // Include alwaysRun property on the @AfterClass to make sure the page always
+ // closes
+ @AfterClass(alwaysRun = true)
+ public void tearDown() {
+ // Close the browser
+ driver.close();
+ }
+}
\ No newline at end of file
diff --git a/TestNG/Activities/Activity_6.java b/TestNG/Activities/Activity_6.java
new file mode 100644
index 0000000000..237f37bf92
--- /dev/null
+++ b/TestNG/Activities/Activity_6.java
@@ -0,0 +1,59 @@
+package activity;
+
+import java.time.Duration;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class Activity_6 {
+ WebDriver driver;
+ WebDriverWait wait;
+
+ @BeforeClass
+ public void beforeClass() {
+ // Initialize the Firefox driver
+ driver = new FirefoxDriver();
+ // Initialize the wait object
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+
+ // Open browser
+ driver.get("https://training-support.net/webelements/login-form");
+ }
+
+ @Test
+ @Parameters({ "username", "password", "message" })
+ public void loginTestCase(String username, String password, @Optional("Login Success!") String message) {
+ // Find username and password fields
+ WebElement usernameField = driver.findElement(By.id("username"));
+ WebElement passwordField = driver.findElement(By.id("password"));
+
+ // Enter credentials
+ usernameField.sendKeys(username);
+ passwordField.sendKeys(password);
+
+ // Click the submit button
+ driver.findElement(By.xpath("//button[text()='Submit']")).click();
+
+ // Wait for the success page to load
+ wait.until(ExpectedConditions.titleContains("Success"));
+
+ // Assert login message
+ String loginMessage = driver.findElement(By.cssSelector("h2.text-center")).getText();
+ Assert.assertEquals("Welcome Back, Admin!", loginMessage);
+ }
+
+ @AfterClass
+ public void afterClass() {
+ // Close browser
+ driver.close();
+ }
+}
\ No newline at end of file
diff --git a/TestNG/Activities/Activity_7.java b/TestNG/Activities/Activity_7.java
new file mode 100644
index 0000000000..5dba4246c8
--- /dev/null
+++ b/TestNG/Activities/Activity_7.java
@@ -0,0 +1,63 @@
+package activity;
+
+import java.time.Duration;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class Activity_7 {
+ WebDriver driver;
+ WebDriverWait wait;
+
+ @BeforeClass
+ public void setUp() {
+ // Initialize driver
+ driver = new FirefoxDriver();
+ // Initialize wait
+ wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ // Open the page
+ driver.get("https://training-support.net/webelements/login-form");
+ }
+
+ @DataProvider(name = "Credentials")
+ public static Object[][] creds() {
+ return new Object[][] {
+ { "admin1", "password1", "Invalid Credentials" },
+ { "wrongAdmin", "wrongPassword", "Invalid Credentials" }
+ };
+ }
+
+ @Test(dataProvider = "Credentials")
+ public void loginTest(String username, String password, String expectedMessage) {
+ // Find the input fields and the login button
+ WebElement usernameField = driver.findElement(By.id("username"));
+ WebElement passwordField = driver.findElement(By.id("password"));
+ WebElement loginButton = driver.findElement(By.xpath("//button[text()='Submit']"));
+
+ // Clear the input fields
+ usernameField.clear();
+ passwordField.clear();
+ // Enter the credentials and click Log in
+ usernameField.sendKeys(username);
+ passwordField.sendKeys(password);
+ loginButton.click();
+
+ // Assert login message
+ String loginMessage = driver.findElement(By.id("subheading")).getText();
+ Assert.assertEquals(loginMessage, expectedMessage);
+ }
+
+ @AfterClass
+ public void tearDown() {
+ // Close the browser
+ driver.quit();
+ }
+}
\ No newline at end of file
diff --git a/TestNG/Activities/Activity_9.java b/TestNG/Activities/Activity_9.java
new file mode 100644
index 0000000000..d179febc62
--- /dev/null
+++ b/TestNG/Activities/Activity_9.java
@@ -0,0 +1,118 @@
+package activity;
+
+import org.openqa.selenium.Alert;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.testng.Assert;
+import org.testng.Reporter;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class Activity_9 {
+ WebDriver driver;
+
+ @BeforeClass
+ public void setUp() {
+ // Create a new instance of the Firefox driver
+ driver = new FirefoxDriver();
+
+ Reporter.log("Starting Test |");
+ // Open browser
+ driver.get("https://training-support.net/webelements/alerts");
+ Reporter.log("Opened Browser |");
+
+ // Print title of page
+ Reporter.log("Page title is " + driver.getTitle() + " |");
+ }
+
+ @BeforeMethod
+ public void beforeMethod() {
+ Reporter.log("Test Case Setup started |");
+ driver.switchTo().defaultContent();
+ }
+
+ @Test(priority = 1)
+ public void simpleAlertTestCase() {
+ Reporter.log("simpleAlertTestCase() started |");
+ // Click the button to open a simple alert
+ driver.findElement(By.id("simple")).click();
+ Reporter.log("Simple Alert opened |");
+
+ // Switch to alert window
+ Alert simpleAlert = driver.switchTo().alert();
+ Reporter.log("Switched foucs to alert |");
+
+ // Get text in the alert box and print it
+ String alertText = simpleAlert.getText();
+ Reporter.log("Alert text is: " + alertText + " |");
+
+ // Assertion
+ Assert.assertEquals("You've just triggered a simple alert!", alertText);
+
+ simpleAlert.accept();
+ Reporter.log("Alert closed");
+
+ Reporter.log("Test case ended |");
+ }
+
+ @Test(priority = 2)
+ public void confirmAlertTestCase() {
+ Reporter.log("confirmAlertTestCase() started |");
+ // Click the button to open a simple alert
+ driver.findElement(By.id("confirmation")).click();
+ Reporter.log("Confirm Alert opened |");
+
+ // Switch to alert window
+ Alert confirmAlert = driver.switchTo().alert();
+ Reporter.log("Switched foucs to alert |");
+
+ // Get text in the alert box and print it
+ String alertText = confirmAlert.getText();
+ Reporter.log("Alert text is: " + alertText + " |");
+
+ // Assertion
+ Assert.assertEquals("You've just triggered a confirmation alert!", alertText);
+
+ confirmAlert.accept();
+ Reporter.log("Alert closed |");
+
+ Reporter.log("Test case ended |");
+ }
+
+ @Test(priority = 3)
+ public void promptAlertTestCase() {
+ Reporter.log("promptAlertTestCase() started |");
+ // Click the button to open a simple alert
+ driver.findElement(By.id("prompt")).click();
+ Reporter.log("Prompt Alert opened |");
+
+ // Switch to alert window
+ Alert promptAlert = driver.switchTo().alert();
+ Reporter.log("Switched foucs to alert |");
+
+ // Get text in the alert box and print it
+ String alertText = promptAlert.getText();
+ Reporter.log("Alert text is: " + alertText + " |");
+
+ // Assertion
+ Assert.assertEquals("I'm a Prompt! Type something into me!", alertText);
+ // Type some text into the prompt
+ promptAlert.sendKeys("Awesome!");
+ Reporter.log("Text entered in prompt alert |");
+ // Close the prompt
+ promptAlert.accept();
+ Reporter.log("Alert closed |");
+
+ Reporter.log("Test case ended |");
+ }
+
+ @AfterClass
+ public void tearDown() {
+ Reporter.log("Ending Test |");
+ // Close the driver
+ driver.close();
+ }
+}
\ No newline at end of file
diff --git a/TestNG/Activities/DemoOne.java b/TestNG/Activities/DemoOne.java
new file mode 100644
index 0000000000..e44c41e665
--- /dev/null
+++ b/TestNG/Activities/DemoOne.java
@@ -0,0 +1,14 @@
+package activity;
+import org.testng.annotations.Test;
+
+public class DemoOne {
+ @Test
+ public void firstTestCase() {
+ System.out.println("I'm in first test case from demoOne Class");
+ }
+
+ @Test
+ public void secondTestCase() {
+ System.out.println("I'm in second test case from demoOne Class");
+ }
+}
diff --git a/TestNG/Activities/DemoTwo.java b/TestNG/Activities/DemoTwo.java
new file mode 100644
index 0000000000..f1caf324ae
--- /dev/null
+++ b/TestNG/Activities/DemoTwo.java
@@ -0,0 +1,9 @@
+package activity;
+import org.testng.annotations.Test;
+
+public class DemoTwo {
+ @Test
+ public void TestCase() {
+ System.out.println("I'm in the test case from DemoTwo Class");
+ }
+}
\ No newline at end of file
diff --git a/TestNG/Activities/testng.xml b/TestNG/Activities/testng.xml
new file mode 100644
index 0000000000..bc03a6d0d3
--- /dev/null
+++ b/TestNG/Activities/testng.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file