testing

Setting up a simple A/B testing with PHP

こ雲淡風輕ζ 提交于 2020-01-05 04:30:08
问题 I have a webpage on my site - or really it's a web application and this page is sort of the dashboard (have to be logged in). I'd like to try two designs for a panel that appears on the right of the page. I have the 2 panel designs and I can easily track when each is clicked but how do I deliver these alternative verisons? should i just somehow load them alternatively when the page is loaded (that would mean one person sees them both) should I flag the users as being either a or b and they

Test isolation broken with multiple databases in Django. How to fix it?

余生长醉 提交于 2020-01-05 04:16:17
问题 Django’s TestCase class wraps each test in a transaction and rolls back that transaction after each test, in order to provide test isolation. Apparently, however, only operations in the default database are within the scope of the transaction. I have a multiple database setup with a router that directs ORM calls on some models to a second database. This means that in the following example, test2 fails: class MyTestCase(TestCase): def test1(self): # Let's say Foo model ORM calls are routed to

How do I call a resolve in the callback of a mocked function?

廉价感情. 提交于 2020-01-05 04:13:04
问题 Here is the function I am trying to test: index.js : import ThirdParty from 'third-party'; function Main(){} Main.prototype.getStuff = function(){ return new Promise((resolve, reject) => { this.getOtherStuff().then((data) => { // Business logic... const tpinstance = new ThirdParty(); tpinstance.createThing().nestedFunction(null, () => { // This is where I'm resolving the outer function resolve({newdata: goodstuff}); }); }); } } Main.prototype.getOtherStuff = function(){ return new Promise(

error detection in static analysis and symbolic execution

时光总嘲笑我的痴心妄想 提交于 2020-01-05 04:09:15
问题 what kind of errors static analysis (e.g. compiler) can detect and symbolic execution can not detect? and what kind of errors that symbolic execution can detect and static analysis can not detect? for example can symbolic execution detect syntax errors? 回答1: In short, static analysis is capable of spotting coding issues, such as bad practices. For example, if you declare (unnecessarily) a class field as public, a static analysis tool may warn you that such field should be declared as private.

Duplicate the behaviour of a data driven test

时光总嘲笑我的痴心妄想 提交于 2020-01-04 15:31:14
问题 Right now, if you have a test that looks like this: [TestMethod] [DeploymentItem("DataSource.csv")] [DataSource( Microsoft.VisualStudio.TestTools.DataSource.CSV, "DataSource.csv", "DataSource#csv", DataAccessMethod.Sequential)] public void TestSomething() { string data = TestContext.DataRow["ColumnHeader"].ToString(); /* do something with the data */ } You'll get as many tests runs as you have data values when you execute this test. What I'd like to do is duplicate this kind of behaviour in

Duplicate the behaviour of a data driven test

狂风中的少年 提交于 2020-01-04 15:30:58
问题 Right now, if you have a test that looks like this: [TestMethod] [DeploymentItem("DataSource.csv")] [DataSource( Microsoft.VisualStudio.TestTools.DataSource.CSV, "DataSource.csv", "DataSource#csv", DataAccessMethod.Sequential)] public void TestSomething() { string data = TestContext.DataRow["ColumnHeader"].ToString(); /* do something with the data */ } You'll get as many tests runs as you have data values when you execute this test. What I'd like to do is duplicate this kind of behaviour in

Mocha preserve file state in test

北城余情 提交于 2020-01-04 13:47:58
问题 I have a unit test that is testing updating of a config file... Of course after I run the test my file is now altered. I was thinking I could use "before" to cache the file and restore it on "after". mod = require('../modtotest'); describe('Device Configuration', function(){ var confPath = '../config/config.json'; var config; before(function(){ //cache object config = require(confPath); }) describe('Update Config', function(){ it('Should update config', function(done){ mod.updateConfig(); /

Testng with multiple suites. @AfterSuite method closes driver after 1st suite and 2nd suite can't be run

梦想与她 提交于 2020-01-04 13:30:01
问题 I use testng for running tests. I have several test suites( Suite1.xml , Suite2.xml and Suite3.xml ), which are combined in one suite ( MasterSuite.xml ). Besides those, I have the class TestBase.java , where I configure such methods as @BeforeTest , @BeforeMethod , @BeforeSuite , @AfterSuite , etc. Running the @AfterSuite method closes the driver ( driver.quit() ). What I want: run MasterSuite which will run all my 3 suites one after another. The problem: after the first suite ( Suite1 ) is

Testng with multiple suites. @AfterSuite method closes driver after 1st suite and 2nd suite can't be run

冷暖自知 提交于 2020-01-04 13:29:49
问题 I use testng for running tests. I have several test suites( Suite1.xml , Suite2.xml and Suite3.xml ), which are combined in one suite ( MasterSuite.xml ). Besides those, I have the class TestBase.java , where I configure such methods as @BeforeTest , @BeforeMethod , @BeforeSuite , @AfterSuite , etc. Running the @AfterSuite method closes the driver ( driver.quit() ). What I want: run MasterSuite which will run all my 3 suites one after another. The problem: after the first suite ( Suite1 ) is

Export instruments trace data via command-line for leaks

為{幸葍}努か 提交于 2020-01-04 13:13:26
问题 I am using the following script to run leaks instruments from the command-line. instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Resources/templates/Leaks.tracetemplate <app path> after executing the command, i get instrumentscli0.trace file. How can i get readable data about leaks from that file. Is there any way to export the results to a text file via any command. In automation template we can specify an output folder using the switch -e UIARESULTSPATH