Skip to main content

TestHistory

Struct TestHistory 

Source
pub struct TestHistory { /* private fields */ }
Expand description

Test history store backed by JSON files.

Implementations§

Source§

impl TestHistory

Source

pub fn open(dir: &Path) -> Result<Self>

Open or create a history store in the given directory.

Source

pub fn new_in_memory() -> Self

Create a new in-memory history (for testing).

Source

pub fn record(&mut self, result: &TestRunResult) -> Result<()>

Record a test run result.

Source

pub fn run_count(&self) -> usize

Get the number of recorded runs.

Source

pub fn runs(&self) -> &[RunRecord]

Get all run records.

Source

pub fn recent_runs(&self, n: usize) -> &[RunRecord]

Get the most recent N runs.

Source

pub fn get_trend(&self, test_name: &str, last_n: usize) -> Vec<TestTrend>

Get trend data for a specific test.

Source

pub fn get_flaky_tests( &self, min_runs: usize, max_pass_rate: f64, ) -> Vec<FlakyTest>

Get flaky tests (tests that alternate between pass and fail).

Get tests that are getting slower over time.

Source

pub fn prune(&mut self, keep: usize) -> Result<usize>

Prune old entries, keeping only the most recent N.

Source

pub fn pass_rate(&self, last_n: usize) -> f64

Get the overall pass rate over recent runs.

Source

pub fn avg_duration(&self, last_n: usize) -> Duration

Get the average duration over recent runs.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.