title,body,link,tags,view_count,is_answered,score,answer_count,critical points
"Why are my Framework tests NOT running on my .Net Standard project, but .Net Core tests will, in Visual Studio 2022?","We have built a .Net Standard project. As such, we want to make sure it runs in .Net Core and .Net Framework.  I have built out both suites of NUnit tests.  However, the .Net Framework tests just stopped running. When I try to run one, it compiles, goes through the motions, then returns &quot;0 of 0 tests run&quot; with no errors.
",https://stackoverflow.com/questions/76175735/why-are-my-framework-tests-not-running-on-my-net-standard-project-but-net-cor,"['visual-studio', 'testing', 'nunit']",11,FALSE,0,1,Unrelated to testing
IEEE 829 test plan documentation standard contains all of the following except,"I have found in muck test the following question:

IEEE 829 test plan documentation standard contains all of the following except:
a) test items
b) test deliverables
c) test tasks
d) test environment
e) test specification

According to the website, the right answer is the option e). However, if you have a look of the IEEE 829 test plan documentation, one of the Sections to be included is:
-Test deliverables : The artifacts created by the testing team that will be delivered as per this plan. Examples include - <strong>test specifications (design, case and procedure)</strong>, output from tools, test reports, etc.

It looks a bit confusing. Is it a wrong question ? . When they ask about <strong>""test specification""</strong> without a <strong>""s""</strong> at the end, are they referring to another topic ? 
",https://stackoverflow.com/questions/40759463/ieee-829-test-plan-documentation-standard-contains-all-of-the-following-except,"['unit-testing', 'testing']",13249,FALSE,0,2,Question irrelevant to research
"In R, How can I run a Multiple linear model estimation under robust standard error in HC3, so I can carry out a Chow test?","I am trying to make a wage model, with data from Uruguay, under the following form:
mod &lt;- lm(logsalxhora ~ 
      exper + mujer + menoresde14años_hogar + 
      sq_menoresde14años_hogar + informal + casado + separado + 
      noblanco + q_trabajo,
      data = ECH.2019)

But due to heteroskedasticity, I need to run the estimation under robust standard error, with HC3.
Which I achieved doing the following:
mod &lt;- lm(logsalxhora ~ 
     exper + mujer + menoresde14años_hogar + 
     sq_menoresde14años_hogar +  informal + casado + separado+ 
     noblanco + q_trabajo,
           data = ECH.2019)
robust_se &lt;- sqrt(diag(vcovHC(mod, type = &quot;HC3&quot;)))

But in order to do a Chow test, I think I need to create an object which contains this model under that specific form of estimation, but I don't know how.
I have a code with which I can run a chow test:
devianceSR &lt;- deviance(mod1) + deviance(mod2)
n &lt;- length(modrestricto$fitted.values)
k=mod2$rank -1
chow &lt;- ((deviance(mod) - devianceSR)/devianceSR)*((n-2*(k+1))/(k+1))
p.valorF = pf(chow, k+1, n-2*(k+1), lower.tail = F,)

But in order to do so, I need the model as an object, not as a value.
",https://stackoverflow.com/questions/75599002/in-r-how-can-i-run-a-multiple-linear-model-estimation-under-robust-standard-err,"['r', 'testing']",27,FALSE,0,0,No answers/sugggestions were provided
Is there a standard way to breakdown huge optimization models to ensure the submodules are working correctly?,"Apologies as this may be a general question for optimization:
For truly large scale optimization models it feels as if the model becomes quite complex and cumbersome before it is even testable. For small scale optimization problems, up to even 10-20 constraints its feasible to code the entire program and just stare at it and debug.
However, for large scale models with potentially 10s-100 of constraint equations it feels as if there should be a way to test subsections of the optimization model before putting the entire thing together.
Imagine you are writing a optimization for a rocket that needs to land on the moon the model tells the rocket how to fly itself and land on the moon safely. There might be one piece of the model that would dictate the gravitational effects of the earth and moon and their orbits together that would influence how the rocket should position itself, another module that dictates how the thrusters should fire in order to maneuver the rocket into the correct positions, and perhaps a final module that dictates how to optimally use the various fuel sources.
Is there a good practice to ensure that one small section (e.g the gravitational module) works well independently of the whole model. Then iteratively testing the rocket thruster piece, then the optimal fuel use etc. Since, once you put all the pieces together and the model doesn't resolve (perhaps due to missing constraints or variables) it quickly becomes a nightmare to debug.
What are the best practices if any for iteratively building and testing large-scale optimization models?
",https://stackoverflow.com/questions/75154731/is-there-a-standard-way-to-breakdown-huge-optimization-models-to-ensure-the-subm,"['testing', 'optimization', 'design-patterns']",30,FALSE,0,1,Unrelated to testing
During gradle test show standard out and err only for failed tests,"I have a large test suite running on travis-ci, which has a textual output. I would like to configure gradle in a way that only for failed tests, the standard output and standard error streams are displayed. For all other tests which have been executed correctly, this should not happen so that the console is not polluted with that noise. 

I am aware how to enable or disable the standard output/error logging, but I am unsure how to make this dependend on the test result.
",https://stackoverflow.com/questions/36558340/during-gradle-test-show-standard-out-and-err-only-for-failed-tests,"['testing', 'gradle', 'travis-ci']",6146,TRUE,12,2,Unrelated to testing
"Is there any standard range for testing web app in older browser version i.e., how older version should I consider?","Like If I test my web app in chrome, then what should be the chrome version range should I check ?
",https://stackoverflow.com/questions/73687272/is-there-any-standard-range-for-testing-web-app-in-older-browser-version-i-e-h,"['testing', 'cross-browser', 'software-quality']",18,FALSE,0,0,No answers/sugggestions were provided
How to test stripe Standard connect integration since test accounts need validation first?,"When trying via code to create standard accounts, the option to skip the form is not present. Even though the page to connect the account shows the test-mode tag, the page expects you to fill the form with &quot;real&quot; data.
When creating the account using the Stripe Dashboard in test mode, you are given a link that shows the New account flow and it has a &quot;skip form&quot; option. The option basically closes the form, but the account is still in restricted mode.
<a href=""https://i.stack.imgur.com/DOY9t.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/DOY9t.png"" alt=""standard accounts with skip-form are initially restricted and there is no way to provide test data so that their status changes"" /></a>
What is required to have a Standard test account in order to test the other functionality of charges, checkouts, etc?
",https://stackoverflow.com/questions/73528366/how-to-test-stripe-standard-connect-integration-since-test-accounts-need-validat,"['testing', 'stripe-payments']",345,TRUE,0,1,Related to testing semantics and not practices
Gradle: Remove Standard Output from Test Summary,"When generating Test Summaries with Gradle, I like to remove the Standard output.
More specific, the button &quot;Standard output&quot; and everything that is shown when clicking onto should not be part of the Test Summary:
<a href=""https://i.stack.imgur.com/0kUDR.png"" rel=""nofollow noreferrer"">Test Summary</a>
How can this be achieved?
",https://stackoverflow.com/questions/73307942/gradle-remove-standard-output-from-test-summary,"['gradle', 'testing']",39,FALSE,0,0,No answers/sugggestions were provided
Should a unit test project for a .NET Standard library target frameworks other than .NET Core?,"When you have a .NET Standard library, the test project needs to target an actual platform. The most logical choice (I assume) is to target .NET Core because it runs on multiple operating systems, but it's also possible to target multiple platforms <a href=""https://web.archive.org/web/20200906041227/https://xunit.github.io/docs/getting-started/netcore/cmdline"" rel=""nofollow noreferrer"">as demonstrated in the xUnit.net documentation</a>:
<blockquote>
With a single test project, we can have our tests run against multiple target frameworks. Open the .csproj file and change this:
<pre class=""lang-xml prettyprint-override"">&lt;PropertyGroup&gt;
  &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
&lt;/PropertyGroup&gt;

To this:
<pre class=""lang-xml prettyprint-override"">&lt;PropertyGroup&gt;
  &lt;TargetFramework&gt;net452;netcoreapp2.1&lt;/TargetFramework&gt;
&lt;/PropertyGroup&gt;

</blockquote>
Is there any practical reason for doing so, i.e. are there situations that require you to target multiple platforms?
The only reason I can think of is to be aware of bugs in a specific platform, which has occurred a couple times in .NET Framework. But that feels like you would be testing the platform instead of your library, so I'm not sure if that's a good enough reason.
",https://stackoverflow.com/questions/50839162/should-a-unit-test-project-for-a-net-standard-library-target-frameworks-other-t,"['testing', '.net-standard']",1108,TRUE,2,2,Unrelated to testing
Process from standard input line by line,"Given problem like this:
Find the min and max from a list of integers. There are T test cases, for each test, print no. of current test cases and the answer.
Input.txt file
3
3 4 5 1 2
100 22 3 500 60
18 1000 77 10 300

Output
Test case 1: Max :5, Min :1
Test case 2: Max :500, Min :3
Test case 3: Max :1000, Min :10

In C++, how can I process only one line from standard input in each test case iteration. The code that I have tried is like this.
#include &lt;iostream&gt;
#include &lt;iterator&gt;
#include &lt;algorithm&gt;


using namespace std;

int main() {
   
   freopen(&quot;input.txt&quot;,&quot;r&quot;,stdin);
   int T;
   cin&gt;&gt;T;

   for(int i=1; i&lt;=T; ++i) {
        vector&lt;int&gt; arrayInt;
        int n;

        //Should only process one line for each test case
        while(cin&gt;&gt;n) {
            arrayInt.push_back(n);
        }

        int max = *max_element(arrayInt.begin(), arrayInt.end());
        int min = *min_element(arrayInt.begin(), arrayInt.end());
        cout&lt;&lt;&quot;Test case &quot; &lt;&lt; i &lt;&lt; &quot;: Max :&quot; &lt;&lt; max &lt;&lt; &quot;, Min :&quot;&lt;&lt; min &lt;&lt; &quot;\n&quot;;
   }

}

Output that I got when I run it on the command line
Test case 1: Max :1000, Min :1

Please help me to fix my code. Thanks in advance for the answers.
",https://stackoverflow.com/questions/71321404/process-from-standard-input-line-by-line,"['c++', 'testing', 'vector', 'input', 'file-io']",226,TRUE,1,1,
What is the standard way of using selenium in production?,"I have written some tests for my website using selenium and javascript. I want to know the standard way of using this script in production. Locally I'm running chrome driver and testing my script. What I have tried is in start of my package.json I run my test node test.js &amp;&amp; react-scripts start.What is the standard way of doing the same in production?
",https://stackoverflow.com/questions/70669672/what-is-the-standard-way-of-using-selenium-in-production,"['javascript', 'node.js', 'reactjs', 'selenium', 'testing']",597,TRUE,1,3,
Is there any standard template or considered a suitable format for writing test documentation for a project?,"I am working on a Django-Rest-React project, and I need to create test documentation for my team. I generally know what test documentation should contain, like a checklist, test case, use case, bug report etc.
However, can anyone give me some tips on any additional items to include or arrange everything in the documentation to make it more readable?
",https://stackoverflow.com/questions/70050427/is-there-any-standard-template-or-considered-a-suitable-format-for-writing-test,"['reactjs', 'testing', 'django-rest-framework', 'documentation', 'documentation-generation']",36,TRUE,0,1,
Why C compiler validation suites themselves may use the C standard library if the C standard library is actually under test?,"How it is possible for C compiler validation suites to use any feature of the C standard library if the C standard library is actually under test and may be buggy (which invalidates the validation suite itself)?
For example, the suite may use itself memset, fopen, etc., but memset, fopen, etc. are actually under test and may be buggy.
Confused. Clarification / experience is needed.
UPD. Clarified after examining suite's source code. The suite uses two compilers:
<ol>
<li>Reference compiler is used to build the suite itself.</li>
<li>IUT (Implementation Under Test) compiler is used to run tests on it.</li>
</ol>
",https://stackoverflow.com/questions/68666842/why-c-compiler-validation-suites-themselves-may-use-the-c-standard-library-if-th,"['c', 'validation', 'testing', 'standards-compliance', 'suite']",106,TRUE,-1,1,
Is there a standard for testing Mumps?,"We need to be able to execute automation testing of Mumps code as a business requirement.
Is this possible? Any suggestions on where to start?  I am a Developer, but I have no experience with Mumps.
Many thanks!
",https://stackoverflow.com/questions/68470415/is-there-a-standard-for-testing-mumps,"['testing', 'automated-tests', 'mumps']",81,TRUE,-1,1,
"Is there a standard name for testing the number of tests, or other calculated parameters?","This is a general question about testing, independent of language.
One method I often use when writing tests, which I've never heard of before although I surely didn't invent it, is the following:
Suppose that I'm testing something multiple times, e.g. in a loop; e.g., it could be artificially generated test data. E.g., it might be calling a func(...) which returns some data containing a list/vector/array etc. etc. of results.
I have at the start of the test something like
int total_size = 0
...and with each calculated result:
data = func(...)
do_some_test(data)
total_size = total_size + data.size()
Then, finally at the end of the test, I'll do
TEST_THAT(total_size == 10000)
...or whatever the value is. Of course, it might not be size that I test; it could use any discrete or integer-valued property of the data objects.
So, this could be regarded as a very weak kind of integer-valued hash of test data, input and/or output, although human-readable.
<strong>There are at least four reasons to do this:</strong>
(a) Check that we are actually testing something; it's all too easy to have bugs in test code which mean that we're not testing anything, or as much as we thought.
(b) If something changes unexpectedly, due to the algorithms or tests, even if the tests still pass, then we have a chance of spotting that it changed.
(c) Although it could give a false sense of security, it's always nice to see that a test has run through 1000 times, or tested 5000 things, etc. etc. rather than just 5, say. If people ask you how well tested something is, you can immediately say <em>&quot;it has been tested on 2000 objects, of total size 10000&quot;</em>, or similar.
(d) If running the same code on multiple platforms or compilers, it helps to find differences between them.
So, my questions (sorry, two rather than one!):
<strong>(1) Is this a standard method with a well-known name?</strong>
<strong>(2) Assuming it is well known, is this regarded as good practice (if done sensibly, of course?)</strong>
",https://stackoverflow.com/questions/65238739/is-there-a-standard-name-for-testing-the-number-of-tests-or-other-calculated-pa,"['unit-testing', 'testing', 'terminology']",33,FALSE,0,0,
How to override standard testcafe errors?,"I need to override standard testcafe error messages by adding there Selector's input locator - this way I will know more about failure and can debug that manually at least by manually checking  ability for selector to be found.
When I try just to catch error by this code:
<pre class=""lang-js prettyprint-override"">  try {
    const selector = Selector('basdf')
    await t.click(selector);
  }
  catch (e) {
    console.log(e);
  }

I'm getting this object:
{
  code: 'E24',
  isTestCafeError: true,
  callsite: CallsiteRecord {
    filename: '/Users/myPath/helper_test.ts',
    lineNum: 37,
    callsiteFrameIdx: 6,
    stackFrames: [
      [CallSite], [CallSite],
      [CallSite], [CallSite],
      [CallSite], [CallSite],
      [CallSite], CallSite {},
      [CallSite], [CallSite],
      [CallSite]
    ],
    isV8Frames: true
  },
  apiFnChain: [ &quot;Selector('basdf')&quot; ],
  apiFnIndex: 0
}

And if I'll just leave code like this:
<pre class=""lang-js prettyprint-override"">const selector = Selector('basdf')
await t.click(selector);

I will get just what I need -
 ✖ Edits auto on propositions

   1) The specified selector does not match any element in the DOM tree.
      
       &gt; | Selector('basdf')

      Browser: Chrome 83.0.4103.106 / macOS 10.15.5

         33 |
         34 |  // const someVar = 1;
         35 |
         36 |  // try {
         37 |    const selector = Selector('basdf')
       &gt; 38 |    await t.click(selector);
         39 |  // }
         40 |  // catch (e) {
         41 |  //   console.log(e);
         42 |  // }
         43 |});

         at &lt;anonymous&gt; (/Users/orkhan.mamedov/WebstormProjects/osago/tests/e2e/helper_test.ts:38:13)
         at fulfilled (/Users/orkhan.mamedov/WebstormProjects/osago/tests/e2e/helper_test.ts:5:58)



 1/1 failed (18s)


Is there any option to add custom info to that line:
<blockquote>
The specified selector does not match any element in the DOM tree.
</blockquote>
So it would be like that:
<blockquote>
The specified selector with locator: 'locator of a selector' does not match any element in the DOM tree.
</blockquote>
<strong>UPD 1</strong>
I've found a monkey-patchey way to do that. Its about to assign some prop to exception object, for example 'locator', and then just fix /testcafe/lib/errors/test-run/templates.js file:
  const locator = 'basdf'
  try {
    const selector = Selector(locator)
    await t.click(selector);
  }
  catch (e) {
    console.log(e);
    Object.assign(e,{ locator });
    throw e;
  }

...
[types_1.TEST_RUN_ERRORS.actionElementNotFoundError]: (err, viewportWidth) =&gt; `
        The specified selector with locator value: '${err.locator}' does not match any element in the DOM tree.

        ${utils_1.formatSelectorCallstack(err.apiFnChain, err.apiFnIndex, viewportWidth)}
    `,
...

<strong>UPD 2</strong>
My problem is when I have custom implemented xpath selector written in this way:
// xpath-selector.js
import { Selector } from 'testcafe';

const elementByXPath = Selector((xpath) =&gt; {
  const iterator = document.evaluate(
    xpath,
    document,
    null,
    XPathResult.UNORDERED_NODE_ITERATOR_TYPE,
    null
  );
  const items = [];

  let item = iterator.iterateNext();

  while (item) {
    items.push(item);
    item = iterator.iterateNext();
  }

  return items;
});

export default function (locator: string, timeout?: number) {
  // @ts-ignore
  if (!timeout) timeout = 9000;

  return Object.assign(
    Selector(elementByXPath(locator), { timeout: timeout }),
    { locator }
  );
}

I'm getting:
 ✖ Edits auto on propositions

   1) The specified selector does not match any element in the DOM tree.
      
       &gt; | Selector([function])

<strong>UPD 3</strong>
It's all up to those lines of code:
 if (!this.options.apiFnChain) {
            const fnType = typeof this.fn;
            let item = fnType === 'string' ? `'${this.fn}'` : `[${fnType}]`;
            item = `Selector(${item})`;
            this.options.apiFn = item;
            this.options.apiFnChain = [item];
        }

on selector-builder.js, and for now I'm trying to figure out how to patch this to be able to get client-side xpath function. Any suggestions?
",https://stackoverflow.com/questions/62510808/how-to-override-standard-testcafe-errors,"['testing', 'automation', 'automated-tests', 'e2e-testing', 'testcafe']",709,TRUE,0,2,
How to start a windows application as standard user when logged in from admin user,"I am working on automating tests for a windows application. This application behaves different depending whether logged in user has admin privilege or standard user(non-admin) privilege. Majority of my tests are for admin user, however a small subset it for non-admin user too.
So my question is - how to start a windows application with standard user privilege when logged with as admin privilege.
Logging off from admin user and logging back again with from standard user is not an option as it can not be done in my test automation setup.
",https://stackoverflow.com/questions/63426883/how-to-start-a-windows-application-as-standard-user-when-logged-in-from-admin-us,"['windows', 'testing', 'automated-tests']",28,FALSE,0,0,
TFS: How to convert an Automated test to standard/manual test,"Currently I have a bunch of automated tests that have steps that can be run manually.  The steps are things like press a button and verify that the view changes.  The test is marked as automated because once upon a time it was automated, but the test system is now defunct.

How do I change the test so I can run the test by hand following the steps like a standard test case (non-automated)?

I don't see a way to change it back to ""Not Automated"", or run it as not automated.
",https://stackoverflow.com/questions/62184003/tfs-how-to-convert-an-automated-test-to-standard-manual-test,"['testing', 'tfs', 'microsoft-test-manager']",76,TRUE,1,2,
What would be the ultimate golden standard for writing a login() function,"I was searching across the web for the ultimate 'login pattern' the one which includes a validation that login actually succeeds.
The problem - We do not allow using <em>expect</em> (aka assertions) within Pagemodels according to DRY and coding convention we decide on our team.
This is the current login method and it still flaky some times.
I want to ask you dear Automators, how you were designing the login including a validation?

/**
 * Actual login function
 */
async performLogin(): Promise&lt;void&gt; {
   console.log(`perform login`);
   await t
   .typeText(this.Email, username, {
      replace: true,
      paste: true
   })
   .typeText(this.Password, password, {
      replace: true,
      paste: true
   })
   .click(this.buttonSignIn)
}

/**
 * Login validation
 */
async login(): Promise&lt;void&gt; {
   await t.wait(7000)
   const getURL: any = ClientFunction(() =&gt; window.location.href)
   let currentURL: string = await getURL()

   while (currentURL === basePM.urlLogin) {
      this.performLogin()
      await t.eval(() =&gt; location.reload(true))
      currentURL = await getURL()
   }
}

",https://stackoverflow.com/questions/61172186/what-would-be-the-ultimate-golden-standard-for-writing-a-login-function,"['javascript', 'authentication', 'testing', 'automation', 'testcafe']",98,TRUE,0,1,
Unresolved symbols for androidTest dependencies in case of non-standard build types,"When I've decided to add instrumentation tests, I found that androidTestImplementation dependencies are not recognized. In my test file related classes like RunWith were displayed as Unresolved symbols.
When I've tried to run the test anyway, in run configuration there was a message: Error: Instrumentation runner class not specified."". I've checked, instrumentation runner class was explicitly specified in build.gradle.

I use custom build types like debugDev, debugProd.
",https://stackoverflow.com/questions/59478930/unresolved-symbols-for-androidtest-dependencies-in-case-of-non-standard-build-ty,"['android', 'android-studio', 'testing', 'android-instrumentation']",194,FALSE,0,1,
Nightwatch.JS unknown command: Cannot call non W3C standard command while in W3C mode,"Hey I'm new to Nightwatch.js, I've been trying to get browser.getElementSize to work with my Nightwatch.js setup. Every time I try run the test, I get errors saying W3C doesn't like it.

I've tried to add w3c equals false to my config file, but no matter where I put it, it still doesn't work.

desiredCapabilities: {
  browser: ""chrome"",
  ""javascriptEnabled"" : true,
  ""acceptSslCerts"" : true,
  name: ""Chrome-[Nightwatch] Sample Test"",
  chromeOptions: { w3c: false }
}


After running my test I get the following error messages:

<blockquote>
  Error while running .getElementSize() protocol action: unknown
  command: Cannot call non W3C standard command while in W3C mode
</blockquote>

and 

<blockquote>
  TimeoutError: An error occurred while running .getElementSize()
  command on &lt;#bedrooms>:
</blockquote>
",https://stackoverflow.com/questions/58525633/nightwatch-js-unknown-command-cannot-call-non-w3c-standard-command-while-in-w3c,"['javascript', 'testing', 'automation', 'nightwatch.js']",292,FALSE,0,0,
Do snapshot tests replace &quot;standard&quot; tests?,"I am doing some unit tests for my React components but I have never used snapshots before. When I see some code examples on github, many developers use exclusively snapshot testing other than ""standard tests"" like this: <a href=""https://react-testing-examples.com/"" rel=""nofollow noreferrer"">https://react-testing-examples.com/</a>

When I read about snapshots, they say ""Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly."", so I don't understand if I could use exclusively snapshots to test my components or not.
",https://stackoverflow.com/questions/58488933/do-snapshot-tests-replace-standard-tests,"['reactjs', 'testing', 'jestjs', 'snapshot']",23,FALSE,2,0,
Is there an standard benchmark for webAssembly?,"Is there any standard benchmark test for webAssembly or program langauage?

I want to migrate my c++ program to webAssembly ，so i must do some benchmark to test the preformence of webAssembly and compared it with c++ preformence.
",https://stackoverflow.com/questions/57016422/is-there-an-standard-benchmark-for-webassembly,"['c++', 'testing', 'benchmarking', 'webassembly']",194,TRUE,1,2,
Is there a standard way to automate testing of typescript compile-time constructs like mapped-types?,"Say we're trying to implement the Pick <a href=""https://www.typescriptlang.org/docs/handbook/advanced-types.html"" rel=""nofollow noreferrer"">mapped-type</a>:

type Pick&lt;T, K extends keyof T&gt; = {
    [P in K]: T[P];
};


We should expect that any type built from this conforms to some typescript compile-time check. Is there a way to test that? Using a testing framework or otherwise?

type Foo = { foo: string, bar: string };
type TestType = Pick&lt;Foo, 'foo'&gt;;

// expect this to fail at compile time because of property 'bar'
let foo: TestType = { foo: 'foo', bar: 'bar' };

",https://stackoverflow.com/questions/56259537/is-there-a-standard-way-to-automate-testing-of-typescript-compile-time-construct,"['typescript', 'unit-testing', 'testing', 'automated-tests', 'mapped-types']",90,FALSE,2,0,
Faking standard input for an XS function,"I'm trying to test a function that reads from standard input by redirecting the standard input to read from a file, more or less as <a href=""https://stackoverflow.com/questions/17432518/perl-testing-an-input-reader"">advised here</a>

Here's the script:

use strict;
use warnings;

use Term::EditLine qw(CC_EOF);

use v5.14;

my $el = Term::EditLine-&gt;new('progname');
$el-&gt;set_prompt ('# ');

$el-&gt;add_fun ('bye','desc',sub { say ""\nbye""; return CC_EOF; });
$el-&gt;parse('bind','-e');
$el-&gt;parse('bind','exit','bye');

*STDIN = *DATA;

while (defined($_ = $el-&gt;gets())) {
  say $_;
}

__DATA__;
goo
gar
exit


It's using <a href=""https://metacpan.org/pod/Term::EditLine"" rel=""nofollow noreferrer"">Term::Editline</a> which you would have to install first. In this case, instead of reading from the (faked) standard input, it drops me into the prompt. The input is designed so that the last one of them, exit, would signal exiting (as indicated in the command above). However, it simply does not take its input from the redirected handle. It might be the case that gets is actually a function defined in an XS, but it might be something completely different. Any help will be appreciated.
",https://stackoverflow.com/questions/53578985/faking-standard-input-for-an-xs-function,"['perl', 'testing', 'xs', 'editline']",75,FALSE,3,0,
Daylight Saving Time transition start time tests fail for &#39;GTB Standard Time&#39; on Windows,"I wrote several tests for converting times from a specific timezone to UTC. 

The rules say that in Europe the clocks are shifted forward at 01:00 UTC, for 'GTB Standard Time' this means +2 UTC, e.g. 03:00:00 .

However, I discovered that there are discrepancies in tests for different platforms (Linux vs Windows) using TimeZoneInfo.IsDaylightSavingTime(dateTime) method. 

I created a new test object for DST transition date and time:

var testDate = new DateTime(2019, 03, 31, 03, 20, 00); //20 minutes after Daylight Saving Time start
...


And passed it in for TimeZoneInfo 'timeZone' object, where time zone was set to 'GTB Standard Time':

...
    var timeZone = TimeZoneInfo.FindSystemTimeZoneById(""GTB Standard Time"");
    return timeZone.IsDaylightSavingTime(testDate);
}


This returns <strong>False</strong>, although 03:20:00 locally on 2019-03-31 the daylight saving should already be ON. This should have returned True. 

I managed to repeat this test only on Windows using built-in database for .Net timezones. With tzdata db (<em>NodaTime</em> for example) returns <em>True</em> for this test. 

Confusing part was that 
I manually threw an error for the timeZone object to see what extra information comes from TimeZoneInfo object and found that DST start is actually correct: 

timeZone.GetAdjustmentRules().First().DaylightTransitionStart.TimeOfDay


returns 03:00:00

Could someone confirm this and also is there a way to check where does windows take DST times? Can I make current test pass on both windows and linux without using any external libraries?
",https://stackoverflow.com/questions/53153622/daylight-saving-time-transition-start-time-tests-fail-for-gtb-standard-time-on,"['.net', 'datetime', 'testing', 'timezone', 'dst']",467,TRUE,2,1,
Test not being picked up by code coverage (c# .net standard),"I've implemented my own logger, which follows the ILogger interface.  Internally, it has the AppInsights Client and that's what my logger actually logs to.  Here's a simplified version of my class:

public class AppInsightsLogger : ILogger
{
    internal TelemetryClient Client { get; set; }

    public AppInsightsLogger(string instrumentationKey)
    {
        TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey;
        Client = new TelemetryClient();
    }

    public void Log&lt;T&gt;(LogLevel logLevel, EventId eventId, T state, Exception exception,
        Func&lt;T, Exception, string&gt; formatter)
    {
        if (string.IsNullOrEmpty(eventId.Name))
        {
            StackFrame frame = new StackFrame(1); 
            var method = frame.GetMethod();
            var type = method.DeclaringType;
            var name = method.Name;

            eventId = new EventId(eventId.Id == 0 ? BitConverter.ToInt32(Guid.NewGuid().ToByteArray(), 0) : eventId.Id, $""{type}:{name}"");
        }

        var props = new Dictionary&lt;string, string&gt;
        {
            { ""EventId"", eventId.Id.ToString() },
            { ""EventName"", eventId.Name }
        };

        var telemetry = new EventTelemetry(eventId.Name);

        if (!string.IsNullOrEmpty(state.ToString()))
        {
            telemetry.Properties.Add(""SummaryMessage"", state.ToString());
        }

        foreach (var property in props)
        {
            telemetry.Properties.Add(property);
        }

        Client.TrackEvent(telemetry);
    }
}


What I'd like to verify (potentially wrongly, please also advise), is that when I call my AppInsightsLogger classes Log method that it actually attempts to call the TelemetryClient's TrackEvent method.  I was thinking of a test like this:

    [Fact, IsUnit]
    public void Test_Telemetry_Log()
    {
        var mock = new Mock&lt;ILogger&gt;();

        mock.Setup(m =&gt; 
             m.Log&lt;string&gt;(It.IsAny&lt;LogLevel&gt;(), It.IsAny&lt;EventId&gt;(), It.IsAny&lt;string&gt;(), null, null));

        mock.Object.Log(LogLevel.Information, new EventId(1, ""test""), ""test"", null, null);

        mock.Verify();
    }


BUT when I run this test (which passes fine), it doesn't appear as covered by my code coverage monitor (Jetbrain's <em>dotCoverage</em>).

<a href=""https://i.stack.imgur.com/2ulNP.png"" rel=""nofollow noreferrer""><img src=""https://i.stack.imgur.com/2ulNP.png"" alt=""enter image description here""></a>

Any ideas how I perform this test correctly so I'm covering the code correctly?  I'm also using <strong>Moq</strong>.

Is the problem because it's a mocked instance?  I cant mock the TelemetryClient as my other thought to testing this was an instances of AppInsightsLogger and then verifying the TelemetryClient.log is called BUT it's a sealed class which complicates this test :-/

Thanks in advance for any tips!!
NOTE: I'm fairly new to writing tests - I understand the concepts but not actually carrying out.
",https://stackoverflow.com/questions/52875963/test-not-being-picked-up-by-code-coverage-c-net-standard,"['c#', 'unit-testing', 'testing', 'moq', 'code-coverage']",1193,TRUE,2,1,
Override Standard Assert Messaging in Pytest Assert,"I'm using Pytest to test some SQL queries my team runs programmatically over time.

My SQL queries are lists of JSONs - one JSON corresponds to one row of data.

I've got a function that diffs the JSON key:value pairs so that we can point to exactly which values are different for a given row.  Ideally, I'd output a list of these diffs <em>instead</em> of the standard output of an assert statement, which ends up looking clunky and not-very-useful for the end user.
",https://stackoverflow.com/questions/52319116/override-standard-assert-messaging-in-pytest-assert,"['python', 'testing', 'pytest', 'assert']",1797,TRUE,1,2,
Jmeters test standard,"I am using JMeter to test my own web application with the HTTP request. The final result seems okay. But I have one question are there any details of testing standard? Because I am writing a report which needs some data as a reference.

For example, something like the connected time and loading speed should lower than XXXXms or sample time should between XX and XX  

I didn't find there are any references about this. So is there anyone knows about this which I can be used as reference data
",https://stackoverflow.com/questions/49502336/jmeters-test-standard,"['testing', 'jmeter']",39,FALSE,0,2,
How to implement BDD practices with standard Go testing package?,"I want to write tests first, then write code that makes the tests pass.

I can write tests functions like this:

func TestCheckPassword(t *testing.T) {
    isCorrect := CheckPasswordHash(""test"", ""$2a$14$rz.gZgh9CHhXQEfLfuSeRuRrR5uraTqLChRW7/Il62KNOQI9vjO2S"")

    if isCorrect != true {
        t.Errorf(""Password is wrong"")
    }
}


But I'd like to have more descriptive information for each test function.

For example, I am thinking about creating auth module for my app.
Now, in plain English, I can easily describe my requirements for this module:

<ol>
<li>It should accept a non-empty string as input.</li>
<li>String must be from 6 to 48 characters long.</li>
<li>Function should return true if password string fits provided hash string and false if not.</li>
</ol>

What's the way to put this information that is understandable by a non-tech business person into tests besides putting them into comments?
",https://stackoverflow.com/questions/48882966/how-to-implement-bdd-practices-with-standard-go-testing-package,"['testing', 'go']",204,TRUE,0,3,
File system operation validation at C standard library level,"I'm implementing an alternative C standard library with file operation support.

I'm planning to support both:

<ul>
<li><a href=""https://www.gnu.org/software/libc/manual/html_node/I_002fO-on-Streams.html#I_002fO-on-Streams"" rel=""nofollow noreferrer"">file stream API</a> like fopen, fwrite and etc.</li>
<li><a href=""https://www.gnu.org/software/libc/manual/html_node/Low_002dLevel-I_002fO.html#Low_002dLevel-I_002fO"" rel=""nofollow noreferrer"">low level file API</a> like open, write and etc.</li>
</ul>

I'm looking for a test suite which validates my implementation against standard C requirements (example: validates that pread returns zero when the caller requests read beyond the file contents).

I'll be happy for your suggestions. 
",https://stackoverflow.com/questions/48544352/file-system-operation-validation-at-c-standard-library-level,"['c', 'testing', 'libc', 'test-suite']",41,FALSE,0,0,
Run setupclass as admin and remaining test as a standard user,"I am trying to run a test which sets some of the Windows registry keys, for which I need to run the test as an admin. I want to test the remaining parts as a standard user. This is for an automated test, so I can't create two scripts and run one in admin mode and the other in standard mode.

class abctest(unittest.Testcase):

    def setUpClass(cls):
        set_regkeys

   def setup(self):
       Normaluser_setup

   def test1(self):
       do teststeps

",https://stackoverflow.com/questions/46269956/run-setupclass-as-admin-and-remaining-test-as-a-standard-user,"['python', 'windows', 'testing']",31,FALSE,0,0,
How to test that Python and the standard libaries are properly installed?,"I'm sometimes sitting in front of a machine where I'm not sure whether Python with the standard libraries is fully installed.(*) 

<strong>Is there an easily accessible Python script (separately for Python 2 and Python 3) which checks that interpreter and the standard libraries are properly installed?</strong> 

I'm not after the full test suit of the Python source, rather a one-file script which checks main functionalities.

<hr>

(*) Scenarios where I might be unsure what's installed: Frequent installing and uninstalling of stuff through the package manager (e.g. setup.exe for Cygwin)  or the machine is a single-board computer (e.g. Rasberry Pi) where by default everything <em>might</em> be installed - or not.
",https://stackoverflow.com/questions/45427640/how-to-test-that-python-and-the-standard-libaries-are-properly-installed,"['python', 'testing', 'installation']",63,FALSE,1,0,
Why isn&#39;t there any standard automation testing tools for game development?,"There are plenty of testing tools for creating software, a couple come to mind such as Test Complete and Selenium. But I’ve never seen or heard of a automation testing tool designed for the gaming industry, apart from the ones that come equipped with game engines such as Unity and Unreal. But these tools have to be built on, to my understanding they give devs the required code and you build on it to suit your game.

From what I understand automation testing in game development isn't really common, but is still done by some companies, and they do it through different methods such as developing AI that can play the game at a faster rate then a normal player  thus discovering the flaws and glitches of the game faster.  <a href=""https://gamedev.stackexchange.com/questions/21397/how-common-is-automated-testing-in-game-development"">https://gamedev.stackexchange.com/questions/21397/how-common-is-automated-testing-in-game-development</a> 

But what I don't understand is why doesn't such a system exist. I know that games are vastly different and creating one tool that suits all games may be difficult but certainly not impossible, there is a lot to gain from such a tool.

Is it technical limitations? Or am I simply overthinking it. 

I also feel that I should add that I have never used an automation testing tools, neither the ones I mentioned in the very beginning or the ones that come equipped with game engines.
",https://stackoverflow.com/questions/45293840/why-isnt-there-any-standard-automation-testing-tools-for-game-development,"['testing', 'automated-tests', 'game-engine']",386,FALSE,-1,1,
Is there a standard way to tell py.test to run against specific code?,"I'm trying to run a Python project's unit tests using py.test.  Until recently I've used nose and it ran the tests against my local source code instead of the installed package, but py.test seems to want to run against the installed package, meaning I have to run python setup.py install before every test run.

The project is organized like so:

/project
    /project  
        __init__.py
        project_file.py
    /test
        __init__.py
        /test_project
            test_project_file.py


The only way I've found to get py.test to run against the local code is to run python -m pytest in the top /project folder.  It's very strange, as running py.test in the same location runs against the installed code.  According to <a href=""http://doc.pytest.org/en/latest/usage.html#cmdline"" rel=""nofollow"">the docs</a> these commands ought to be equivalent, and --version returns the same info for both.

Is there a standard way to tell py.test to run against specific code?  I haven't been able to find a clear answer in py.test's documentation.
",https://stackoverflow.com/questions/39499937/is-there-a-standard-way-to-tell-py-test-to-run-against-specific-code,"['python', 'python-2.7', 'unit-testing', 'testing', 'pytest']",997,TRUE,1,1,
Asserting for a specific error using only standard library in golang,"Let's suppose I have a function which return base64 encoded string for a file which is located at a specific path. 

func getFile(path string) (string, error) {
    imgFile, err := ioutil.ReadFile(path)
    if err != nil {
        return """", fmt.Errorf(""Error opening image file: %s"", err)
    }

    base64 := base64.StdEncoding.EncodeToString(imgFile)
    return base64, nil
}


Now, I'm writing table driven tests for this function and they right now look like this. 

func TestGetFile(t *testing.T) {
    type getFileTest struct {
        Path   string
        Base64 string
        Err    error
    }

    getFileTests := []getFileTest{
        {"""", """", nil},
    }
    for _, td := range getFileTests {
        base64, err := getFile(td.Path)
        if err != nil {
            t.Errorf(""TestGetFile: Error calling getFile: %s"", err)
        }
        if base64 != td.Base64 {
            t.Errorf(""TestGetFile: Return values from getFile is not expected: Expected: %s, Returned: %s"", td.Base64, base64)
        }
    }

}


Now, current test fails with:- 

test.go:18: TestGetFile: Error calling getFile: Error opening image file: open : no such file or directory


How do I assert that I get the right error when I pass empty path to getFile?
",https://stackoverflow.com/questions/37659195/asserting-for-a-specific-error-using-only-standard-library-in-golang,"['unit-testing', 'testing', 'go']",1904,TRUE,3,3,
Map different memories in standard C,"I'm working developing some embedded system with an 8051 at work. Today, all codes are written with IAR, which manage the different memories of the micro with some keywords like __xdata, __pdata, etc...

We're starting with unit testing using the framework Ceedling and I think that the best way of testing my units is making a native executable (<a href=""http://www.throwtheswitch.org/build/which"" rel=""nofollow"">http://www.throwtheswitch.org/build/which</a>) and test in my linux and then, once my soft is done, compile it for the 8051.

My problem now is that I don't know how to map the different types of memories of the micro without using the IAR keywords. Does anyone have this problem?
",https://stackoverflow.com/questions/32457247/map-different-memories-in-standard-c,"['c', 'testing', 'memory', 'standards', 'iar']",123,FALSE,1,1,
Are there a standard set of symbols for representing different classes of functions in documentation?,"When describing a function in relation to its class (and I'm thinking in JavaScript although I reckon this could apply to most languages), I'm wondering if there are a standard set of symbols to denote the relationship of function to class.

For example it would make sense to me that a static or class function would be represented as

ClassName.functionName


since that's the way you would refer to it in code.

Other types of function would be instance methods and private function. Maybe there are more that I'm not considering (anonymous functions?).

When referring to these types of function in text (say, documentation or a test description) how do you represent the relationship between function and class? Currently I have different symbols that I use instead of the '.' but I'm wondering if there are standard symbols for this purpose.
",https://stackoverflow.com/questions/32273750/are-there-a-standard-set-of-symbols-for-representing-different-classes-of-functi,"['javascript', 'testing', 'documentation', 'notation']",46,FALSE,2,0,
Testing a method that reads from standard input and outputs to standard output,"I have a method which reads lines from the standard input and writes lines to the standard output. 

From within a JUnit test, how can I send input to the method, and how can I capture its output so that I can make assertions on it?
",https://stackoverflow.com/questions/29283547/testing-a-method-that-reads-from-standard-input-and-outputs-to-standard-output,"['java', 'unit-testing', 'testing', 'junit']",1304,TRUE,5,1,
"In Python, testing the standard output of a function","I've been trying to write a test (using unittest) to test the output of a function.
The function is a follows:

def main():
    arg_pressent = len(sys.argv)
    if arg_pressent &lt; 2:
        print ""usage: ./pyPeerChat [IP ADDRESS of pc] / [0 (if the network is not known. This will assume that this peer will be the start of a new network)]""
    else: 
          IP = str(sys.argv[1])
          connect.main(IP)

if __name__ == '__main__':
     main()


So, my test would need test the fact that, when this function runs on its own (not being passed any arguments), it prints 'usage: ./pyPeerChat [IP ADDRESS of pc] / [0 (if the network is not known. This will assume that this peer will be the start of a new network)]'.

So far, the test I've currently been trying to implement has been:

import myModuleChat
from io import StringIO
import unittest
from mock import patch

def main():
     Testmain.test_main_prints_without_ARGs()

class TestMain(unittest.TestCase):
     def test_main_prints_without_ARGs(self):
          expected_print = 'usage: ./pyPeerChat [IP ADDRESS of Bootpeer] / [0 (if the network is not known. This will assume that this peer will be the #start of a new network)]'
          with patch('sys.stdout', new=StringIO()) as fake_out:
               pyPeerChat.main()
          self.assertEqual(fake_out.getvalue(), expected_print)

if __name__ == '__main__':
     test_program = unittest.main(verbosity=0, buffer=False, exit=False)


However, I've been unable to get this test to pass sucessfully. The test fails, and I get an error. Below is the entire output of the test, with the error:

======================================================================
ERROR: test_main_prints_without_ARGs (__main__.TestMain)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""testpyPeerChat.py"", line 24, in test_main_prints_without_ARGs
    pyPeerChat.main()
  File ""/home/peer-node/Testing/P2PChat/source/pyPeerChat.py"", line 47, in main
    print ""usage: ./pyPeerChat [IP ADDRESS of Bootpeer] / [0 (if the network is not known. This will assume that this peer will be the start of a new network)]""
TypeError: unicode argument expected, got 'str'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)


I'm not at all sure what this error means because the code works fine. Is there an easier way to write the test I need, or a way to fix my test?
",https://stackoverflow.com/questions/29686331/in-python-testing-the-standard-output-of-a-function,"['python', 'unit-testing', 'testing', 'stdout']",998,TRUE,2,1,
testing Django with standard Unittest: &#39;DatabaseWrapper&#39; object has no attribute &#39;Database&#39;,"I am trying to test my Django test files separately, one by one, as ./manage.py test freezes for 5secs after each run due to heavy apps.

This is my test (not even a test yet though, just playing with requests):

if __name__ == ""__main__"":
    import unittest

    # manually get all the django stuff into memory if file is called directly
    import os,sys
    TEST_ROOT = os.path.realpath(os.path.dirname(__file__))
    PROJ_AND_TEST_ROOT = os.path.dirname(os.path.dirname(TEST_ROOT))
    PROJECT_ROOT = os.path.join(PROJ_AND_TEST_ROOT, 'the_game')
    sys.path.append(PROJECT_ROOT)
    os.environ.setdefault(""DJANGO_SETTINGS_MODULE"", ""the_game.settings"")
    from django.core.wsgi import get_wsgi_application
    application = get_wsgi_application()


from django.test import TestCase, RequestFactory
from django.contrib.auth.models import User

from interface.views import bets

class ViewTests(TestCase):
    def test_bets_view(self):
        request_factory=RequestFactory()
        request=request_factory.get('/')

        user = User.objects.create_user('testname','test@na.me','testname')
        request.user=user
        response=bets(request)
        print response


if __name__ == ""__main__"":
    unittest.main()


However, running this I get the following:

======================================================================
ERROR: test_bets_view (__main__.ViewTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/test/testcases.py"", line 182, in __call__
    self._pre_setup()
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/test/testcases.py"", line 754, in _pre_setup
    self._fixture_setup()
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/test/testcases.py"", line 887, in _fixture_setup
    if not connections_support_transactions():
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/test/testcases.py"", line 874, in connections_support_transactions
    for conn in connections.all())
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/test/testcases.py"", line 874, in &lt;genexpr&gt;
    for conn in connections.all())
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/utils/functional.py"", line 55, in __get__
    res = instance.__dict__[self.func.__name__] = self.func(instance)
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/db/backends/__init__.py"", line 782, in supports_transactions
    self.connection.leave_transaction_management()
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/db/backends/__init__.py"", line 338, in leave_transaction_management
    if managed == self.get_autocommit():
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/db/backends/__init__.py"", line 345, in get_autocommit
    self.ensure_connection()
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/db/backends/__init__.py"", line 133, in ensure_connection
    self.connect()
  File ""/Users/1111/.virtualenvs/the_game/lib/python2.7/site-packages/django/db/utils.py"", line 86, in __exit__
    db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)
AttributeError: 'DatabaseWrapper' object has no attribute 'Database'


The project itself works perfectly without errors (./manage.py runserver), as do django tests (./manage.py test ../tests).

How can I fix this?

p.s. This is not a duplicate of <a href=""https://stackoverflow.com/questions/20315750/attributeerror-databasewrapper-object-has-no-attribute-database"">this question</a>. Its author had problems with standard Django testing, while it works fine for my project. My trouble is with third-party testing.
",https://stackoverflow.com/questions/29249624/testing-django-with-standard-unittest-databasewrapper-object-has-no-attribute,"['python', 'django', 'testing']",679,TRUE,0,1,
