Hello,
I was wondering how end-to-end tests are isolated on local server. When SQL database server is used, there is no problem from test code to perform insert and delete operations from test case but how this could be done on GAE when binary file is used to hold the persistence state of the datastore ?

One possible solution would be creation of custom testing servlets that could execute some insert/delete operations. The test class could call any of this servlets to restore datastore to it's previous state. I don't know where this is a good approach for such tests.

Another option could be deploying of test classes along with production code on the local server and running test suite via some kind of testing page/servlet and etc. The problem with this approach for me is that TDD will cost me a lot of time, due the fact that when I change some part of my test, I have to redeploy the whole application again.


Here is a small snippet that is showing for what I'm talking about:

...
 private LoginPage loginPage;
 private InvoicePage invoicePage;

@Before
public void before() {
   databaseCleaner.cleanEntities();
   driver = new FirefoxDriver();
   loginPage = new LoginPage(driver);
   invoicePage = new InvoicePage(driver);
}

@Test
public void testCreateNewInvoice() {
  loginPage.loginWithDefaultCredentials();
  //given empty invoice
  invoicePage.enter();
  // when
invoicePage.enterInvoice(newInvoice("123").addItem(newItem(1,1,2.30,"My First Item")).build());
  invoicePage.saveInvoce();


//then database should contain entered invoice and the invoice should be added to the invoices table
  assertDatabaseContainsInvoice("123");
  assertDatabaseContainsInvoceWithItem("My First Item");
  invoicePage.containsInvoice("123");
}


Regards,
  Miroslav




Regards,
  Miroslav

--
You received this message because you are subscribed to the Google Groups "Google 
App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to