Bgvv1983
Bgvv1983

Reputation: 1256

Fitnesse execute too many tests

I just wrote my first fitnesse test. This test is executed with the help of fitnesse runner. My project contains 1 fitnesse test. This test itself succeeds, but when start the test fitnesse seemse to execute the test twice. The second test fails.

Failed tests:
fitnesse.RunLoginFT at least one test executed in LoginTest
0 right, 0 wrong, 0 ignored, 0 exceptions

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0

I ran the next test:

@RunWith(FitNesseRunner.class)
@FitNesseRunner.Suite("LoginTest")
@FitNesseRunner.FitnesseDir("./src/test/resources")
@FitNesseRunner.OutputDir("target/fitnesse")
public class RunLoginFT {

}

My test scenario looks like:

!define TEST_SYSTEM {slim}
|import|
|nl.belastingdienst.jos.cta.pipeline.kantoor.functioneletests.fitnesse|

|script|login test|
|open|!-https://localhost:9443/url-!|
|enter|XXXX|as|j_username|
|enter|XXXX|as|j_password|
|click|submit|
|check field exists|testknop|

public class LoginTest {

private WebDriver driver;

public void open(String siteUrl) {
    driver = new HtmlUnitDriver();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.get(siteUrl);
}

public void enterAs(String value, String place) {
    driver.findElement(By.id(place)).sendKeys(value);
}

public void click(String button) {
    driver.findElement(By.id(button)).click();
}

public void checkFieldExists(String fieldName) {
    // Als het element niet gevonden kan worden treed eer een exception op dus assert is niet
    // nodig
    driver.findElement(By.id(fieldName));
}

}

Any idea what goes wrong?

Upvotes: 0

Views: 389

Answers (1)

Fried Hoeben
Fried Hoeben

Reputation: 3272

Your test has no assertions.

Make one if your methods return a boolean. Or make the check method return an actual value and use script table's check keyword to compare that actual to an expected value.

Upvotes: 1

Related Questions