Solved

Why aren't my tests passing in the Sauce Labs dashboard?

  • 17 February 2021
  • 1 reply
  • 22 views

Badge

My tests appear to be successful when executed on Sauce Labs, but I’m not seeing that they are being updated with a green checkmark/passed status. The same occurs for failing tests. How do I update that? 

icon

Best answer by aleks.community 17 February 2021, 02:47

View original

1 reply

Badge

Sauce Labs does not automatically set tests to pass or fail, a user should be able to do that in their test suite. 

By Default, Sauce Labs shows a blue mark for the test that ran (Complete), regardless of if the test passed or failed, or an orange “!” to show that there is an issue with the test (Error). 

Once the user sets the status of Pass or Fail, they will be able to see those as well.

In order for the tests to show a pass or a fail status (on Sauce Labs that would be a green checkmark or a red ‘X’), you can refer to the Sauce Labs Wiki which has a few examples as well as sample repos to demonstrate how to do it.

For example (this is from the wiki linked above):

public class SauceTestWatcher extends TestWatcher {
private SauceSession sauceSession;

public void setSession(SauceSession session) {
sauceSession = session;
}

protected void succeeded(Description description) {
sauceSession.stop("passed");
}

protected void failed(Description description) {
sauceSession.stop("failed");
}
}

 

 

 

Reply