BuildWise
Continuous Testing Server with Functional UI test execution in parallel
All Platforms
Test Frameworks
BuildWise supports executing tests in the following test frameworks: RSpec, Cucumber, PyTest and Mocha. Before setting up BuildWise server (or agents), install and configure to run your selected test frameworks from command line.
RSpec
RSpec is the first and most popular Behaviour Driven Development (BDD) Framework fo Ruby.
Sample RSpec test
describe "User Login" do before(:all) do @driver = Selenium::WebDriver.for(browser_type) driver.navigate.to("http://travel.agileway.net") end after(:all) do driver.quit end it "[1] Can sign in OK" do login_page = LoginPage.new(driver) login_page.login("agileway", "testwise") try_for(3) { expect(driver.page_source).to include("Welcome")} driver.find_element(:link_text, "Sign off").click end
Execute RSpec test to report file in JUnit XML format
gem 'ci_reporter' gem 'rspec' require 'rspec/core/rake_task' require 'ci/reporter/rake/rspec'
# standard RSpec Rake task RSpec::Core::RakeTask.new("ui_tests:quick") do |t| specs_to_be_executed = specs_for_quick_build # list of files t.rspec_opts = "#{specs_to_be_executed.join(' ')} --order defined" end # task "ci:ui_tests:quick" => ["ci:setup:rspec"] do # ... Rake::Task["ui_tests:quick"].invoke # ... end
Cucumber
Cucumber is a BDD Framework for Ruby with test script syntax in plain-text alike English.
Sample Cucumber test
Feature: User Authentication As a reigstered user I can log in Scenario: Deny access due to invalid password Given I am on the home page When enter user name "agileway" and password "badpass" And click "Sign in" button Then I should see an log in error message
Cucumber makes no sense to me unless you have clients reading the tests. Why would you build a test-specific parser for English? - DHH, creator of Ruby on Rails
Execute Cucumber test to report file in JUnit XML format
gem 'ci_reporter' gem 'ci_reporter_cucumber' require 'rspec/core/rake_task' require 'ci/reporter/rake/cucumber'
# standard Cucumber Rake task Cucumber::Rake::Task.new("ui_tests:quick") do |t| features_to_be_executed = features_for_quick_build # a function return array of files log_dir = File.expand_path(File.join(File.dirname(__FILE__), "log")) FileUtils.rm_rf(log_dir) if File.exist?(log_dir) FileUtils.mkdir(log_dir) file_list = features_to_be_executed.join(" ") t.cucumber_opts = [ "--format progress -o log/features.log", "--format junit -o log/", "--format html -o log/features.html", file_list ] end # task "ci:ui_tests:quick" => ["ci:setup:cucumber"] do # ... Rake::Task["ui_tests:quick"].invoke # ... end
PyTest
pytest is a
class LoginTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.driver = webdriver.Chrome() @classmethod def tearDownClass(cls): cls.driver.quit() def setUp(self): self.driver.get("http://travel.agileway.net") def test_sign_in_ok(self): self.driver.find_element_by_id("username").send_keys("agileway") self.driver.find_element_by_id("password").send_keys("testwise") self.driver.find_element_by_xpath("//input[@value='Sign in']").click() self.assertIn("Signed in!", self.driver.page_source)
Execute pytest test to report file in JUnit XML format
Install packages with pip.
pip install -U pytest pip install xmlrunner
Run tests with JUnit XML report.
pytest --junitxml=XMLFILE TESTFILE
Mocha
Mocha is a JavaScript test framework running on Node.js.
Sample Mocha test script
var webdriver = require('selenium-webdriver'); var test = require('selenium-webdriver/testing'); var assert = require('assert'); var driver; const timeOut = 15000; String.prototype.contains = function(it) { return this.indexOf(it) != -1; }; test.describe('User Authentication', function () { test.before(function() { this.timeout(timeOut); driver = new webdriver.Builder().forBrowser('chrome').build(); }); test.beforeEach(function() { this.timeout(timeOut); driver.get('http://travel.agileway.net'); }); test.after(function() { driver.quit(); }); test.it('Invalid user', function() { this.timeout(timeOut); driver.findElement(webdriver.By.name('username')).sendKeys('agileway'); driver.findElement(webdriver.By.name('password')).sendKeys('badpass'); driver.findElement(webdriver.By.name('commit')).click(); driver.getPageSource().then(function(page_source){ assert(page_source.contains("Invalid email or password")) }); });
Execute Mocha test to report file in JUnit XML format
JUnit Reporter for Mocha produces JUnit-style XML test results for Mocha tests.
npm install -g mocha npm install -g mocha-junit-reporter
Run all tests in spec
, and output a results file at ./test-results.xml.
mocha spec --reporter mocha-junit-reporter
Run specific tests and output report to a specific file.
mocha--reporter mocha-junit-reporter --reporter-options mochaFile= </pre>
© 2006 - 2024 AgileWay Pty Ltd. Powered by SiteWise CMS