i am new to all of this coding experience. i have been a manual qa for several years and now i am starting to get my hands on selenium
i have worked out a very simple test case to submit a registration form, and i would like to get the result for that test case and post it on my testing tool "Test Rail". i have been doing it with soapui while testing endpoints so i know how to do it but not how to associate the result of the test case to trigger the post condition.
now i am using selenium with eclipse and Junit and this is my simple code:
package com.example.tests;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class createLead {
private WebDriver driver;
private Select dropdown;
@Before
public void setUp() throws Exception {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Agustin Barcia\\driver\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Test
public void testUntitledTestCase() throws Exception {
driver.get("www.randomform.com");
driver.findElement(By.id("firstname-input")).sendKeys("agustin");
driver.findElement(By.id("lastname-input")).sendKeys("placement");
driver.findElement(By.id("emailaddress-input")).clear();
driver.findElement(By.id("emailaddress-input")).sendKeys("random@email.com");
driver.findElement(By.id("country-select"));
dropdown = new Select(driver.findElement(By.id("country-select")));
dropdown.selectByValue("ar");
driver.findElement(By.id("state-select"));
dropdown = new Select(driver.findElement(By.id("state-select")));
dropdown.selectByValue("178");
driver.findElement(By.id("city-select"));
dropdown = new Select(driver.findElement(By.id("city-select")));
dropdown.selectByValue("245");
driver.findElement(By.id("submit-button")).click();
}
}
When i run this code in Junit the window shows "Success" and the registration is made.
Well now i have the code to post the resul in testrail, i would like to make a conditional if, the test case above returns "success" post in testrail a testcase ok, and if the test case returns "failure" post in test rail the test case failed. i know how to post the result but not how to obtain the "success" or "Fail" from the test run
any help?