Skip to content
Snippets Groups Projects
Commit dd2693b9 authored by Adriaan de Beer's avatar Adriaan de Beer
Browse files

ST-456 refactored device_running and tango-commands into single feature,...

ST-456 refactored device_running and tango-commands into single feature, changed Makefile to try to output exit status
parent d262741e
No related branches found
No related tags found
No related merge requests found
...@@ -406,9 +406,9 @@ test-chart: ...@@ -406,9 +406,9 @@ test-chart:
artifacts: artifacts:
name: "$CI_PROJECT_NAME-$CI_JOB_ID" name: "$CI_PROJECT_NAME-$CI_JOB_ID"
paths: paths:
- "charts/build/" - "build/"
reports: reports:
junit: charts/build/report.xml junit: build/report.xml
# push: # push:
# stage: push # stage: push
......
...@@ -141,6 +141,7 @@ test: ## test the application on K8s ...@@ -141,6 +141,7 @@ test: ## test the application on K8s
base64 -d | tar -xzf -; \ base64 -d | tar -xzf -; \
kubectl --namespace $(KUBE_NAMESPACE) delete pod $(TEST_RUNNER); \ kubectl --namespace $(KUBE_NAMESPACE) delete pod $(TEST_RUNNER); \
rm ../post-deployment/tango_values.yaml rm ../post-deployment/tango_values.yaml
echo $$status
exit $$status exit $$status
show: show:
......
...@@ -16,7 +16,7 @@ all: test ...@@ -16,7 +16,7 @@ all: test
test: install test: install
mkdir -p build && \ mkdir -p build && \
find . -name "*.pyc" -type f -delete && \ find . -name "*.pyc" -type f -delete && \
PYTHONPATH=/app:/app/testing:/app/testing/post-deployment pytest $(if $(findstring all,$(MARK)),, -m $(MARK)) --disable-pytest-warnings | tee pytest.stdout; \ PYTHONPATH=/app:/app/testing:/app/testing/post-deployment pytest $(if $(findstring all,$(MARK)),, -m $(MARK)) --disable-pytest-warnings | tee pytest.stdout && \
status=$$?; \ status=$$?; \
$(foreach artfct,$(TEST_ARTIFACTS),mv -f $(artfct) build/;) \ $(foreach artfct,$(TEST_ARTIFACTS),mv -f $(artfct) build/;) \
exit $$status exit $$status
......
# check device is running
# @skip
Feature: Device commands
Scenario: Test device is running
Given a device called sys/tg_test/1
When I call the command State()
Then the attribute State is RUNNING
Scenario: Test DevString command
Given a device called sys/tg_test/1
When I call the command DevString(Hello World!)
Then the attribute State is Hello World!
\ No newline at end of file
...@@ -22,8 +22,8 @@ Scenario: Test DevString command ...@@ -22,8 +22,8 @@ Scenario: Test DevString command
Scenario: Test short_spectrum_ro quality Scenario: Test short_spectrum_ro quality
Given a device called sys/tg_test/1 Given a device called sys/tg_test/1
Then the attribute short_spectrum_ro is tango._tango.AttrQuality.ATTR_VALID Then the attribute short_spectrum_ro is ATTR_VALID
Scenario: Test short_spectrum quality Scenario: Test short_spectrum quality
Given a device called sys/tg_test/1 Given a device called sys/tg_test/1
Then the attribute short_spectrum is tango._tango.AttrQuality.ATTR_VALID Then the attribute short_spectrum is ATTR_VALID
\ No newline at end of file \ No newline at end of file
# coding=utf-8
"""features/device_running.feature feature tests."""
import tango
from pytest_bdd import given, scenario, then, when, parsers
@scenario('device_running.feature', 'Test device is running')
def test_test_device_is_running():
"""Test device is running."""
@given(parsers.parse('a device called {device_name}'))
def device_proxy(run_context, device_name):
"""a device called sys/tg_test/1."""
return tango.DeviceProxy(device_name)
@when(parsers.cfparse("I call the command {command_name}({parameter:String?})", extra_types=dict(String=str)))
def call_command(device_proxy, command_name):
"""I call the command State()."""
return device_proxy.command_inout(command_name)
@then(parsers.parse('the attribute {attribute_name} is {expected_value}'))
def check_attribute(device_proxy, attribute_name, expected_value):
"""the attribute State is RUNNING."""
attr = device_proxy.read_attribute(attribute_name)
assert str(attr.value) == expected_value
...@@ -7,11 +7,6 @@ from tango import Database, DeviceProxy, CmdArgType as ArgType ...@@ -7,11 +7,6 @@ from tango import Database, DeviceProxy, CmdArgType as ArgType
from pytest_bdd import given, scenario, then, when, parsers, scenarios from pytest_bdd import given, scenario, then, when, parsers, scenarios
# @scenario('tango-cpp.feature', 'Call Command and test attribute')
# def test_call_command_and_test_attribute():
# """Call Command and test attribute."""
scenarios('../features/tango-commands.feature') scenarios('../features/tango-commands.feature')
@given(parsers.parse('a device called {device_name}')) @given(parsers.parse('a device called {device_name}'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment