0

I've started a few WebDriver projects in Eclipse Juno but i'm not satisfied with my structure, i think is to stupid and not efficient at all.

Beneath you can see my project three now. The TEST_xxx.java files are functions to trigger the files in the test package.

Here is an example of one function in a TEST_xxx.java file:

public void a_search_product_by_sku(String sku) throws InterruptedException {
    System.out.println("Running Testsuite 3 - Navigation - Testcase 1 - Search product by SKU");
    tests.navigation nav = new tests.navigation(BASE_URL, driver);
    nav.search_product_by_sku(sku);
}

This calls the function search_product_by_sku() that is inside the navigation class inside the test package. This function look like this:

public void search_product_by_sku(String sku) throws InterruptedException {
    driver.get(url + "/k/k.aspx");
    driver.findElement(By.id("q")).clear();
    driver.findElement(By.id("q")).sendKeys(sku);
    driver.findElement(By.cssSelector("input.submit")).click();
    boolean status = driver.findElement(By.cssSelector("BODY")).getText().matches("^[\\s\\S]*Status:[\\s\\S]*$");
    Assert.assertEquals(true, status);
}

All this seems too hard to maintain, and since I'm not a very experienced programmer I'm really out of ideas and i hoped that someone here could help me.

Thanks in advance!

Organization three in Eclipse now

Oleaha
  • 130
  • 1
  • 2
  • 10

1 Answers1

0

First a class name should start with a capital letter.

date should be Date.

Instead of having four classes in tests package. You can merge the 4 classes into a single class.

And the classes, and the testing classes would be good if they are in the same package.

Code Enthusiastic
  • 2,827
  • 5
  • 25
  • 39