Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test the performance: A Grid filter Execution time #240

Open
wijdenchebbi opened this issue Mar 1, 2016 · 3 comments
Open

Test the performance: A Grid filter Execution time #240

wijdenchebbi opened this issue Mar 1, 2016 · 3 comments

Comments

@wijdenchebbi
Copy link

Hi,

I want to test, in ASP.NET MVC project, the execution time in TestStack.Seleno , i found Stopwatch that is a c# class. Is there a specific method in TestStack.Seleno?

Also I want to add wait until in : Find.Element(By.Id("idtest")).Displayed;
How can i do it?

@robdmoore
Copy link
Member

It depends on what you are trying to test the timing of.

If you want to test a specific call then you could do something like:

var stopwatch = new Stopwatch();
stopwatch.Start();

Find.Element(By.Id("an-id"));

stopwatch.Stop();
// stopwatch.Elapsed contains the elapsed time

If you want to test a whole test run you could use whatever test framework you are using (e.g. NUnit / xUnit) to hook into the start and end of each test e.g. using fixtures or [SetUp]/[TearDown] etc.

@robdmoore
Copy link
Member

To wait for an element to be displayed you can do:

new WebDriverWait(Browser, TimeSpan.FromSeconds(5))
    .Until(b => ExpectedConditions.ElementIsVisible(By.Id("idtest")));

That assumes the code is running inside of a page object sine it accesses Browser.

I think that would read much better as:

WaitFor.VisibleElement(By.Id("idtest"), TimeSpan.FromSeconds(5));

Feel free to submit a pull request that modifies https://github.com/TestStack/TestStack.Seleno/blob/master/src/TestStack.Seleno/PageObjects/Actions/IWait.cs and https://github.com/TestStack/TestStack.Seleno/blob/master/src/TestStack.Seleno/PageObjects/Actions/Wait.cs to make that happen :)

@wijdenchebbi
Copy link
Author

Thanks,

WaitFor solves my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants