Index: config.xml
===================================================================
diff -u
--- config.xml (revision 0)
+++ config.xml (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
Index: envvars
===================================================================
diff -u
--- envvars (revision 0)
+++ envvars (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1 @@
\ No newline at end of file
Index: shared/scripts/bdd_hooks.py
===================================================================
diff -u
--- shared/scripts/bdd_hooks.py (revision 0)
+++ shared/scripts/bdd_hooks.py (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+
+# This file contains hook functions to run as the .feature file is executed.
+#
+# A common use-case is to use the OnScenarioStart/OnScenarioEnd hooks to
+# start and stop an AUT, e.g.
+#
+# @OnScenarioStart
+# def hook(context):
+# startApplication("addressbook")
+#
+# @OnScenarioEnd
+# def hook(context):
+# currentApplicationContext().detach()
+#
+# See the section 'Performing Actions During Test Execution Via Hooks' in the Squish
+# manual for a complete reference of the available API.
+
+# Detach (i.e. potentially terminate) all AUTs at the end of a scenario
+@OnScenarioEnd
+def hook(context):
+ for ctx in applicationContextList():
+ ctx.detach()
+
Index: shared/scripts/names.py
===================================================================
diff -u
--- shared/scripts/names.py (revision 0)
+++ shared/scripts/names.py (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,15 @@
+# encoding: UTF-8
+
+from objectmaphelper import *
+
+o_QQuickView = {"type": "QQuickView", "unnamed": 1, "visible": True}
+o_homeScreen_ui = {"container": o_QQuickView, "id": "_homeScreen", "type": "Home.ui", "unnamed": 1, "visible": True}
+o_homeScreen_Start_Treatment_Text = {"container": o_homeScreen_ui, "text": "Start Treatment", "type": "Text", "unnamed": 1, "visible": True}
+o_startTreatmentScreen_ui = {"container": o_QQuickView, "id": "_startTreatmentScreen", "type": "StartTreatment.ui", "unnamed": 1, "visible": True}
+o_startTreatmentScreen_label_MnemonicLabel = {"container": o_startTreatmentScreen_ui, "objectName": "label", "type": "MnemonicLabel", "visible": True}
+o_homeScreen_backgroundRect_Rectangle = {"container": o_homeScreen_ui, "id": "backgroundRect", "type": "Rectangle", "unnamed": 1, "visible": True}
+o_startTreatmentScreen_Back_Button = {"checkable": False, "container": o_startTreatmentScreen_ui, "id": "btnBack", "text": "Back", "type": "Button", "unnamed": 1, "visible": True}
+o_homeScreen_Treatment_Manager_Text = {"container": o_homeScreen_ui, "text": "Treatment Manager", "type": "Text", "unnamed": 1, "visible": True}
+o_treatmentMansagerScreen_ui = {"container": o_QQuickView, "id": "_treatmentMansagerScreen", "type": "TreatmentManager.ui", "unnamed": 1, "visible": True}
+o_treatmentMansagerScreen_label_MnemonicLabel = {"container": o_treatmentMansagerScreen_ui, "objectName": "label", "type": "MnemonicLabel", "visible": True}
+o_treatmentMansagerScreen_Back_Button = {"checkable": False, "container": o_treatmentMansagerScreen_ui, "id": "btnBack", "text": "Back", "type": "Button", "unnamed": 1, "visible": True}
Index: shared/scripts/names.pyc
===================================================================
diff -u
Binary files differ
Index: shared/steps/steps.py
===================================================================
diff -u
--- shared/steps/steps.py (revision 0)
+++ shared/steps/steps.py (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+
+# A quick introduction to implementing scripts for BDD tests:
+#
+# This file contains snippets of script code to be executed as the .feature
+# file is processed. See the section 'Behaviour Driven Testing' in the 'API
+# Reference Manual' chapter of the Squish manual for a comprehensive reference.
+#
+# The decorators Given/When/Then/Step can be used to associate a script snippet
+# with a pattern which is matched against the steps being executed. Optional
+# table/multi-line string arguments of the step are passed via a mandatory
+# 'context' parameter:
+#
+# @When("I enter the text")
+# def whenTextEntered(context):
+#
+#
+# The pattern is a plain string without the leading keyword, but a couple of
+# placeholders including |any|, |word| and |integer| are supported which can be
+# used to extract arbitrary, alphanumeric and integer values resp. from the
+# pattern; the extracted values are passed as additional arguments:
+#
+# @Then("I get |integer| different names")
+# def namesReceived(context, numNames):
+#
+#
+# Instead of using a string with placeholders, a regular expression can be
+# specified. In that case, make sure to set the (optional) 'regexp' argument
+# to True.
+
+import names
+
+@Given("Application started")
+def step(context):
+ startApplication("denali")
+
+
+@Given("The Home Screen is visible")
+def step(context):
+ test.compare(waitForObjectExists(names.o_homeScreen_backgroundRect_Rectangle).visible, True)
+
+@Given("The Home Screen has Start Treatment button")
+def step(context):
+ test.compare(waitForObjectExists(names.o_startTreatmentScreen_Back_Button).visible, True)
+ test.compare(str(waitForObjectExists(names.o_homeScreen_Start_Treatment_Text).text), "Start Treatment")
+
+@When("Click on the Treatment button")
+def step(context):
+ mouseClick(waitForObject(names.o_homeScreen_Start_Treatment_Text))
+
+@Then("Expected to see the treatment screen")
+def step(context):
+ test.compare(waitForObjectExists(names.o_startTreatmentScreen_ui).visible, True)
+
+@Then("There is a back button with text back")
+def step(context):
+ test.compare(waitForObjectExists(names.o_startTreatmentScreen_Back_Button).visible, True)
+ test.compare(str(waitForObjectExists(names.o_startTreatmentScreen_Back_Button).text), "Back")
+
+@When("Click on the Treatment back button")
+def step(context):
+ mouseClick(waitForObject(names.o_startTreatmentScreen_Back_Button))
+
+@Then("Should go back to the home screen")
+def step(context):
+ test.compare(waitForObjectExists(names.o_homeScreen_backgroundRect_Rectangle).visible, True)
+
+@When("Click on the Manager button")
+def step(context):
+ mouseClick(waitForObject(names.o_homeScreen_Treatment_Manager_Text))
+
+@Then("Expected to see the Manager screen")
+def step(context):
+ test.compare(waitForObjectExists(names.o_treatmentMansagerScreen_ui).visible, True)
+
+@Then("Should stay on the Manager Screen")
+def step(context):
+ test.compare(waitForObjectExists(names.o_treatmentMansagerScreen_ui).visible, True)
+
+@When("Click on the Manager back button")
+def step(context):
+ mouseClick(waitForObject(names.o_treatmentMansagerScreen_Back_Button))
Index: suite.conf
===================================================================
diff -u
--- suite.conf (revision 0)
+++ suite.conf (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,9 @@
+AUT=denali
+ENVVARS=envvars
+HOOK_SUB_PROCESSES=false
+IMPLICITAUTSTART=0
+LANGUAGE=Python
+OBJECTMAPSTYLE=script
+TEST_CASES=tst_Treatment tst_Manager
+VERSION=3
+WRAPPERS=Qt
Index: tst_Manager/test.feature
===================================================================
diff -u
--- tst_Manager/test.feature (revision 0)
+++ tst_Manager/test.feature (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,23 @@
+# This is a sample .feature file
+# Squish feature files use the Gherkin language for describing features, a short example
+# is given below. You can find a more extensive introduction to the Gherkin format at
+# https://github.com/cucumber/cucumber/wiki/Gherkin
+Feature: A brief yet descriptive text of what is desired
+
+ Some textual description of the business value of this feature goes
+ here. The text is free-form.
+
+ The description can span multiple paragraphs.
+
+ Scenario: Check that the Goto Manager and back Home works
+ Given Application started
+ And The Home Screen is visible
+ And The Home Screen has Start Treatment button
+ When Click on the Manager button
+ Then Expected to see the Manager screen
+ And There is a back button with text back
+ When Click on the Manager back button
+ Then Expected to see the Manager screen
+ And There is a back button with text back
+ When Click on the Manager back button
+ Then Should go back to the home screen
Index: tst_Manager/test.py
===================================================================
diff -u
--- tst_Manager/test.py (revision 0)
+++ tst_Manager/test.py (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,8 @@
+source(findFile('scripts', 'python/bdd.py'))
+
+setupHooks('../shared/scripts/bdd_hooks.py')
+collectStepDefinitions('./steps', '../shared/steps')
+
+def main():
+ testSettings.throwOnFailure = True
+ runFeatureFile('test.feature')
Index: tst_Treatment/test.feature
===================================================================
diff -u
--- tst_Treatment/test.feature (revision 0)
+++ tst_Treatment/test.feature (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,23 @@
+# This is a sample .feature file
+# Squish feature files use the Gherkin language for describing features, a short example
+# is given below. You can find a more extensive introduction to the Gherkin format at
+# https://github.com/cucumber/cucumber/wiki/Gherkin
+Feature: A brief yet descriptive text of what is desired
+
+ Some textual description of the business value of this feature goes
+ here. The text is free-form.
+
+ The description can span multiple paragraphs.
+
+ Scenario: Check that the Goto Treatment and back Home works
+ Given Application started
+ And The Home Screen is visible
+ And The Home Screen has Start Treatment button
+ When Click on the Treatment button
+ Then Expected to see the treatment screen
+ And There is a back button with text back
+ When Click on the Treatment back button
+ Then Expected to see the treatment screen
+ And There is a back button with text back
+ When Click on the Treatment back button
+ Then Should go back to the home screen
Index: tst_Treatment/test.py
===================================================================
diff -u
--- tst_Treatment/test.py (revision 0)
+++ tst_Treatment/test.py (revision 9002496389b9df6383fc0fcc47fa6754ca7e14a6)
@@ -0,0 +1,8 @@
+source(findFile('scripts', 'python/bdd.py'))
+
+setupHooks('../shared/scripts/bdd_hooks.py')
+collectStepDefinitions('./steps', '../shared/steps')
+
+def main():
+ testSettings.throwOnFailure = True
+ runFeatureFile('test.feature')