Skip to content

Commit

Permalink
test: add test cases around dispense logic over different api versions
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekMaggio committed Feb 29, 2024
1 parent d792317 commit cc89cc8
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"""Smoke Test v3.0 """
# https://opentrons.atlassian.net/projects/RQA?selectedItem=com.atlassian.plugins.atlassian-connect-plugin:com.kanoah.test-manager__main-project-page#!/testCase/QB-T497
from opentrons import protocol_api

metadata = {
"protocolName": "2.15 Dispense",
"author": "Opentrons Engineering <[email protected]>",
"source": "Software Testing Team",
"description": ("Description of the protocol that is longish \n has \n returns and \n emoji 😊 ⬆️ "),
}

requirements = {"robotType": "OT-2", "apiLevel": "2.15"}


def run(ctx: protocol_api.ProtocolContext) -> None:
"""This method is run by the protocol engine."""

ctx.set_rail_lights(True)
ctx.comment(f"Let there be light! {ctx.rail_lights_on} 🌠🌠🌠")
ctx.comment(f"Is the door is closed? {ctx.door_closed} 🚪🚪🚪")
ctx.comment(f"Is this a simulation? {ctx.is_simulating()} 🔮🔮🔮")
ctx.comment(f"Running against API Version: {ctx.api_version}")

# deck positions
tips_300ul_position = "5"
tips_20ul_position = "4"
res_1_position = "3"
res_2_position = "2"


# Thermocycler has a default position that covers Slots 7, 8, 10, and 11.
# This is the only valid location for the Thermocycler on the OT-2 deck.
# This position is a default parameter when declaring the TC so you do not need to specify.

# 300ul tips
tips_300ul = [
ctx.load_labware(
load_name="opentrons_96_tiprack_300ul",
location=tips_300ul_position,
label="300ul tips",
)
]

# 20ul tips
tips_20ul = [
ctx.load_labware(
load_name="opentrons_96_tiprack_20ul",
location=tips_20ul_position,
label="20ul tips",
)
]

# pipettesdye_source = dye_container.wells_by_name()["A2"]
pipette_left = ctx.load_instrument(instrument_name="p300_multi_gen2", mount="left", tip_racks=tips_300ul)

pipette_right = ctx.load_instrument(instrument_name="p20_single_gen2", mount="right", tip_racks=tips_20ul)

res_1 = ctx.load_labware(
load_name="nest_12_reservoir_15ml",
location=res_1_position,
)

res_2 = ctx.load_labware(
load_name="nest_12_reservoir_15ml",
location=res_2_position,
)

pipette_right.pick_up_tip()
pipette_right.aspirate(volume=20, location=res_1.wells_by_name()["A1"])

pipette_right.dispense(volume=0.0, location=res_2.wells_by_name()["A1"])

# everything less than or equal protocol api version 2.15 should dispense everything
# in the pipette when you pass 0.0 as the volume
assert pipette_right.current_volume == 0.0

# In protocol api versions 2.16 and lower, if you pass a volume greater than the current volume, the dispense should clamp
# to the current volume. Meaning this should dispense 0.0, and the current volume after dispense should still be 0.0
pipette_right.dispense(volume=20, location=res_2.wells_by_name()["A1"])

assert pipette_right.current_volume == 0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"""Smoke Test v3.0 """
# https://opentrons.atlassian.net/projects/RQA?selectedItem=com.atlassian.plugins.atlassian-connect-plugin:com.kanoah.test-manager__main-project-page#!/testCase/QB-T497
from opentrons import protocol_api

metadata = {
"protocolName": "2.16 Dispense",
"author": "Opentrons Engineering <[email protected]>",
"source": "Software Testing Team",
"description": ("Description of the protocol that is longish \n has \n returns and \n emoji 😊 ⬆️ "),
}

requirements = {"robotType": "OT-2", "apiLevel": "2.16"}


def run(ctx: protocol_api.ProtocolContext) -> None:
"""This method is run by the protocol engine."""

ctx.set_rail_lights(True)
ctx.comment(f"Let there be light! {ctx.rail_lights_on} 🌠🌠🌠")
ctx.comment(f"Is the door is closed? {ctx.door_closed} 🚪🚪🚪")
ctx.comment(f"Is this a simulation? {ctx.is_simulating()} 🔮🔮🔮")
ctx.comment(f"Running against API Version: {ctx.api_version}")

# deck positions
tips_300ul_position = "5"
tips_20ul_position = "4"
res_1_position = "3"
res_2_position = "2"


# Thermocycler has a default position that covers Slots 7, 8, 10, and 11.
# This is the only valid location for the Thermocycler on the OT-2 deck.
# This position is a default parameter when declaring the TC so you do not need to specify.

# 300ul tips
tips_300ul = [
ctx.load_labware(
load_name="opentrons_96_tiprack_300ul",
location=tips_300ul_position,
label="300ul tips",
)
]

# 20ul tips
tips_20ul = [
ctx.load_labware(
load_name="opentrons_96_tiprack_20ul",
location=tips_20ul_position,
label="20ul tips",
)
]

# pipettesdye_source = dye_container.wells_by_name()["A2"]
pipette_left = ctx.load_instrument(instrument_name="p300_multi_gen2", mount="left", tip_racks=tips_300ul)

pipette_right = ctx.load_instrument(instrument_name="p20_single_gen2", mount="right", tip_racks=tips_20ul)

res_1 = ctx.load_labware(
load_name="nest_12_reservoir_15ml",
location=res_1_position,
)

res_2 = ctx.load_labware(
load_name="nest_12_reservoir_15ml",
location=res_2_position,
)

pipette_right.pick_up_tip()
pipette_right.aspirate(volume=20, location=res_1.wells_by_name()["A1"])

pipette_right.dispense(volume=0.0, location=res_2.wells_by_name()["A1"])

# everything less than or equal protocol api version 2.15 should dispense everything
# in the pipette when you pass 0.0 as the volume. Since this is 2.16, the dispense should not change the volume
assert pipette_right.current_volume == 20.0

# In protocol api versions 2.16 and lower, if you pass a volume greater than the current volume, the dispense should clamp
# to the current volume. Meaning this should dispense 20.0, and the current volume after dispense should be 0.0
pipette_right.dispense(volume=21, location=res_2.wells_by_name()["A1"])

assert pipette_right.current_volume == 0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Smoke Test v3.0 """
# https://opentrons.atlassian.net/projects/RQA?selectedItem=com.atlassian.plugins.atlassian-connect-plugin:com.kanoah.test-manager__main-project-page#!/testCase/QB-T497
from opentrons import protocol_api

metadata = {
"protocolName": "🛠️ 2.17 Smoke Test",
"author": "Opentrons Engineering <[email protected]>",
"source": "Software Testing Team",
"description": ("Placeholder - 2.17 Smoke Test is the same a 2.16 Smoke Test."),
}

requirements = {"robotType": "OT-2", "apiLevel": "2.16"}


def run(ctx: protocol_api.ProtocolContext) -> None:
"""This method is run by the protocol engine."""
# The only change in api version 2.17 is an error is thrown when you try to dispense more than the current volume of liquid in the pipette.

# Since the smoke test protocol should be able to be ran through without any errors, the test for the dispense error should not be added to the smoke test protocol.

# Instead it should be added to a separate test protocol - OT2_P300M_P20S_TC_HS_TM_2_17_dispense_changes.py

# Therefore the 2.17 smoke test protocol is the same as the 2.16 smoke test protocol. Instead of copying and pasting the 2.16 smoke test protocol, we will noop this protocol and add a comment to explain the situation.

pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""Smoke Test v3.0 """
# https://opentrons.atlassian.net/projects/RQA?selectedItem=com.atlassian.plugins.atlassian-connect-plugin:com.kanoah.test-manager__main-project-page#!/testCase/QB-T497
from opentrons import protocol_api

metadata = {
"protocolName": "2.17 Dispense",
"author": "Opentrons Engineering <[email protected]>",
"source": "Software Testing Team",
"description": ("Description of the protocol that is longish \n has \n returns and \n emoji 😊 ⬆️ "),
}

requirements = {"robotType": "OT-2", "apiLevel": "2.17"}


def run(ctx: protocol_api.ProtocolContext) -> None:
"""This method is run by the protocol engine."""

ctx.set_rail_lights(True)
ctx.comment(f"Let there be light! {ctx.rail_lights_on} 🌠🌠🌠")
ctx.comment(f"Is the door is closed? {ctx.door_closed} 🚪🚪🚪")
ctx.comment(f"Is this a simulation? {ctx.is_simulating()} 🔮🔮🔮")
ctx.comment(f"Running against API Version: {ctx.api_version}")

# deck positions
tips_300ul_position = "5"
tips_20ul_position = "4"
res_1_position = "3"
res_2_position = "2"


# Thermocycler has a default position that covers Slots 7, 8, 10, and 11.
# This is the only valid location for the Thermocycler on the OT-2 deck.
# This position is a default parameter when declaring the TC so you do not need to specify.

# 300ul tips
tips_300ul = [
ctx.load_labware(
load_name="opentrons_96_tiprack_300ul",
location=tips_300ul_position,
label="300ul tips",
)
]

# 20ul tips
tips_20ul = [
ctx.load_labware(
load_name="opentrons_96_tiprack_20ul",
location=tips_20ul_position,
label="20ul tips",
)
]

# pipettesdye_source = dye_container.wells_by_name()["A2"]
pipette_left = ctx.load_instrument(instrument_name="p300_multi_gen2", mount="left", tip_racks=tips_300ul)

pipette_right = ctx.load_instrument(instrument_name="p20_single_gen2", mount="right", tip_racks=tips_20ul)

res_1 = ctx.load_labware(
load_name="nest_12_reservoir_15ml",
location=res_1_position,
)

res_2 = ctx.load_labware(
load_name="nest_12_reservoir_15ml",
location=res_2_position,
)

pipette_right.pick_up_tip()
pipette_right.aspirate(volume=20, location=res_1.wells_by_name()["A1"])

pipette_right.dispense(volume=0.0, location=res_2.wells_by_name()["A1"])

# everything less than or equal protocol api version 2.15 should dispense everything
# in the pipette when you pass 0.0 as the volume. Since this is 2.16, the dispense should not change the volume
assert pipette_right.current_volume == 20.0

# In protocol api versions 2.16 and lower, if you pass a volume greater than the current volume, the dispense should clamp
# to the current volume. In versions greater than 2.16, if you pass a volume greater than the current volume, an error should be thrown
pipette_right.dispense(volume=21, location=res_2.wells_by_name()["A1"])

0 comments on commit cc89cc8

Please sign in to comment.