Posts

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 ...

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

SQL

  ***CREATE / INSERT *** create table  TestTable (name varchar(20), age int, email varchar(20)); Insert into TestTable values(" abc ",23," jain@gmail.com "),("abc",30,"abc@gmail.com"),("www",50,"abc@gmail.com"),(" abc ",20,"abc@gmail.com"),("tta",10,"abc@gmail.com"); -- Insert into sresthaTable values("abc",30," abc@gmail.com "); -- select age from  TestTable ; ***Maximum / Minimum Age*** -- select max(age) from  TestTable  where age <(select max(age) from sresthaTable where age <(select max(age) from sresthaTable )); -- select age from  TestTable  order by age limit 2-1,1; select name,age from  TestTable  where name like '%a' or age <30;

How to start / create a fresh JAVA Project into Eclipse IDE:

Image
  How to start / create a fresh JAVA Project into Eclipse IDE:  Click on Create New Java Project on Eclipse IDE: Enter Project Name CLick Next: you can find Java Src Tree structure Click FINISH Do right click on Java New Project -> Create a class Create a Java file : src-newProject- reverseString.java  (camelCase) Click Finish, you will find the Java class page: To enter the program

Performance Testing- Using JMeter

 J Meter 1. Download JMETER form apache jmeter 2. extract - open bin either run from jar or batch file. --------Start First Project------ 3. Create a Test Plan 4. Create a Thread Group(users) 5. Add a sampler (Http) 6. Add Listeners 7. To Run the Test -------Assertion----------------- 8.Response Assertion, Duration Assertion , Size Assertion , HTML Assertion , XML Assertion (To Check format) , Xpath Assertion (To check xpath on webpage). -------Type of report in JMeter-- 9. View reult in Table. 10. View result in tree. 11. Aggregate Report. 12. Graph results. 13. Summary Report 14. Simple Data Writer --------Tools available for recording JMtere----- 15. Blazemeter chrome plugin 16. Record the steps. 17. export as .jmx file 18. Import into JMeter 19. Add listners 20. Run and validate  ------------------------------------