Posts

Showing posts from May, 2021

Karate Framework : Dedicated for API Testing

Image
Here you can find how to use KARATE framework in API Testing, in simple way. Here I have used maven framework: 1. Create a Maven Framework : and respective directories - files & folders;  2. Add dependencies into POM.XML: get it from Maven Repository   1.  karate-core 2. karate-apache 3. karate-junit4    < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < groupId > KarateTesting </ groupId > < artifactId > KarateTesting </ artifactId > < version > 0.0.1-SNAPSHOT </ version > < dependencies > <!-- https://mvnrepository.com/artifact/com.intuit.karate/karate-core --> < dependency > < groupId > com.intuit.karate &l

Java File Handling

 1. This program helps to create a new file , with their inner content:  package com.test.file ; import java.io.FileOutputStream ; import java.io.IOException ; import java.nio.charset.StandardCharsets ; import java.util.Scanner ; public class CreateNewFIleWithContent { public static void getFileCreated (){ Scanner sc = new Scanner ( System . in ); System . out . print ( " Enter the file name path : " ); String filePath = sc . nextLine (); filePath = filePath . replace ( "/" , " \\ " ); try { FileOutputStream fos = new FileOutputStream ( filePath , true ); System . out . print ( " Enter the content inside the file: " ); String content = sc . nextLine (); fos . write ( content . getBytes ()); fos . close (); } catch ( IOException e ){ e . printStackTrace (); } } public static void main ( String [] args ) {

Java Selenium Programs & Concepts:

 Refer to this page to have good diving into basics and advanced logical programs used in automating various web pages.  The index are: 1. Using ChromeOptions: To make in use chrome to config download desired folder. 1. Using ChromeOptions: To make in use chrome to config download desired folder.  (This will also not show the Deprecated message as we know that DesiredCapabilities now not in use) String fileNewPath = " C:/User/Documents/Test ";  String filePath = fileNewPath.replace('/', '\\'); Map<String, Object> chromePrefs = new HashMap<String, Object>(); chromePrefs .put(" profile.default_content_settings.popups", 0 ); chromePrefs .put("download.default_directory", filePath ); chromePrefs .put(" download.prompt_for_download ", false ); chromePrefs .put("plugins.plugins_disabled", "Chrome PDF Viewer"); ChromeDriverService service =               new ChromeDriverService.Builder().usingDriverExec

Solve: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

 If you face this issue on eclipse while running your script mainly it some when we run our scripts using Maven Commands: if JRE is configured instead of JDK and jdk is not available by default on Exclipse Java Complier Config. Then go to  JAVA BUILD PATH  > Add Library... > JRE LIBRARY SYSTEM > Explicitly add JDK path from local computer and remove JRE and JRE conf to JDK