Hey guys, I have been studying a framework called WebdriverIO, it is a really good framework for Angular applications. It is compatible with BDD and TDD, so you can create your features, implement the step definition and it is also a synchronous command handling !!
Not only the hooks, but many useful parts are already in the config file, so you don’t need to create them separately, which is always very handful.
I have pushed the project to github so you can have a look on my example, it is very simple for now.
– To run the project you need to run
npm install and after
– In the login-spec.js you can add the scenario (describe) and the steps (it) directly like the step definitions, I don’t have the feature files for now.
– Look how you don’t need to add return for each step anymore. Since the steps are sync you don’t need to worry about it.
– The login-page.js groups all the common functions that will be used on the login scenarios.
– And the login-elements.js contains all the element getters that are on the login page, it works like a library for the elements and it will help you with the maintenance of the code.
If you want to give it a try as well you can add the webdriverio in the package of your project and follow these steps
You can run Postman scripts from the command line with Newman, but if you want to run these scripts as part of your Continuous Integration environment, you can run it with Docker or directly on Jenkins. In case you prefer to use Docker, you can get started by downloading the Jenkins Docker instance and changing the Dockerfile to include node using the following node installation code found in the Docker/Jenkins Repository:
# Install Node
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash
RUN apt-get -y install nodejs
RUN node -v
RUN npm -v
RUN npm install -g newman
Then, you will need to rebuild the Docker image and start the container with the same instructions as in the Jenkins Docker Repository.
You should now have a fully working Jenkins instance installed locally. Great! Now back to the task at hand using the newly-installed instance of Jenkins:
- Create a new “Freestyle” job in Jenkins.
You will set it up to be able to upload the collection as a parameter. When you do this with your own projects, you should commit the Postman collection into whatever repository you’re using and pull directly from that repository to build by selecting “this project is parametrized” and then choosing “Add Parameter” with a “File Parameter.”
- Select two file uploads – one for the collection and one for the environment.
- Add a post-build step with “Execute Shell”. You’ll use the same command you used to run it from your own command line earlier (If you are using the same OS) except your path should be collection.js, as you named it ‘newman run collection.json’ in the File Parameter name field.
If you want to use the built in JUnit Jenkins viewer, you can archive the XML test result and point the tests to it. Below there is a sample of how you might archive and use the JUnit test results.