Виктор Короневич, Минск. Senior Software Test Automation Engineer with 3+ years of experience specializing in automation on Java, http://www.linkedin.com/in/agileseph
«Автоматизация тестирования сложных систем: mixed mode automated test case.» Использование Selenium + jUnit + Frank + custom java tools для тестирования Web + DB + Web Services + iOS. Development секция.
4. Особенности реализации решения
Modes:
- db testing (create/clean-up scripts – mysql driver);
link: http://www.mysql.com/products/connector/
- web services testing (create/load scripts – apache httpclient
wrapper);
link: http://hc.apache.org/httpclient-3.x/
- web testing (functional scripts – Selenium 2.x Web Driver);
link: http://seleniumhq.org/docs/03_webdriver.jsp#
- iOS testing (functional scripts – Frank project);
link: https://github.com/moredip/Frank
5. Пример
@TestFixture(username = test_user, password = test_pass)
@CleanUp(script = "./scripts/clean_up_db_users.sql")
@Test(timeout = min_timeout)
public void testUserBuyPaidExercise(){
// [STEPS]
// scenario: 1.login -> 2.tap buy items -> 3.gather expected data ->
// 4.buy the first item -> 5.go to my items -> 6.gather actual data
// step 1-2
BuyItemsScreen buyItemsScreen =
ScreenFactory.getInstance().getLoginScreen().login(username, password).tapBuyItems();
// step 3
Exercise expectedExercise = buyItemsScreen.getFirstItem();
int moneyCount = buyItemsScreen.getMoneyCount();
int expectedItemsCount = 1;
int expectedMoneyCount = moneyCount -
CurrencyExchange.convertToBYR(expectedExercise.getPrice(), Currency.USD);
6. Пример
@TestFixture(username = test_user, password = test_pass)
@CleanUp(script = "./scripts/clean_up_db_users.sql")
@Test(timeout = min_timeout)
public void testUserBuyPaidExercise(){
// [STEPS]
// scenario: 1.login -> 2.tap buy items -> 3.gather expected data ->
// 4.buy the first item -> 5.go to my items -> 6.gather actual data
…
// step 4-5
MyItemsScreen myItemsScreen =
buyItemsScreen.tapFirstItem().tapBuyButton().tapMyItems();
// step 6
int actualItemsCount = myItemsScreen.getItemsCount();
Exercise actualExercise = myItemsScreen.getFirstItem();
int actualMoneyCount = myItemsScreen.getMoneyCount();
}
7. Пример
@TestFixture(username = test_user, password = test_pass)
@CleanUp(script = "./scripts/clean_up_db_users.sql")
@Test(timeout = min_timeout)
public void testUserBuyPaidExercise(){
// [STEPS]
// scenario: 1.login -> 2.tap buy items -> 3.gather expected data ->
// 4.buy the first item -> 5.go to my items -> 6.gather actual data
…
// [CHECK]
// #1: exercises count should be 1 (we buy only 1 item)
Assert.assertEquals(expectedItemsCount, actualItemsCount);
// #2: exercise name and price should be equal
CustomAssert.assertEquals(expectedExercise, actualExercise);
// #3: money count should be reduced on expected exercise price including the current
valid currency course
Assert.assertEquals(expectedMoneyCount, actualMoneyCount);
}
8. Пример
public class IntegrationTestSet extends TestSetTexture{
@BeforeClass
public static void setUpAllTests(){
install_iPhoneApp();
}
@Before
public void setUpTest(){
sharedTCFixture();
}
@After
public void tearDownTest(){
ScreenFactory.getInstance().getMyItemsScreen().logout();
}
@AfterClass
public static void tearDownAllTests(){
quit_iPhoneApp();
}
…
9. Пример
public class TestSetTexture extends JUnitExtension{
protected final static String test_user = "test_user";
protected final static String test_pass = "test_pass";
…
protected static void install_iPhoneApp(){
SUT.start();
}
protected static void quit_iPhoneApp(){
SUT.quit();
}
protected void sharedTCFixture(){
int eCount = 100;
SUT.registerUser(test_user, test_pass);
SUT.createExercises(eCount);
}
}
12. Feedback
Виктор Короневич
Senior Software Test Automation Engineer
Contacts:
- LinkedIn at www.linkedin.com/in/agileseph
- Email at koronevichw@tut.by
- Skype at viktar_karanevich