Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Rob Hasker Dr. Brad Dennis SE 3800 Note 6 UI Testing.

Similar presentations


Presentation on theme: "Dr. Rob Hasker Dr. Brad Dennis SE 3800 Note 6 UI Testing."— Presentation transcript:

1 Dr. Rob Hasker Dr. Brad Dennis SE 3800 Note 6 UI Testing

2 UI Testing in Java Assumption: painful but readily available
Research: lots of vaporware, abandonware Many solutions for web, but not a lot for Java FrogLogic, RAutomation, MarathonTesting, UISpec4J, Mspec, abbot Method that works: JavaWorld TestUtils; see also counter.zip

3 UI Testing in Java Each component: call .setName with unique string
Test code: TestUtils.getChildNamed(frame, name-of-child) Use .doClick, .value(), etc. to exercise code Robust Doesn’t depend on screen locations, specialized test frameworks But no auto-capture/replay

4 UI Testing in C++ w/ Cucumber
Feature: Subtraction In order to avoid silly mistakes As a math-challenged person I want to be told the difference of two numbers Scenario Outline: Subtract two numbers Given I just turned on the calculator When I press <button1> And I press subtract And I press <button2> And I press calculate Then the display should show <result> Examples: | button1 | button2 | result | | | | | | | | | | | | | From

5 UI Testing in C++ w/ Cucumber
Feature: Subtraction In order to avoid silly mistakes As a math-challenged person I want to be told the difference of two numbers Scenario Outline: Subtract two numbers Given I just turned on the calculator When I press <button1> And I press subtract And I press <button2> And I press calculate Then the display should show <result> Examples: | button1 | button2 | result | | | | | | | | | | | | | GIVEN("^I just turned on the calculator$") { cucumber::ScenarioScope<CalculatorWidget> calculator; calculator->move(0, 0); calculator->show(); QTest::qWaitForWindowShown(calculator.get()); QTest::qWait(millisecondsToWait()); }

6 UI Testing in C++ w/ Cucumber
WHEN("^I press (\\d+)$") { REGEX_PARAM(unsigned int, n); cucumber::ScenarioScope<CalculatorWidget> calculator; QTest::keyClick(calculator.get(), Qt::Key_0 + n, Qt::NoModifier, millisecondsToWait()); } Feature: Subtraction In order to avoid silly mistakes As a math-challenged person I want to be told the difference of two numbers Scenario Outline: Subtract two numbers Given I just turned on the calculator When I press <button1> And I press subtract And I press <button2> And I press calculate Then the display should show <result> Examples: | button1 | button2 | result | | | | | | | | | | | | | WHEN("^I press subtract") { cucumber::ScenarioScope<CalculatorWidget> calculator; QTest::keyClick(calculator.get(), Qt::Key_Minus, Qt::NoModifier, millisecondsToWait()); }

7 UI Testing in C++ w/ Cucumber
WHEN("^I press calculate") { cucumber::ScenarioScope<CalculatorWidget> calculator; QTest::keyClick(calculator.get(), Qt::Key_Return, Qt::NoModifier, millisecondsToWait()); } THEN("^the display should show (.*)$") { REGEX_PARAM(QString, expected); BOOST_CHECK_EQUAL(expected, calculator->display()); QTest::qWait(millisecondsToWait()); Feature: Subtraction In order to avoid silly mistakes As a math idiot I want to be told the difference of two numbers Scenario Outline: Subtract two numbers Given I just turned on the calculator When I press <button1> And I press subtract And I press <button2> And I press calculate Then the display should show <result> Examples: | button1 | button2 | result | | | | | | | | | | | | |

8 Acceptance Tests & APIs
How to write acceptance tests for an API? Our model: acceptance test = story/scenario Issue: an API is not a user! Solution: Cohn: Writing User Stories for Back-end Systems Personify subsystems Epic: “As a bank, I want to receive a file showing all checks to be cleared so that I can debit and credit the right accounts.” “As a bank, I want to receive a 5300 file with correctly formatted single-line deposit entry records so that I can process them.” Write test to the resulting story.

9 Review UI Testing with Java: TestUtils
UI Testing in C++ w/ Qt: cucumber-cpp Acceptance testing for APIs


Download ppt "Dr. Rob Hasker Dr. Brad Dennis SE 3800 Note 6 UI Testing."

Similar presentations


Ads by Google