Skip to content

Commit

Permalink
System test for runner
Browse files Browse the repository at this point in the history
  • Loading branch information
SoloJacobs committed Dec 11, 2023
1 parent 8fa6d17 commit 8bfc4ef
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
12 changes: 4 additions & 8 deletions v2/robotmk/src/sessions/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ impl Session {

impl Display for Session {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
write!(
f,
"{}",
match self {
Self::Current(current_session) => format!("{}", current_session),
Self::User(user_session) => format!("{}", user_session),
}
)
match self {
Self::Current(current_session) => write!(f, "{}", current_session),
Self::User(user_session) => write!(f, "{}", user_session),
}
}
}

Expand Down
32 changes: 32 additions & 0 deletions v2/robotmk/tests/test_suite_run.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use anyhow::Result;
use camino::Utf8PathBuf;
use robotmk::config::RetryStrategy;
use robotmk::environment::{Environment, SystemEnvironment};
use robotmk::rf::robot::Robot;
use robotmk::sessions::session::{CurrentSession, Session};
use robotmk::suites::run_attempts_with_rebot;
use std::env::var;
use std::fs::create_dir_all;
use tokio_util::sync::CancellationToken;

#[test]
fn test_run() -> Result<()> {
let test_dir = Utf8PathBuf::from(var("TEST_DIR")?);
create_dir_all(&test_dir)?;
let robot = Robot {
robot_target: "~/suite/calculator.robot".into(),
n_attempts_max: 1,
command_line_args: vec![],
retry_strategy: RetryStrategy::Complete,
};
let (_attempt_outcomes, _rebot) = run_attempts_with_rebot(
&robot,
"test",
&Environment::System(SystemEnvironment {}),
&Session::Current(CurrentSession {}),
3,
&CancellationToken::default(),
&test_dir,
)?;
Ok(())
}

0 comments on commit 8bfc4ef

Please sign in to comment.