Skip to contentমূল লেখায় যান

Topic 24 · AI/ML testingটপিক 24 · AI/ML testing

Capstone Test Pipeline: Eval, Red Team, and UI, Together

Every tool from this course earns its place here, on one app, at the same time.

7 min read7 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 7 sources7টি সোর্স · updated Nov 2026আপডেট: Nov 2026

Cheap checks run firstসস্তা চেক আগে চলে

Switch the order of the suites and see how much time a broken app wastes.সুইটগুলোর ক্রম বদলান আর দেখুন একটা ভাঙা অ্যাপে কত সময় নষ্ট হয়।

2 min2 মিনিট7 steps7টি ধাপ
  • Suitesসুইট5
  • Layersস্তর3
Evalইভ্যালDeepEvalDeepEvalPlaywrightPlaywrightRed teamরেড টিমGiskardGiskardcorrectnessসঠিকতাcorrectnessসঠিকতাUIUIsecurityনিরাপত্তাsecurityনিরাপত্তাAppঅ্যাপworkingঠিক আছে

You’ll learnআপনি শিখবেন

  • Each suite tests a layerপ্রতিটা সুইট একটা স্তর টেস্ট করে✓
  • What cost order meansখরচের ক্রম মানে কী
  • Why Langfuse traces every runLangfuse কেন প্রতিটা রান ট্রেস করে
  • Why slow scans first wastes timeধীর স্ক্যান আগে চালালে কেন সময় নষ্ট হয়

In plain words

The capstone's test pipeline is not a new technique; it is the whole course applied to one app at once:

Promptfoo eval      20 test cases, assertions on the answer <Cite n={1} />
DeepEval            hallucination and faithfulness, as Pytest <Cite n={3} />
Promptfoo red team  prompt injection, PII, excessive agency <Cite n={4} />
Giskard scan        a second attack library, cross-checked against the first <Cite n={5} />
Playwright          the chat UI end to end <Cite n={6} />
Langfuse            every call traced, for when a test fails and needs a reason <Cite n={7} />

The point of running all six together is not redundancy. Each one tests a different layer: the eval and DeepEval suites test correctness, the red team and Giskard scan test security, Playwright tests the interface the user actually touches, and Langfuse is the record that makes a failure in any of the other five diagnosable rather than just reproducible.

সহজ English

The capstone's test pipeline is not a new technique. It is the whole course used on one app at the same time:

Promptfoo eval      20 test cases, assertions on the answer <Cite n={1} />
DeepEval            hallucination and faithfulness, as Pytest <Cite n={3} />
Promptfoo red team  prompt injection, PII, excessive agency <Cite n={4} />
Giskard scan        a second attack library, cross-checked against the first <Cite n={5} />
Playwright          the chat UI end to end <Cite n={6} />
Langfuse            every call traced, for when a test fails and needs a reason <Cite n={7} />

You run all six, but not to repeat the same checks. Each tool tests a different layer.

  • The eval and DeepEval suites check that answers are correct.
  • The red team and the Giskard scan check security.
  • Playwright checks the interface the user really touches.
  • Langfuse keeps the record. When any of the other five fails, you can find out why, not just run it again.

বাংলা ব্যাখ্যা

Capstone-এর test pipeline একটা নতুন কৌশল নয়; এটা পুরো course একসাথে একটা app-এ প্রয়োগ করা:

Promptfoo eval      20 test cases, assertions on the answer <Cite n={1} />
DeepEval            hallucination and faithfulness, as Pytest <Cite n={3} />
Promptfoo red team  prompt injection, PII, excessive agency <Cite n={4} />
Giskard scan        a second attack library, cross-checked against the first <Cite n={5} />
Playwright          the chat UI end to end <Cite n={6} />
Langfuse            every call traced, for when a test fails and needs a reason <Cite n={7} />

ছয়টা একসাথে চালানোর বিষয় redundancy নয়। প্রতিটা আলাদা একটা layer টেস্ট করে: eval আর DeepEval suite সঠিকতা টেস্ট করে, red team আর Giskard scan নিরাপত্তা টেস্ট করে, Playwright ব্যবহারকারী আসলে যা ছোঁয় সেই interface টেস্ট করে, আর Langfuse সেই রেকর্ড যা বাকি পাঁচটার যেকোনো একটায় ব্যর্থতাকে শুধু reproduce নয়, diagnose করা যায় এমন করে তোলে।

How it works

Running order matters: cheap and fast checks first, so an obvious break fails in seconds, not after a ten-minute red team run.

1. Promptfoo eval       fast, deterministic assertions       seconds
2. DeepEval suite       LLM-judged metrics                   a minute or two
3. Playwright UI        the interface, against a running server   a minute
4. Promptfoo red team   generated adversarial prompts        several minutes
5. Giskard scan         a second, independent attack library  several minutes

(Timings are illustrative and will vary.)

Langfuse traces everything from step 1 onward Source 7সোর্স 7, so when step 4 or 5 finds something, the trace for that exact call — the prompt, the retrieved context, the model's answer — can be found in Langfuse, so you do not need a re-run with extra logging bolted on.

The Promptfoo eval config and the red team config are two different files against the same target, because they serve different purposes: the eval config asserts correctness on expected inputs Source 1সোর্স 1, the red team config generates adversarial ones Source 4সোর্স 4.

সহজ English

Order matters. Run the cheap, fast checks first. An obvious break then fails in seconds, not after a ten-minute red team run.

1. Promptfoo eval       fast, deterministic assertions       seconds
2. DeepEval suite       LLM-judged metrics                   a minute or two
3. Playwright UI        the interface, against a running server   a minute
4. Promptfoo red team   generated adversarial prompts        several minutes
5. Giskard scan         a second, independent attack library  several minutes

(Timings are illustrative and will vary.)

Langfuse traces everything from step 1 onward Source 7সোর্স 7. Say step 4 or 5 finds a problem. The trace for that exact call can be found in Langfuse. It shows the prompt, the retrieved context, and the model's answer. You do not need to re-run with extra logging added.

The eval config and the red team config are two different files. Both aim at the same target. They have different jobs. The eval config checks correct answers for expected inputs Source 1সোর্স 1. The red team config generates adversarial inputs Source 4সোর্স 4.

বাংলা ব্যাখ্যা

চালানোর ক্রম গুরুত্বপূর্ণ: সস্তা আর দ্রুত চেক আগে, যাতে একটা সুস্পষ্ট ব্রেক সেকেন্ডে ব্যর্থ হয়, দশ-মিনিটের red team run-এর পরে নয়।

1. Promptfoo eval       fast, deterministic assertions       seconds
2. DeepEval suite       LLM-judged metrics                   a minute or two
3. Playwright UI        the interface, against a running server   a minute
4. Promptfoo red team   generated adversarial prompts        several minutes
5. Giskard scan         a second, independent attack library  several minutes

(সময়গুলো উদাহরণমাত্র, বাস্তবে বদলাবে।)

Langfuse ধাপ ১ থেকে সবকিছু trace করে Source 7সোর্স 7, তাই ধাপ ৪ বা ৫ কিছু পেলে, সেই নির্দিষ্ট call-এর trace — prompt, retrieved context, model-এর উত্তর — Langfuse-এ পাওয়া যাবে, তাই অতিরিক্ত logging জুড়ে re-run করার দরকার নেই।

Promptfoo eval config আর red team config একই target-এর বিপরীতে দুটো আলাদা ফাইল, কারণ তারা আলাদা উদ্দেশ্য সাধন করে: eval config প্রত্যাশিত input-এ সঠিকতা assert করে Source 1সোর্স 1, red team config adversarial input তৈরি করে Source 4সোর্স 4।

In practice

The eval config, 20 cases against the live endpoint Source 1সোর্স 1 Source 2সোর্স 2:

# promptfooconfig.yaml
prompts: ["{{question}}"]
providers:
  - id: http://localhost:8000/ask
    config:
      method: POST
      headers:
        Content-Type: application/json
      body:
        question: "{{prompt}}"
      transformResponse: json.answer
tests: file://tests/capstone-eval-cases.yaml   # 20 rows of vars: question, expected_fact
defaultTest:
  assert:
    - type: contains
      value: "{{expected_fact}}"

A DeepEval hallucination test over the same endpoint Source 3সোর্স 3:

import pytest
import requests
import yaml
from deepeval import assert_test
from deepeval.metrics import FaithfulnessMetric
from deepeval.test_case import LLMTestCase

CASES = [row["vars"] for row in yaml.safe_load(open("tests/capstone-eval-cases.yaml"))]


@pytest.mark.parametrize("case", CASES)
def test_the_answer_is_faithful_to_the_retrieved_context(case):
    response = requests.post("http://localhost:8000/ask", json={"question": case["question"]}).json()
    assert_test(
        LLMTestCase(
            input=case["question"],
            actual_output=response["answer"],
            retrieval_context=response["context"],
        ),
        [FaithfulnessMetric(threshold=0.9)],
    )

The red team and the scan, as a two-tool gate Source 4সোর্স 4 Source 5সোর্স 5:

npx promptfoo redteam run --config redteam-config.yaml
pip install "giskard[scan,openai]"   # a scan needs an LLM provider and an API key
# scripts/run_giskard_scan.py is your own wrapper around giskard's vulnerability_scan
python -m scripts.run_giskard_scan --target http://localhost:8000/ask

A Playwright UI test against the chat widget Source 6সোর্স 6:

from playwright.sync_api import Page, expect

def test_sending_a_question_renders_an_answer(page: Page):
    page.goto("http://localhost:3000")
    page.locator("#chat-input").fill("What is your return policy?")
    page.locator("#send").click()
    expect(page.locator(".bot-message")).to_contain_text("30 day", timeout=10_000)

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Run the suites in cost order: assertions, then LLM-judged metrics, then the slower adversarial scans.
  • Point every test at the same running instance of the app, so a Langfuse trace from a failure always has a matching call to inspect.
  • Keep the 20 eval cases and the red team's generated cases in separate files; they have different owners and different update cadences.

সহজ English

First, the eval config. It runs 20 cases against the live endpoint Source 1সোর্স 1 Source 2সোর্স 2:

# promptfooconfig.yaml
prompts: ["{{question}}"]
providers:
  - id: http://localhost:8000/ask
    config:
      method: POST
      headers:
        Content-Type: application/json
      body:
        question: "{{prompt}}"
      transformResponse: json.answer
tests: file://tests/capstone-eval-cases.yaml   # 20 rows of vars: question, expected_fact
defaultTest:
  assert:
    - type: contains
      value: "{{expected_fact}}"

Next, a DeepEval hallucination test on the same endpoint Source 3সোর্স 3:

import pytest
import requests
import yaml
from deepeval import assert_test
from deepeval.metrics import FaithfulnessMetric
from deepeval.test_case import LLMTestCase

CASES = [row["vars"] for row in yaml.safe_load(open("tests/capstone-eval-cases.yaml"))]


@pytest.mark.parametrize("case", CASES)
def test_the_answer_is_faithful_to_the_retrieved_context(case):
    response = requests.post("http://localhost:8000/ask", json={"question": case["question"]}).json()
    assert_test(
        LLMTestCase(
            input=case["question"],
            actual_output=response["answer"],
            retrieval_context=response["context"],
        ),
        [FaithfulnessMetric(threshold=0.9)],
    )

Then the red team and the scan. Together they form a two-tool gate Source 4সোর্স 4 Source 5সোর্স 5:

npx promptfoo redteam run --config redteam-config.yaml
pip install "giskard[scan,openai]"   # a scan needs an LLM provider and an API key
# scripts/run_giskard_scan.py is your own wrapper around giskard's vulnerability_scan
python -m scripts.run_giskard_scan --target http://localhost:8000/ask

Last, a Playwright UI test on the chat widget Source 6সোর্স 6:

from playwright.sync_api import Page, expect

def test_sending_a_question_renders_an_answer(page: Page):
    page.goto("http://localhost:3000")
    page.locator("#chat-input").fill("What is your return policy?")
    page.locator("#send").click()
    expect(page.locator(".bot-message")).to_contain_text("30 day", timeout=10_000)

Tutorial advice: This advice is the tutorial's own. It does not come from the sources.

  • Run the suites in cost order. Start with assertions, then LLM-judged metrics, then the slower adversarial scans.
  • Point every test at the same running instance of the app. Then a Langfuse trace from a failure always has a matching call to inspect.
  • Keep the 20 eval cases and the red team's generated cases in separate files. They have different owners and different update cadences.

বাংলা ব্যাখ্যা

Eval config, live endpoint-এর বিপরীতে ২০টা কেস Source 1সোর্স 1 Source 2সোর্স 2:

# promptfooconfig.yaml
prompts: ["{{question}}"]
providers:
  - id: http://localhost:8000/ask
    config:
      method: POST
      headers:
        Content-Type: application/json
      body:
        question: "{{prompt}}"
      transformResponse: json.answer
tests: file://tests/capstone-eval-cases.yaml   # 20 rows of vars: question, expected_fact
defaultTest:
  assert:
    - type: contains
      value: "{{expected_fact}}"

একই endpoint-এর ওপর একটা DeepEval hallucination টেস্ট Source 3সোর্স 3:

import pytest
import requests
import yaml
from deepeval import assert_test
from deepeval.metrics import FaithfulnessMetric
from deepeval.test_case import LLMTestCase

CASES = [row["vars"] for row in yaml.safe_load(open("tests/capstone-eval-cases.yaml"))]


@pytest.mark.parametrize("case", CASES)
def test_the_answer_is_faithful_to_the_retrieved_context(case):
    response = requests.post("http://localhost:8000/ask", json={"question": case["question"]}).json()
    assert_test(
        LLMTestCase(
            input=case["question"],
            actual_output=response["answer"],
            retrieval_context=response["context"],
        ),
        [FaithfulnessMetric(threshold=0.9)],
    )

Red team আর scan, একটা দুই-টুল gate হিসেবে Source 4সোর্স 4 Source 5সোর্স 5:

npx promptfoo redteam run --config redteam-config.yaml
pip install "giskard[scan,openai]"   # a scan needs an LLM provider and an API key
# scripts/run_giskard_scan.py is your own wrapper around giskard's vulnerability_scan
python -m scripts.run_giskard_scan --target http://localhost:8000/ask

Chat widget-এর বিপরীতে একটা Playwright UI test Source 6সোর্স 6:

from playwright.sync_api import Page, expect

def test_sending_a_question_renders_an_answer(page: Page):
    page.goto("http://localhost:3000")
    page.locator("#chat-input").fill("What is your return policy?")
    page.locator("#send").click()
    expect(page.locator(".bot-message")).to_contain_text("30 day", timeout=10_000)

Tutorial advice

এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।

  • খরচের ক্রমে suite চালান: assertion, তারপর LLM-judged metric, তারপর ধীর adversarial scan।
  • প্রতিটা টেস্ট app-এর একই চলমান instance-এ নির্দেশ করুন, যাতে একটা ব্যর্থতা থেকে Langfuse trace-এর সবসময় পরিদর্শনের জন্য একটা মিলে যাওয়া call থাকে।
  • ২০টা eval কেস আর red team-এর generated কেস আলাদা ফাইলে রাখুন; তাদের মালিক আর update ছন্দ আলাদা।

Common mistakes

Mistake 1: running the slow scans first. A broken endpoint should fail in the first few seconds of the eval suite, not after ten minutes of red teaming an app that was never going to pass it.

Mistake 2: no shared target between the suites. If the UI tests run against a different deployment than the eval suite, a passing eval and a failing UI test are not actually contradictory.

Mistake 3: not tracing the eval and red team runs, only production traffic. The traces from a test run are exactly the ones a tester needs when a test fails Source 7সোর্স 7.

Mistake 4: one combined report instead of six. Collapsing correctness, security, and UI findings into one pass/fail hides which layer actually broke.

Mistake 5: skipping the Playwright suite because the eval suite passed. An API that answers correctly can still render a broken loading state or drop the second half of a streamed response.

সহজ English

Mistake 1: running the slow scans first. A broken endpoint should fail in the first seconds of the eval suite. It should not fail after ten minutes of red teaming an app that was never going to pass.

Mistake 2: no shared target between the suites. Say the UI tests run against a different deployment than the eval suite. Then a passing eval and a failing UI test do not truly contradict each other.

Mistake 3: tracing only production traffic, not eval and red team runs. The traces from a test run are the ones a tester needs when a test fails Source 7সোর্স 7.

Mistake 4: one combined report instead of six. One pass/fail for correctness, security, and UI findings hides which layer broke.

Mistake 5: skipping the Playwright suite because the eval suite passed. An API can answer correctly and still show a broken loading state. It can also drop the second half of a streamed response.

বাংলা ব্যাখ্যা

ভুল ১: ধীর scan আগে চালানো। একটা ভাঙা endpoint-এর eval suite-এর প্রথম কয়েক সেকেন্ডেই ব্যর্থ হওয়া উচিত, এমন একটা app-কে দশ মিনিট red team করার পরে নয় যেটা কখনো পাস করত না।

ভুল ২: suite-গুলোর মধ্যে একটা ভাগাভাগি target নেই। UI টেস্ট যদি eval suite-এর চেয়ে আলাদা deployment-এর বিপরীতে চলে, একটা পাস করা eval আর একটা ব্যর্থ UI test আসলে পরস্পরবিরোধী নয়।

ভুল ৩: eval আর red team run trace না করা, শুধু production traffic। একটা test run-এর trace ঠিক সেগুলোই যা একটা টেস্টারের দরকার যখন একটা test ব্যর্থ হয় Source 7সোর্স 7।

ভুল ৪: ছয়টার বদলে একটা combined রিপোর্ট। সঠিকতা, নিরাপত্তা, আর UI finding-কে একটা pass/fail-এ ভেঙে ফেলা লুকায় কোন layer আসলে ভেঙেছে।

ভুল ৫: eval suite পাস করেছে বলে Playwright suite বাদ দেওয়া। একটা API যা সঠিকভাবে উত্তর দেয় তারপরও একটা ভাঙা loading state render করতে পারে বা একটা streamed response-এর দ্বিতীয় অর্ধেক ফেলে দিতে পারে।

What a tester can check

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Run the six suites in cost order and stop on the first failure category, so time is not spent red teaming an app that fails its own eval suite.
  • Confirm every suite targets the same running instance.
  • Confirm a Langfuse trace exists for any failing case before debugging starts.
  • Produce one findings table combining all six results, with a column for which layer (correctness, security, UI) each finding belongs to.

সহজ English

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Run the six suites in cost order and stop on the first failure category, so time is not spent red teaming an app that fails its own eval suite.
  • Confirm every suite targets the same running instance.
  • Confirm a Langfuse trace exists for any failing case before debugging starts.
  • Produce one findings table combining all six results, with a column for which layer (correctness, security, UI) each finding belongs to.

বাংলা ব্যাখ্যা

Tutorial advice

এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।

  • ছয়টা suite খরচের ক্রমে চালান আর প্রথম failure category-তে থামুন, যাতে এমন একটা app red team করতে সময় ব্যয় না হয় যেটা তার নিজের eval suite-এই ব্যর্থ হয়।
  • প্রতিটা suite একই চলমান instance-কে লক্ষ্য করে তা নিশ্চিত করুন।
  • debugging শুরুর আগে যেকোনো ব্যর্থ কেসের জন্য একটা Langfuse trace আছে তা নিশ্চিত করুন।
  • ছয়টা ফলাফল একত্র করে একটা findings table বানান, প্রতিটা finding কোন layer-এর (correctness, security, UI) তার একটা column সহ।

Key words

WordWhat it means
Test pipelineThe full set of suites run against one app: eval, hallucination, red team, scan, UI
Cost orderRunning cheap, fast checks before slow, expensive ones
Shared targetEvery test suite pointed at the same running instance of the app
Findings tableA combined report tagging each finding with the layer it belongs to
TraceThe recorded call that lets a test failure be diagnosed, not just reproduced
  1. [1]
    Configuration reference

    Promptfoo (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  2. [2]
    HTTP/HTTPS API provider

    Promptfoo (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  3. [3]
    Getting started

    DeepEval docs · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  4. [4]
    Red teaming

    Promptfoo (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  5. [5]
    Scan a model

    Giskard (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  6. [6]
    Playwright intro

    Playwright (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  7. [7]
    Introduction

    Langfuse (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01