A method for phenotyping cells, said method comprising: a) loading a biological sample comprising biological material including target cells of a cell type and non-target cells of another cell type into a microfluidic device (1, 100) comprising spatially defined and separated cell compartments (20, 120) to capture biological material in said spatially defined and separated cell compartments (20, 120); b) monitoring biological material in said spatially defined and separated cell compartments (20, 120) prior to exposing biological material in said spatially defined and separated cell compartments (20, 120) to a test agent; c) identifying a subset of said spatially defined and separated cell compartments (20, 120) as comprising target cells exhibiting at least one target phenotype characteristic as determined based on said monitoring of biological material in said spatially defined and separated cell compartments (20, 120) in b); and identifying remaining spatially defined and separated cell compartments as comprising non-target cells and/or non-cell material not exhibiting said at least one target phenotype characteristic as determined based on said monitoring of biological material in said spatially defined and separated cell compartments (20, 120) in b); d) exposing biological material in said spatially defined and separated cell compartments (20, 120) to said test agent; e) monitoring target cells in said identified subset of said spatially defined and separated cell compartments (20, 120) by: taking at least one image of said spatially defined and separated cell compartments (20, 120); and processing said at least one image for detection of said identified subset of said spatially defined and separated cell compartments (20, 120) and target cells in said identified subset of said spatially defined and separated cell compartments (20, 120) while disregarding said remaining spatially defined and separated cell compartments and non-target cells and/or non-cell material in said remaining spatially defined and separated cell compartments; and f) determining a phenotypic response of said target cells to said test agent based on said monitoring of target cells in said identified subset of said spatially defined and separated cell compartments (20, 120) in e). a) loading a biological sample comprising biological material including target cells of a cell type and non-target cells of another cell type into a microfluidic device (1, 100) comprising spatially defined and separated cell compartments (20, 120) to capture biological material in said spatially defined and separated cell compartments (20, 120); b) monitoring biological material in said spatially defined and separated cell compartments (20, 120) prior to exposing biological material in said spatially defined and separated cell compartments (20, 120) to a test agent; c) identifying a subset of said spatially defined and separated cell compartments (20, 120) as comprising target cells exhibiting at least one target phenotype characteristic as determined based on said monitoring of biological material in said spatially defined and separated cell compartments (20, 120) in b); and identifying remaining spatially defined and separated cell compartments as comprising non-target cells and/or non-cell material not exhibiting said at least one target phenotype characteristic as determined based on said monitoring of biological material in said spatially defined and separated cell compartments (20, 120) in b); d) exposing biological material in said spatially defined and separated cell compartments (20, 120) to said test agent; e) monitoring target cells in said identified subset of said spatially defined and separated cell compartments (20, 120) by: taking at least one image of said spatially defined and separated cell compartments (20, 120); and processing said at least one image for detection of said identified subset of said spatially defined and separated cell compartments (20, 120) and target cells in said identified subset of said spatially defined and separated cell compartments (20, 120) while disregarding said remaining spatially defined and separated cell compartments and non-target cells and/or non-cell material in said remaining spatially defined and separated cell compartments; and taking at least one image of said spatially defined and separated cell compartments (20, 120); and processing said at least one image for detection of said identified subset of said spatially defined and separated cell compartments (20, 120) and target cells in said identified subset of said spatially defined and separated cell compartments (20, 120) while disregarding said remaining spatially defined and separated cell compartments and non-target cells and/or non-cell material in said remaining spatially defined and separated cell compartments; and f) determining a phenotypic response of said target cells to said test agent based on said monitoring of target cells in said identified subset of said spatially defined and separated cell compartments (20, 120) in e).