For programmers, testers and tech geeks

Writing TestNG + Cucumber test-cases to automate your web-apis-Part 1

Modern era is moving towards Automation. I just have written my tests scripts to test my Apis,  just gonna share my experience with you

Installing TestNG

  1. Download Eclipse
  2. install TestNG
  3. create a new Maven project 
  4. add TestNG, cucumber and rest assured dependency  to POM.Xml
  5. Right click on project and choose "Convert to TestNG"

 

Setting-up project

  1. download Eclipse
  2. install TestNG
    1. click Help
    2. choose "install new software"
    3. search TestNG
    4. click to install
    5.  to confirm that TestNG is installed, please Window→ prefrences check if TestNG  is there, then Congratulations, you have successfully installed TestNG
  3. restart eclipse
    1. create a new Maven project
    2. File-> New→ other→ maven project
    3. add TestNG, cucumber and rest assured dependency to POM.Xml
      <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>6.10</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-java</artifactId>
      <version>3.9.1</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>se.redmind</groupId>
      <artifactId>rmtest-cucumber-restassured</artifactId>
      <version>2.0.5</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>net.masterthought</groupId>
      <artifactId>cucumber-reporting</artifactId>
      <version>3.8.0</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>info.cukes</groupId>
      <artifactId>cucumber-testng</artifactId>
      <version>1.2.5</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>info.cukes</groupId>
      <artifactId>cucumber-java</artifactId>
      <version>1.2.5</version>
      <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <version>3.0.0</version>
      <scope>test</scope>
      </dependency>
  4. Right click on project and choose "Convert to TestNG"