How to run tests in series in flutter - flutter

Is it possible to force one or more tests in a test suite to run separately and serially in dart/flutter?
Note: I'm not looking to run a single test via CLI filters. I want to be able to run my full test suite as part of my CI flow.
Example
The test runner ava is able to do this in javascript via the serial modifier:
test.serial('passes serially', t => {
t.pass();
});
https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#running-tests-serially
Context
I'm using a third-party library to communicate and authenticate with my backend server. This library makes use of a singleton to make accessing the current user "easier". However, it makes integration testing in parallel impossible since the testing process can only mimic a single user at a time, which in turn makes tests interfere with each other.

If you run "flutter test" in your CI all your tests in the project will be run in serial. No need to do something extra for that.

Related

Store results of unit test run into variables

I have a TeamCity build configuration that builds a C# project, runs some unit tests, and then does some extra things. My question is: Can I get information about my unit test run stored into build configuration variables (i.e. how many tests were run, how many were successful, how many failed, how many were skipped) so that I can then check these variables in a PowerShell script in later build steps and perform different actions depending on how many tests have passed?
AFAIK the best way is to ask these information directly to teamcity server using its REST API (pay attention, maybe the build locator could be a little be tricly to be found, if the build is still running).
By other hand, you can parse your NUnit test result file (or files if you run more than one NUnit test runner step in your build) inside your build agent machine.

How to User "Run" Command in Selinium Ide?

i have been assigned to present about 'run'command in selenium IDE but icant found any related examples or documentation
I make a lot of use of the run command. I use it to make up a test out of building blocks.
So, if I'm testing something that sits behind a login form, then I might have a test which is the happy path for login, and then a series of tests to test the feature. I don't want to have to have the login steps in each test - as if the login functionality changes I'd need to rebuild all of my scripts.
So, in this case, I'd have a test called #login (I use # to prefix those that are building blocks for easy identification and so that they float to the top of the list of tests in the IDE view) which would do the simplest thing possible to log in successfully.
When writing my tests for the new feature, I'd start with the following
Command: run
Target: #login
which I know will do a happy path login.
I can then build on top of that with the test steps for my new functionality

How to integrate rest api test using soapui with selenium using junit framework

I want to integrate selenium-webdriver framework written using junit with soapui rest api test suites, is there a way to do it?
Thanks in advance
Based on your comments, here is how you need to change your tests, so that, you will be able to run both kinds of tests together from within SoapUI i.e.,rest and ui.
I am not sure, if you already happened to create a soapui project. If not, create the project, import your .wadl or swagger definition of REST API.
Then create test suite, and test cases as required.
Now the test case should be having the steps as defined:
Rest Request Step(one or multiple steps) : this contains all your rest api calls
Groovy Script : Whatever test code that you have in your junit test, needs to come here. Groovy should be able to run most of your java code. But, if you are familiar, you can add groovy code itself. So, that it will be able to do exactly the same as you run it from your eclipse IDE.
Bringing your test steps into soapui test case will also have an added advantage that you can even share the data (in the form of variables ) across rest and UI as well.
You can even execute the tests using SoapUI's commandline utility testrunner.bat/.sh of SOAPUI_HOME/bin directory.
It is also possible to define application url / credentials in the form of Project / test suite / test case level properties (as applicable to the tests) and use Property Expansion. This even helps to run the tests against different servers such as dev, qa etc.,
I understand that you wanted to junit to execute the tests, but if you wanted to purely junit, then there is no need / get benefit using SoapUI. Instead of SoapUI, you can use different library, such as groovy wslite to make rest calls in junit itself .
Hope this helps.

End to end/integration testing - jenkins build

I am currently in a process of setting up Jenkins-CI for my Scala/Akka project.
I managed to create build that is integrated with BitBucket and executes builds when new pull reuqest is created/old pull request is updated.
As a testing framework we are using Specs2 which is also integrated with Jenkins by using JUnit post-build action. Now I am wondering how to properly execute e2e tests in my build.
Basically in git repository we have 2 projects, lets call them main-project and rest-tests. rest-tests contains e2e tests that are written using REST-assured library. To execute them I need to start main-project application (which uses Spray library to set up HTTP server) and then execute test task in sbt project of rest-test.
My idea was to execute main-project startup script (generated by sbt-native-packager) whith something like this:
$WORKSPACE/main-project/target/universal/stage/bin/main-project & echo $! > /tmp/main-project.pid
then execute test task of rest-tests project and finally kill process with PID that is saved in /tmp/main-project.pid file.
The last step should be implemented using https://wiki.jenkins-ci.org/display/JENKINS/Post+build+task because if some rest-testswill fail the next steps of build will not be executed (or at least that is what I am thinking) and I could end with my instance of application running after the build is finished.
This is first time when I am setting up CI system and my solution seems to be a little hacky (at least to me). I am wondering if there is a better/more idiomatic way of solving my problem of running e2e tests which require another application running.

Attach Current Build to Test

I'm playing around with Microsoft Test Manager 2013 (though it appears it is just MTM2012) to try and get a better understanding of test cases and test suites as I want to use this at work. So I was hoping that I could run a test suite on a build which gets included in this test suite. That is what I WANT to do, but it could very well be wrong. So maybe a better scope of what I'm doing at work might lend to a better answer.
My company makes tablet PC's. I write programs for those tablets. For sake of argument lets just say there are 5 tablets, that run a similar array of OS's. Tablet1,2,3 and 4 can run WinXP, WinXP embedded, Win7, and Win7 Embeded, and Tablet5 can run Win7, Win7 Embedded, and Win8 embedded. Lets say i'm making a Display test program. Naturally this display test will run differently on each tablet, but the program it self is supposed to be able to handle that along with not being able to worry about OS. So I wrote out a very simple test. Open Program, try to open again, verify only 1 instance, check display, close program.
I figured it would be good to make a Test Suite called "Complete Display Program Test" and put 5 sub test suites to that for each tablet. Then moved the 5 test cases to a single test suite. I configured all test cases to only have the correct tablet/OS configuration. Queued a build and waited for it to finish. I then attached that build to the main test suite. I then clicked on run a test for tablet 1 but I didn't see the build attached to the test runner. I've looked around a little bit to see why or how and haven't found anything. Question is is how do I do that? Or if you are scratching your head and wondering why in the world I am doing it this way then by all means suggest another way. This is the second time I have ever looked into MTM so I might not be doing it right.
Thank you for your time.
When running manual tests from MTM you will not see the build you are using in Test Runner.
But if you complete the test and set the test outcome you will be able to check which build you've ran the test against.
Just double-click on the test or select "View Results" to display test results:
This column is not visible by default. You will have to right-click on the column row and select the column "Buld number" to be displayed.
You will also be able to see the build number in "Analyse Test Runs" area:
The things are slightly different if you are running automated test.
Consider following approach:
Automate your Test Cases
See How to: Associate an Automated Test with a Test Case for details.
Create a Build Definition building your application under test AND assemblies containing your tests.
I strongly recommend build application you want to test and test assemblies using in the same Build Definition. (You will see why a little bit later).
Run this build definition and deploy the latest version of the application to the environment where you want run the tests.
This is very important to understand: if you run automated tests the tests assemblies only would be deployed automatically to the environment.
It's your job to deploy the right version of the application you are going to test.
Now you can run tests from MTM.
You can do it the way described by #AndrewClear in the comment to this answer: "choose "Run with Options" when you're beginning a test run" and select the latest build.
Now test assemblies containing tests which are using to automate Test Cases will be deployed automatically to the test environment and the tests will be executed.
That is the point you should recognize why is it so important to build application and tests with a single Build Definition: since the build number you've just selected when starting the tests will be stored along with the test results on TFS you will later know what version of you application you were testing (assuming you deployed the right version, of course).
You could go a little bit further if you want even more automation (This is the way I'm currently running automated tests)
Use Deploy-Build-Test template (this is a good place to start reading about Setting Up Automated Build-Deploy-Test Workflows).
Using this approach you will be able to automate deployment of the application you want to test.